diff --git a/update-from-repo.sh b/update-from-repo.sh index 08698124e..6e6f6cff2 100755 --- a/update-from-repo.sh +++ b/update-from-repo.sh @@ -7,7 +7,7 @@ # # Kay Marquardt, kay@rrr.de, https://github.com/gandelwartz ############################################################################# -IAM=`basename $0` + # don't ask -y given ASK="YES" if [[ "$1" == "-y" || "$1" == "-yes" || "$1" == "-f" || "$1" == "-force" ]] ; then @@ -33,6 +33,9 @@ if [[ -t 1 && "${NCOLOR}" != "YES" ]] ; then NC='\e[0m' fi +# Clear screen for better readability +[[ "${ASK}" == "YES" ]] && clear + # Get webmin/usermin dir based on script's location DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROD="webmin" # default @@ -56,7 +59,7 @@ LTEMP="${DIR}/.~lang" # help requested output usage if [[ "$1" == "-h" || "$1" == "--help" ]] ; then echo -e "${NC}${ORANGE}This is the unofficial webmin update script${NC}" - echo "Usage: ${IAM} [-force] [-repo:username/xxxmin] [-release[:number]] [-file file ...]" + echo "Usage: ./`basename $0` [-force] [-repo:username/xxxmin] [-release[:number]] [-file file ...]" [[ "$1" == "--help" ]] && cat </dev/null | grep ${PROD} | head -n 1` echo -e "${ORANGE}found: ${MINICONF}${NC} (alternative location)" fi -[[ "${MINICONF}" != "" ]] && export PATH="${PATH}:`grep path= ${MINICONF}| sed 's/^path=//'`" +# add PATH from config to system PATH +if [[ "${MINICONF}" != "" ]] ; then + export PATH="${PATH}:`grep path= ${MINICONF} | sed 's/^path=//'`" +fi + +# check if git is availible if type ${GIT} >/dev/null 2>&1 ; then true else @@ -140,23 +134,21 @@ fi ################ # lets start -# Clear screen for better readability -[[ "${ASK}" == "YES" ]] && clear # alternative repo given if [[ "$1" == *"-repo"* ]]; then if [[ "$1" == *":"* ]] ; then REPO=${1##*:} - [[ "${REPO##*/}" != "webmin" && "${REPO##*/}" != "usermin" ]] && echo -e "${RED}error: ${ORANGE} ${REPO} is not a valid repo name!${NC}" && exit 1 + [[ "${REPO##*/}" != "webmin" && "${REPO##*/}" != "usermin" ]] && echo -e "${RED}Error: ${REPO} is not a valid repo name!${NC}" && exit 1 shift else - echo -e "${ORANGE}./`basename $0`:${NC} Argument -repo needs parameter" + echo -e "${ORANGE}./`basename $0`:${NC} Missing argument for parameter -repo. aborting ..." exit 1 fi fi # warn about possible side effects because webmins makedist.pl try cd to /usr/local/webmin (and more) -[[ -d "/usr/local/webadmin" ]] && echo -e "${RED}Warning:${NC} /usr/local/webadmin ${ORANGE}exist, update may fail!${NC}" +[[ -d "/usr/local/webadmin" ]] && echo -e "${ORANGE}Warning: Develop dir /usr/local/webadmin exist, update may fail!${NC}" ################ # really update? @@ -307,7 +299,7 @@ fi fi else # something went wrong - echo -e "${RED}${ERROR}Error: updating files, failed.${NC}" + echo -e "${RED}${ERROR} Error: updating files, failed.${NC}" exit 4 fi