Installer & Unninstaller

This commit is contained in:
q3aql 2024-03-28 12:49:09 +01:00
parent 8c3642adcd
commit c252ed0c28
2 changed files with 58 additions and 0 deletions

35
install.sh Executable file
View File

@ -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 ""

23
unninstall.sh Executable file
View File

@ -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"