Skip to content
Snippets Groups Projects
Commit 6c7b2f54 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

vytvoreni funkci; uprava nazvu promennych

parent 5af60377
No related branches found
No related tags found
No related merge requests found
......@@ -143,8 +143,8 @@ params_chck()
old_client_chck()
{
old_package_version="$etc/package_version.txt"
if [ -f $old_package_version ]; then
old_package_version_file="$etc/package_version.txt"
if [ -f $old_package_version_file ]; then
echo "Sorry, but $old_package_version package is installed!"
echo "For update of warden client package please use update.sh script."
exit 1
......
......@@ -63,8 +63,7 @@ err()
{
echo "FAILED!"
cat $err
rm -rf $err
rm -rf $backup_dir
rm -rf $err $backup_dir
echo
echo "Uninstallation of $package_version package FAILED!!!"
exit 1
......@@ -78,8 +77,7 @@ err_clean()
rm -rf "$client_path/*" > /dev/null 2>&1
cp -R "$backup_dir/*" $client_path
cat $err
rm -rf $err
rm -rf $backup_dir
rm -rf $err $backup_dir
echo
echo "Uninstallation of $package_version package FAILED!!!"
exit 1
......@@ -124,6 +122,16 @@ params_chck()
}
obtain_package_version()
{
if [ -f $old_package_version_file ]; then
package_version=`cat $old_package_version_file`
else
package_version="unknown"
fi
}
uninstallation_dir_chck()
{
echo -n "Checking uninstallation directory ... "
......@@ -160,7 +168,7 @@ backup()
fi
}
uninstall_warden-client()
uninstall_warden_client()
{
echo -n "Uninstalling $package_version package ... "
rm -rf $client_path 2> $err; ret_val=`echo $?`
......@@ -200,16 +208,12 @@ params_chck
# create variables
client_path="$prefix/warden-client"
etc="$client_path/etc"
old_package_version_file="$etc/package_version.txt"
err="/tmp/warden-err"
backup_dir="/tmp/warden-backup"
# obtain version of installed warden-client package
old_package_version="$etc/package_verion.txt"
if [ -f $old_package_version ]; then
package_version=`cat $etc/package_version.txt`
else
package_version="unknown"
fi
obtain_package_version
echo
echo "------------------------- Uninstallation process --------------------------------"
......@@ -224,13 +228,12 @@ warden_dir_chck
backup
# do uninstallation
uninstall_warden-client
uninstall_warden_client
echo
echo "Uninstallation of $package_version package was SUCCESSFUL!!!"
# cleanup section
rm -rf $err
rm -rf $backup_dir
rm -rf $err $backup_dir
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment