mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
Changed how undocumented flags are managed
- Renamed '--i_do_not_follow_recommendations' to '--skip-space-check', since the argument actually skips the space check. - Obtain the unattended configuration dynamically, by looking at the argument next to '--unattended', instead of looking at the second argument, which was a too fragile parsing. - Because of the previous one, figuring out when no argument has been passed to '--unattended' doesn't seem trivial, because the next argument could be an undocumented flag as well, which would be intepreted as a filename.
This commit is contained in:
parent
ba4c2c91db
commit
c8a9e2100a
1 changed files with 14 additions and 12 deletions
|
@ -102,25 +102,27 @@ main(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check arguments for the undocumented flags
|
# Check arguments for the undocumented flags
|
||||||
for var in "$@"; do
|
for ((i=1; i <= "$#"; i++)); do
|
||||||
case "$var" in
|
j="$((i+1))"
|
||||||
"--i_do_not_follow_recommendations" ) skipSpaceCheck=false;;
|
case "${!i}" in
|
||||||
"--unattended" ) runUnattended=true;;
|
"--skip-space-check" ) skipSpaceCheck=true;;
|
||||||
"--reconfigure" ) reconfigure=true;;
|
"--unattended" ) runUnattended=true; unattendedConfig="${!j}";;
|
||||||
|
"--reconfigure" ) reconfigure=true;;
|
||||||
"--show-unsupported-nics" ) showUnsupportedNICs=true;;
|
"--show-unsupported-nics" ) showUnsupportedNICs=true;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "${runUnattended}" == true ]]; then
|
if [[ "${runUnattended}" == true ]]; then
|
||||||
echo "::: --unattended passed to install script, no whiptail dialogs will be displayed"
|
echo "::: --unattended passed to install script, no whiptail dialogs will be displayed"
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$unattendedConfig" ]; then
|
||||||
echo "::: No configuration file passed, using default settings..."
|
echo "::: No configuration file passed"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
if [ -r "$2" ]; then
|
if [ -r "$unattendedConfig" ]; then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$2"
|
source "$unattendedConfig"
|
||||||
else
|
else
|
||||||
echo "::: Can't open $2"
|
echo "::: Can't open $unattendedConfig"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -165,7 +167,7 @@ main(){
|
||||||
# Start the installer
|
# Start the installer
|
||||||
# Verify there is enough disk space for the install
|
# Verify there is enough disk space for the install
|
||||||
if [[ "${skipSpaceCheck}" == true ]]; then
|
if [[ "${skipSpaceCheck}" == true ]]; then
|
||||||
echo "::: --i_do_not_follow_recommendations passed to script, skipping free disk space verification!"
|
echo "::: --skip-space-check passed to script, skipping free disk space verification!"
|
||||||
else
|
else
|
||||||
verifyFreeDiskSpace
|
verifyFreeDiskSpace
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue