diff options
author | Matteo Pasotti <matteo.pasotti@gmail.com> | 2013-08-19 17:05:16 +0200 |
---|---|---|
committer | Matteo Pasotti <matteo.pasotti@gmail.com> | 2013-08-19 17:05:16 +0200 |
commit | 9707241dcb48622a47a26f4cc222ca6dfa2a4842 (patch) | |
tree | 7774c6636b53f110f2e2ca3e687b062d4591f0da /extras | |
parent | 88808fa14a8696a8c7319de4ea0e86e038f94522 (diff) | |
download | colin-keep-9707241dcb48622a47a26f4cc222ca6dfa2a4842.tar colin-keep-9707241dcb48622a47a26f4cc222ca6dfa2a4842.tar.gz colin-keep-9707241dcb48622a47a26f4cc222ca6dfa2a4842.tar.bz2 colin-keep-9707241dcb48622a47a26f4cc222ca6dfa2a4842.tar.xz colin-keep-9707241dcb48622a47a26f4cc222ca6dfa2a4842.zip |
- improved installation/uninstallation script (for developers only)
- only root should be able to use this script
Diffstat (limited to 'extras')
-rwxr-xr-x | extras/create_link.sh | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/extras/create_link.sh b/extras/create_link.sh index 0c33258..cef8ad7 100755 --- a/extras/create_link.sh +++ b/extras/create_link.sh @@ -2,25 +2,60 @@ apanel=`rpm --eval %perl_privlib`/AdminPanel -if [ -L $apanel ] -then - rm $apanel -fi - -if [ -f /usr/share/polkit-1/actions/org.mageia.policykit.pkexec.adminpanel.policy ] -then - rm /usr/share/polkit-1/actions/org.mageia.policykit.pkexec.adminpanel.policy -fi - -if [ -f /usr/bin/apanel.pl ] -then - rm /usr/bin/apanel.pl -fi - -pushd . -cd .. -cp extras/org.mageia.policykit.pkexec.adminpanel.policy /usr/share/polkit-1/actions/ -ln -s $PWD/AdminPanel `rpm --eval %perl_privlib` -ln -s $PWD/apanel.pl /usr/bin -popd +function check_root_permissions +{ + if [[ $EUID -ne 0 ]]; then + echo "You must be root to run this script" 1>&2 + exit 1 + fi +} + +function uninstall +{ + echo "== Uninstalling AdminPanel..." + if [ -L $apanel ] + then + unlink $apanel + fi + + if [ -f /usr/share/polkit-1/actions/org.mageia.policykit.pkexec.adminpanel.policy ] + then + rm /usr/share/polkit-1/actions/org.mageia.policykit.pkexec.adminpanel.policy + fi + + if [ -f /usr/bin/apanel.pl ] + then + unlink /usr/bin/apanel.pl + fi + echo "== Removed" +} + +function setup { + echo "== Installing AdminPanel..." + pushd . + cd .. + cp extras/org.mageia.policykit.pkexec.adminpanel.policy /usr/share/polkit-1/actions/ + ln -s $PWD/AdminPanel `rpm --eval %perl_privlib` + ln -s $PWD/apanel.pl /usr/bin + popd + echo "== Done" +} + +function usage { + echo "Usage:" + echo "--remove uninstall AdminPanel references" + echo "--install install AdminPanel references" +} + +check_root_permissions + +while getopts "hri" OPTIONS +do + case $OPTIONS in + r ) uninstall ;; + i ) uninstall && setup ;; + h ) usage ;; + \? ) usage ;; + esac +done |