From 310aec03a32c3755136d0405a300cda1948b97e1 Mon Sep 17 00:00:00 2001 From: Grzegorz Surmann Date: Mon, 29 Jul 2024 18:25:35 +0200 Subject: [PATCH] better changes --- bin/install.sh | 20 +++++++++++++++----- bin/update.sh | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 902ec09..0645e04 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -36,10 +36,6 @@ export DEBIAN_FRONTEND 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 () { systemctl restart bgpblacklist.service } @@ -57,7 +53,9 @@ function sd_copyunit () { } 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 fi } @@ -70,8 +68,20 @@ function git_clone () { 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" +if [ -s ${MYPATH}/etc/config.ini ]; then + echo "ERROR: dir not empty so probably already installed" + exit 1 +fi mkdir -p ${MYPATH} +git_clone bl_copy_conf sd_copyunit sd_d_reload diff --git a/bin/update.sh b/bin/update.sh index 1a56a9e..0e02df9 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export PATH @@ -16,7 +16,7 @@ if [ ${MYUSER} != "root" ]; then exit 1 fi -function sd_restart () { +function sd_restart { systemctl restart bgpblacklist.service }