From a31340d3c2f3f0d53ccbf8c813be642de122fb7a Mon Sep 17 00:00:00 2001 From: Tomas Plesnik <plesnik@ics.muni.cz> Date: Fri, 3 Oct 2014 19:18:26 +0200 Subject: [PATCH] uprava chybovych hlasek; pridana kontrola zapisu do adresare warden serveru; revize funkce err a errClean --- src/warden-server/sh/update.sh | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/warden-server/sh/update.sh b/src/warden-server/sh/update.sh index 3221c01..95fc10e 100755 --- a/src/warden-server/sh/update.sh +++ b/src/warden-server/sh/update.sh @@ -38,8 +38,9 @@ version() err() { echo "FAILED!" + echo cat "$err" - rm -f "$backup" + rm -f "$backup" 2>/dev/null rm -f "$err" echo echo "Update from $old_package_version to $package_version package FAILED!!!" @@ -51,8 +52,8 @@ errClean() { echo "FAILED!" echo " -> Reverting changes of Warden server package ... OK" - rm -r ${server_path}/* > /dev/null 2>&1 - cp -R ${backup_dir}/* $server_path + rm -r "${basedir}/"* > /dev/null 2>&1 + cp -R "${backup}/"* "$basedir" cat $err rm -r $err $backup echo @@ -76,13 +77,19 @@ paramsChck() wardenDirChck() { echo -n "Checking Warden server directory ... " - if [[ ! -d "$basedir" ]] && [[ ! -w "$basedir" ]]; then + if [[ ! -d "$basedir" ]]; then + echo "FAILED!" + echo + echo "Warden server is not installed!" + exit 1 + elif [[ ! -w "$basedir" ]]; then echo "FAILED!" - echo "No version of Warden server is not installed!" + echo + echo "You do not have permission to update Warden server!" exit 1 - else + else echo "OK" - fi + fi } @@ -93,14 +100,20 @@ oldPackageChck() if [ -f "$old_package_version_file" ]; then old_package_version=$(<"$old_package_version_file") if [ "$old_package_version" == "$package_version" ]; then - echo "Sorry, but $package_version package is already installed!" + echo "FAILED!" + echo + echo "Package $package_version is already installed!" exit 1 elif [ "$old_package_version" == "warden-server-2.0" ]; then - echo "Sorry, first of all you must upgrade to package warden-server-2.1!" + echo "FAILED!" + echo + echo "First of all you must upgrade to package warden-server-2.1!" exit 1 fi else - echo "Sorry, but Warden server package is not yet installed!" + echo "FAILED!" + echo + echo "Warden server package is not yet installed!" echo "For installation of Warden server package please use install.sh" exit 1 fi @@ -116,7 +129,7 @@ perlChck() else echo "FAILED!" echo - echo "Error: Perl interpreter is not installed!" + echo "Perl interpreter is not installed!" exit 1 fi } -- GitLab