diff --git a/packages/build-client.sh b/packages/build-client.sh index f8c129a604f2291286137eb40e8ea330bf8d2c43..5e176f4e0ac3da5d3e47bf75fdc2ae8f4fbdeec7 100755 --- a/packages/build-client.sh +++ b/packages/build-client.sh @@ -66,97 +66,48 @@ echo "Building $package_name package version $version ..." echo echo -n "Building 'base' directory ... " -mkdir -p $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/sh/* $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/CHANGELOG $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/INSTALL $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/LICENSE $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/README $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/README.cesnet $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi - +mkdir -p $package 2> $err || err +cp -R ../src/$package_name/sh/* $package 2> $err || err +cp ../src/$package_name/doc/CHANGELOG $package 2> $err || err +cp ../src/$package_name/doc/INSTALL $package 2> $err || err +cp ../src/$package_name/doc/LICENSE $package 2> $err || err +cp ../src/$package_name/doc/README $package 2> $err || err +cp ../src/$package_name/doc/README.cesnet $package 2> $err || err echo "OK" echo -n "Building '$doc' directory ... " -mkdir -p $doc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/doc/* $doc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $doc 2> $err || err +cp -R ../src/$package_name/doc/* $doc 2> $err || err echo "OK" echo -n "Building '$etc' directory ... " -mkdir -p $etc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/etc/package_version $etc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $etc 2> $err || err +cp ../src/$package_name/etc/package_version $etc 2> $err || err echo "OK" echo -n "Building '$lib' directory ... " -mkdir -p $lib 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/lib/* $lib 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $lib 2> $err || err +cp -R ../src/$package_name/lib/* $lib 2> $err || err echo "OK" echo -n "Building '$var' directory ... " -mkdir -p $var 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $var 2> $err || err echo "OK" # create tarball echo -n "Creating $tar tarball ... " -tar czf $tar $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +tar czf $tar $package 2> $err || err echo "OK" # create sign of tarball echo -n "Creating $sig file ... " -sha1sum $tar > $sig 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +sha1sum $tar > $sig 2> $err || err echo "OK" diff --git a/packages/build-server.sh b/packages/build-server.sh index 75a7f2b0c0b6bc6359d45aac5e2210ac1e429583..3b7be0c0f789d5b956e4552e0a33008ded063b96 100755 --- a/packages/build-server.sh +++ b/packages/build-server.sh @@ -67,109 +67,50 @@ echo "Building $package_name package version $version ..." echo echo -n "Building 'base' directory ... " -mkdir -p $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/sh/install.sh $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/sh/uninstall.sh $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/CHANGELOG $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/INSTALL $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/LICENSE $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/doc/README $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $package 2> $err || err +cp ../src/$package_name/sh/install.sh $package 2> $err || err +cp ../src/$package_name/sh/uninstall.sh $package 2> $err || err +cp ../src/$package_name/doc/CHANGELOG $package 2> $err || err +cp ../src/$package_name/doc/INSTALL $package 2> $err || err +cp ../src/$package_name/doc/LICENSE $package 2> $err || err +cp ../src/$package_name/doc/README $package 2> $err || err echo "OK" echo -n "Building '$bin' directory ... " -mkdir -p $bin 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/bin/* $bin 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/sh/create_tables.sh $bin 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $bin 2> $err || err +cp -R ../src/$package_name/bin/* $bin 2> $err || err +cp -R ../src/$package_name/sh/create_tables.sh $bin 2> $err || err echo "OK" echo -n "Building '$doc' directory ... " -mkdir -p $doc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/doc/* $doc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $doc 2> $err || err +cp -R ../src/$package_name/doc/* $doc 2> $err || err echo "OK" echo -n "Building '$etc' directory ... " -mkdir -p $etc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp ../src/$package_name/etc/package_version $etc 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $etc 2> $err || err +cp ../src/$package_name/etc/package_version $etc 2> $err || err echo "OK" - echo -n "Building '$lib' directory ... " -mkdir -p $lib 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi -cp -R ../src/$package_name/lib/* $lib 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $lib 2> $err || err +cp -R ../src/$package_name/lib/* $lib 2> $err || err echo "OK" - echo -n "Building '$var' directory ... " -mkdir -p $var 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +mkdir -p $var 2> $err || err echo "OK" # create tarball echo -n "Creating $tar tarball ... " -tar czf $tar $package 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +tar czf $tar $package 2> $err || err echo "OK" # create sign of tarball echo -n "Creating $sig file ... " -sha1sum $tar > $sig 2> $err; ret_val=`echo $?` -if [ $ret_val -ne 0 ]; then - err -fi +sha1sum $tar > $sig 2> $err || err echo "OK" diff --git a/src/warden-client/sh/install.sh b/src/warden-client/sh/install.sh index 726318b7e8a7e644e288df642b7de2609f7249a0..d415fbee5d80edfb5cf9d2624ce6ef4fc77ad85c 100755 --- a/src/warden-client/sh/install.sh +++ b/src/warden-client/sh/install.sh @@ -156,8 +156,7 @@ old_client_chck() perl_chck() { echo -n "Checking Perl interpreter ... " - which perl 1>/dev/null; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if which perl 1> /dev/null; then echo "OK" else echo "FAILED!" @@ -172,8 +171,7 @@ modules_chck() for module in ${modules[@]}; do echo -n "Checking $module module ... " - perl -e "use $module" 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if perl -e "use $module" 2> $err; then echo "OK" else err @@ -185,8 +183,7 @@ modules_chck() make_warden_dir() { echo -n "Creating warden client directory ... " - cp -R $dirname/warden-client $prefix 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp -R $dirname/warden-client $prefix 2> $err; then echo "OK" else err_clean @@ -204,8 +201,7 @@ make_warden_dir() copy_key() { echo -n "Copying certificate key file ... " - cp $key $etc 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp $key $etc 2> $err; then echo "OK" else err_clean @@ -216,8 +212,7 @@ copy_key() copy_cert() { echo -n "Copying certificate file ... " - cp $cert $etc 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp $cert $etc 2> $err; then echo "OK" else err_clean @@ -264,8 +259,7 @@ make_conf_file() change_permissions() { echo -n "Changing permissions to installed package ... " - chown -R $user: $client_path 2>$err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if chown -R $user: $client_path 2>$err; then echo "OK" else err_clean diff --git a/src/warden-client/sh/uninstall.sh b/src/warden-client/sh/uninstall.sh index bb4cc9b5e0edbd1e1bcf264dc4c8ad8480a465d8..98342e808966da4a019d55629982479a6dbfdd8b 100755 --- a/src/warden-client/sh/uninstall.sh +++ b/src/warden-client/sh/uninstall.sh @@ -149,8 +149,7 @@ backup() { echo -n "Backing-up warden client directory ... " mkdir $backup_dir - cp -R $client_path $backup_dir 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp -R $client_path $backup_dir 2> $err; then echo "OK" else err @@ -161,8 +160,7 @@ backup() uninstall_warden_client() { echo -n "Uninstalling $package_version package ... " - rm -rf $client_path 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if rm -rf $client_path 2> $err; then echo "OK" else err_clean diff --git a/src/warden-client/sh/update.sh b/src/warden-client/sh/update.sh index 200e1c6dc6b65226a4ef374fc02ae5922d791a05..ea49b3eb27357dff14243d3016e1da55cd9dfd37 100755 --- a/src/warden-client/sh/update.sh +++ b/src/warden-client/sh/update.sh @@ -143,8 +143,7 @@ obtain_package_version() perl_chck() { echo -n "Checking Perl interpreter ... " - which perl 1>/dev/null; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if which perl 1> /dev/null; then echo "OK" else echo "FAILED!" @@ -159,8 +158,7 @@ modules_chck() for module in ${modules[@]}; do echo -n "Checking $module module ... " - perl -e "use $module" 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if perl -e "use $module" 2> $err; then echo "OK" else err @@ -186,8 +184,7 @@ backup() { echo -n "Backing-up warden client directory ... " mkdir $backup_dir - cp -R $client_path $backup_dir 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp -R $client_path $backup_dir 2> $err; then echo "OK" else err @@ -198,8 +195,7 @@ backup() obtain_warden_user() { echo -n "Obtaining warden client directory owner ... " - user=`stat -c %U $conf_file` 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if user=`stat -c %U $conf_file` 2> $err; then echo "OK" else err @@ -210,8 +206,7 @@ obtain_warden_user() update_warden_dir() { echo -n "Updating warden client directory ... " - rsync -q --recursive --archive --delete --exclude='etc' --exclude='var' "$dirname/warden-client" $prefix 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if rsync -q --recursive --archive --delete --exclude='etc' --exclude='var' "$dirname/warden-client" $prefix 2> $err; then echo "OK" else err_clean @@ -270,8 +265,7 @@ $ssl_ca_file change_permissions() { echo -n "Changing permissions to updated package ... " - chown -R $user: $client_path 2>$err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if chown -R $user: $client_path 2>$err; then echo "OK" else err_clean diff --git a/src/warden-server/sh/uninstall.sh b/src/warden-server/sh/uninstall.sh index ec773f10a9c419d16b13c234310ccf32ffd54a66..b6f9ab6a433743732e5b81e1bea4de4548faa23b 100755 --- a/src/warden-server/sh/uninstall.sh +++ b/src/warden-server/sh/uninstall.sh @@ -148,11 +148,8 @@ warden_dir_chck() stop_warden_server() { - $init stop - ret_val=`$init status | grep NOT; echo $?` - if [$ret_val -ne 0]; then - $init force-stop - fi + echo "Stopping warden server ... " + $init stop || $init force-stop } @@ -160,8 +157,7 @@ backup() { echo -n "Backing-up warden server directory ... " mkdir $backup_dir - cp -R $server_path $backup_dir 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if cp -R $server_path $backup_dir 2> $err; then echo "OK" else err @@ -172,8 +168,7 @@ backup() uninstall_warden_server() { echo -n "Uninstalling $package_version package ... " - rm -rf $server_path 2> $err; ret_val=`echo $?` - if [ $ret_val -eq 0 ]; then + if rm -rf $server_path 2> $err; then echo "OK" else err_clean