spice up the installer a bit

This commit is contained in:
Melon 2021-03-23 22:25:15 +00:00
parent 18fd6a9d58
commit 337fb5b78f
3 changed files with 67 additions and 5 deletions

57
install
View File

@ -1,8 +1,61 @@
#!/bin/bash
# idiomatic parameter and option handling in bash
forceVpnInstall="no"
forceAppIndicator="no"
badoption=""
unknownargument=""
while test $# -gt 0
do
case "$1" in
--reinstall-vpn) forceVpnInstall="yes"
;;
--appindicator) forceAppIndicator="yes"
;;
--help) showHelp="yes"
;;
--*) badoption="$1"
;;
*) unknownargument="$1"
;;
esac
if [ -n "$badoption" ]; then
echo "Unknown option: $badoption"
echo "Run './install --help' for more information"
exit 1
elif [ -n "$unknownargument" ]; then
echo "Unknown argument: $unknownargument"
echo "Run './install --help' for more information"
exit 1
fi
shift
done
firstTime="no"
firstTimePath=".git/melon-vpn-install"
if [ ! -f "$firstTimePath" ]; then
showHelp="yes"
firstTime="yes"
fi
if [ "$showHelp" == "yes" ]; then
echo "MelonVPN installer"
echo "=================="
echo "Use './install' for a normal build"
echo "--help = display these help options"
echo "--reinstall-vpn = force reinstall simple-vpn"
echo "--appindicator = force copy appindicator dll into install directory"
if [ "$firstTime" ]; then
echo -e "\nThis message was displayed as it is your first time using this installer"
echo "Repeat the command to install MelonVPN"
touch "$firstTimePath"
fi
exit 0
fi
echo "[info] Preparing to setup dependencies"
./install-dependencies $1
./install-dependencies $forceVpnInstall
echo "[info] Preparing to build projects from source"
./build
echo "[info] Preparing to install components"
./install-components
./install-components $forceAppIndicator
echo "[info] Install process finished"

View File

@ -1,4 +1,7 @@
#!/bin/bash
# arguments
forceAppIndicator="$1"
# new lib folder
sudo mkdir -p /usr/lib/melon-vpn/
@ -40,14 +43,17 @@ fi
sudo chown root:root /etc/melon-vpn/client.cfg
# copy more files
if [ "$forceAppIndicator" == "yes" ]; then
sudo cp MelonVPNClient/bin/Release/appindicator3-sharp.dll /usr/lib/melon-vpn/
echo "[warning] appindicator3-sharp.dll has been copied as a component, if appindicator was installed through software run ./remove-appindicator3-component"
fi
sudo cp MelonVPNClient/bin/Release/libnotify.net.dll /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/MelonVPNClient.exe /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/MelonVPNClient.exe.config /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/MiniMelonVPNIcon.png /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/MiniMelonVPNOnline.png /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/MelonVPNDesktopIcon.png /usr/lib/melon-vpn/
sudo cp MelonVPNClient/bin/Release/libappindicator3sharpglue-12.10.0.so /usr/lib/melon-vpn/
# copy app indicator icons
mkdir -p ~/.local/share/icons/hicolor/128x128/apps/

View File

@ -1,4 +1,7 @@
#!/bin/bash
# arguments
forceVpnInstall="$1"
# Check if golang exists by the output of "go version"
if [ "$(go version | head -c 13)" == "go version go" ]; then
echo "Assuming go is installed"
@ -11,7 +14,7 @@ if [ "$(go version | head -c 13)" == "go version go" ]; then
shouldbuild="ye"
fi
# Look for an argument to force simple vpn re-install
if [ "$1" = "force" ]; then
if [ "$forceVpnInstall" = "yes" ]; then
shouldbuild="ye"
echo "Install enforced!"
fi