From c252ed0c2879041ffc33360ef55571fdefbabb4e Mon Sep 17 00:00:00 2001 From: q3aql Date: Thu, 28 Mar 2024 12:49:09 +0100 Subject: [PATCH] Installer & Unninstaller --- install.sh | 35 +++++++++++++++++++++++++++++++++++ unninstall.sh | 23 +++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100755 install.sh create mode 100755 unninstall.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6153e2a --- /dev/null +++ b/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Check if process have root permissions +mkdir -p /etc/root &> /dev/null +administrador=$? +if [ ${administrador} -eq 0 ] ; then + rm -rf /etc/root +else + echo "blockauth: root permissions are required" + exit +fi +echo "" +echo "blockauth: installation" +echo "" +echo "blockauth: installing file /usr/bin/blockauth" +cp -rf blockauth /usr/bin +chmod +x /usr/bin/blockauth +echo "blockauth: installing file /etc/systemd/system/blockauth.service" +cp -rf systemd/blockauth.service /etc/systemd/system/blockauth.service +if [ -f /etc/blockauth/blockauth.conf ] ; then + echo "blockauth: preserving existing file /etc/blockauth/blockauth.conf" +else + echo "blockauth: installing file /etc/blockauth/blockauth.conf" + mkdir -p /etc/blockauth + cp -rfv config/blockauth.conf /etc/blockauth/blockauth.conf +fi +echo "blockauth: reloading systemd" +systemctl daemon-reload +echo "blockauth: finished" +echo "" +echo "Note: First configure the file /etc/blockauth/blockauth.conf" +echo "Note: After, run service:" +echo " systemctl enable blockauth.service" +echo " systemctl start blockauth.service" +echo "" diff --git a/unninstall.sh b/unninstall.sh new file mode 100755 index 0000000..5370d27 --- /dev/null +++ b/unninstall.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Check if process have root permissions +mkdir -p /etc/root &> /dev/null +administrador=$? +if [ ${administrador} -eq 0 ] ; then + rm -rf /etc/root +else + echo "blockauth: root permissions are required" + exit +fi +echo "" +echo "blockauth: unninstallation" +echo "" +echo "blockauth: removing file /usr/bin/blockauth" +rm -rf /usr/bin/blockauth +echo "blockauth: removing file /etc/systemd/system/blockauth.service" +rm -rf /etc/systemd/system/blockauth.service +echo "blockauth: removing configuration folder /etc/blockauth" +rm -rf /etc/blockauth +echo "blockauth: reloading systemd" +systemctl daemon-reload +echo "blockauth: finished"