fix hugo install force option

trantor
David Kebler 2020-12-20 17:58:20 -08:00
parent 9e5768aa4d
commit 2321889a52
1 changed files with 36 additions and 36 deletions

View File

@ -22,6 +22,9 @@ EFILE=""
# c - use 'hugoe' as the install command for extended version otherwise 'hugo' will launch extended version # c - use 'hugoe' as the install command for extended version otherwise 'hugo' will launch extended version
# f - force download/overwrite of same version # f - force download/overwrite of same version
declare OPTION
declare OPTARG
declare OPTIND
while getopts 'ecf' OPTION; do while getopts 'ecf' OPTION; do
case "$OPTION" in case "$OPTION" in
@ -74,7 +77,7 @@ if [ -z "$NEW_VERSION" ]; then
exit 1 exit 1
fi fi
if ! [ $NEW_VERSION = $CUR_VERSION ] || [ $FORCE = true ]; then [[ $NEW_VERSION = $CUR_VERSION ]] && [[ $FORCE = false ]] && echo Latest version already installed at $BIN_PATH && return 0
pushd /tmp/ > /dev/null pushd /tmp/ > /dev/null
@ -120,6 +123,7 @@ rm $TARBALL
echo Installing hugo `[ $EXTENDED == true ] && echo "extended"` as hugo$EFILE echo Installing hugo `[ $EXTENDED == true ] && echo "extended"` as hugo$EFILE
BIN_PATH="$(which hugo$EFILE)" BIN_PATH="$(which hugo$EFILE)"
if [ -z "$BIN_PATH" ]; then if [ -z "$BIN_PATH" ]; then
printf "WARNING: Installed Hugo Binary in $BIN_DIR is not in your environment path\nPATH=$PATH\n" printf "WARNING: Installed Hugo Binary in $BIN_DIR is not in your environment path\nPATH=$PATH\n"
else else
@ -132,8 +136,4 @@ else
fi fi
fi fi
else
echo Latest version already installed at $BIN_PATH
fi
} }