better changes

This commit is contained in:
Grzegorz Surmann 2024-07-29 18:25:35 +02:00
parent 54fcbd4463
commit 310aec03a3
2 changed files with 17 additions and 7 deletions

View File

@ -36,10 +36,6 @@ export DEBIAN_FRONTEND
trap "dpkg --configure -a" 1 2 3 9 11 15 trap "dpkg --configure -a" 1 2 3 9 11 15
echo "## installing tools"
ls -al ${MYPATH} >/dev/null && exit 1
apt-get -q -y install git iproute2 php-cli wget curl | grep -v -e "is already the newest version"
function sd_restart () { function sd_restart () {
systemctl restart bgpblacklist.service systemctl restart bgpblacklist.service
} }
@ -57,7 +53,9 @@ function sd_copyunit () {
} }
function bl_copy_conf () { function bl_copy_conf () {
if [ ! -s ${MYPATH}/etc/config.ini ]; then if [ -s ${MYPATH}/etc/config.ini ]; then
echo "INFO: config file exists, not overwriting"
else
cp ${MYPATH}/etc/default/config.ini ${MYPATH}/etc/config.ini cp ${MYPATH}/etc/default/config.ini ${MYPATH}/etc/config.ini
fi fi
} }
@ -70,8 +68,20 @@ function git_clone () {
fi fi
} }
echo "## installing tools"
if [ -s ${MYPATH}/etc/config.ini ]; then
echo "ERROR: dir not empty so probably already installed"
exit 1
fi
apt-get -q -y install git iproute2 php-cli wget curl | grep -v -e "is already the newest version"
echo "## installing service" echo "## installing service"
if [ -s ${MYPATH}/etc/config.ini ]; then
echo "ERROR: dir not empty so probably already installed"
exit 1
fi
mkdir -p ${MYPATH} mkdir -p ${MYPATH}
git_clone
bl_copy_conf bl_copy_conf
sd_copyunit sd_copyunit
sd_d_reload sd_d_reload

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH export PATH
@ -16,7 +16,7 @@ if [ ${MYUSER} != "root" ]; then
exit 1 exit 1
fi fi
function sd_restart () { function sd_restart {
systemctl restart bgpblacklist.service systemctl restart bgpblacklist.service
} }