refactor install.sh
This commit is contained in:
51
install.sh
51
install.sh
@@ -1,12 +1,51 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -eux
|
install_prerequisite_software ()
|
||||||
cd ${LIB_DIR:-/lib}
|
{
|
||||||
sudo git clone https://git.joeac.net/joeac/joeac.net.git
|
if [ -n "$(which git)" ]
|
||||||
cd joeac.net
|
then
|
||||||
sudo chmod +x uninstall.sh update_and_restart.sh restart.sh
|
echo "Git is already installed."
|
||||||
sudo echo << EOF >> ${CRONTABS_DIR:-/etc/cron.d}/joeacnet
|
elif [ -n "$(which apk)" ]
|
||||||
|
then
|
||||||
|
apk update
|
||||||
|
apk add git
|
||||||
|
elif [ -n "$(which apt-get)" ]
|
||||||
|
then
|
||||||
|
apt-get update
|
||||||
|
apt-get install git
|
||||||
|
elif [ -n "$(which dnf)" ]
|
||||||
|
then
|
||||||
|
dnf install git
|
||||||
|
elif [ -n "$(which yum)" ]
|
||||||
|
then
|
||||||
|
yum install git
|
||||||
|
elif [ -n "$(which pacman)" ]
|
||||||
|
then
|
||||||
|
pacman -S git
|
||||||
|
else
|
||||||
|
echo "Could not install Git: could not identify package manager."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
clone_repository ()
|
||||||
|
{
|
||||||
|
cd ${LIB_DIR:-/lib}
|
||||||
|
git clone https://git.joeac.net/joeac/joeac.net.git
|
||||||
|
cd joeac.net
|
||||||
|
chmod +x uninstall.sh update_and_restart.sh restart.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
add_cron_services ()
|
||||||
|
{
|
||||||
|
echo <<- EOF > ${CRONTABS_DIR:-/etc/cron.d}/joeacnet
|
||||||
@reboot ${LIB_DIR:-/lib}/joeac.net/restart.sh
|
@reboot ${LIB_DIR:-/lib}/joeac.net/restart.sh
|
||||||
10 * * * * ${LIB_DIR:-/lib}/joeac.net/update_and_restart.sh
|
10 * * * * ${LIB_DIR:-/lib}/joeac.net/update_and_restart.sh
|
||||||
EOF
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
install_prerequisite_software
|
||||||
|
clone_repository
|
||||||
|
add_cron_services
|
||||||
./restart.sh
|
./restart.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user