diff --git a/bin/install.sh b/bin/install.sh index d9f2257..761a0d5 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -2,3 +2,47 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export PATH + +LANG="en_US.UTF-8" +export LANG + +if [ -s "/etc/os-release" ]; then + . /etc/os-release + if [ ${ID} != "debian" -a ${ID} != "ubuntu" ]; then + echo "*** NOT DEBIAN OR UBUNTU ***" + echo "*** WILL NOT UPDATE ********" + exit 1 + fi +else + echo "*** UNKNOWN DISTRIBUTION ***" + echo "*** WILL NOT UPDATE ********" + exit 1 +fi + +MYUSER=$(whoami) +if [ ${MYUSER} != "root" ]; then + echo "*** USER IS NOT ROOT ***" + echo "*** WILL NOT UPDATE ****" + exit 1 +fi + +echo "*** START ***" + +DEBIAN_FRONTEND=noninteractive +export DEBIAN_FRONTEND + +trap "dpkg --configure -a" 1 2 3 9 11 15 + +echo "## installing tools" +apt-get -q -y install git iproute2 php-cli wget curl | grep -v -e "is already the newest version" + +echo "## installing service" +mkdir -p /opt/ +git clone https://git.funil.de/sinuspl/bgpblist /opt/bgpblist +cp /opt/bgpblist/etc/default/config.ini /opt/bgpblist/etc/config.ini +cp /opt/bgpblist/etc/systemd/bgpblacklist.service /etc/systemd/system/bgpblacklist.service +systemctl daemon-reload +systemctl enable bgpblacklist.service +systemctl start bgpblacklist.service + +echo "*** DONE ***"