melonvpn-original-cs/install

62 lines
1.6 KiB
Bash
Executable File

#!/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" == "yes" ]; 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 $forceVpnInstall
echo "[info] Preparing to build projects from source"
./build
echo "[info] Preparing to install components"
./install-components $forceAppIndicator
echo "[info] Install process finished"