aboutsummaryrefslogtreecommitdiffstats
path: root/extras/setup.sh
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2013-08-19 19:35:29 +0200
committerMatteo Pasotti <matteo.pasotti@gmail.com>2013-08-19 19:35:29 +0200
commitbe23724d1985282db89e5b5851a14dffc3f12991 (patch)
tree48833f0a9891927e2960e172f642e12bd222546b /extras/setup.sh
parent7aec6e695c0f89da98bdbd8acb2abcc2b0922097 (diff)
downloadmanatools-be23724d1985282db89e5b5851a14dffc3f12991.tar
manatools-be23724d1985282db89e5b5851a14dffc3f12991.tar.gz
manatools-be23724d1985282db89e5b5851a14dffc3f12991.tar.bz2
manatools-be23724d1985282db89e5b5851a14dffc3f12991.tar.xz
manatools-be23724d1985282db89e5b5851a14dffc3f12991.zip
SILENT: move create_link.sh to setup.sh
Diffstat (limited to 'extras/setup.sh')
-rwxr-xr-xextras/setup.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/extras/setup.sh b/extras/setup.sh
new file mode 100755
index 00000000..0e6a51e3
--- /dev/null
+++ b/extras/setup.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# vim: set et ts=4 sw=4:
+
+apanel=`rpm --eval %perl_privlib`/AdminPanel
+
+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
+