better versions
This commit is contained in:
parent
82c5c6aa76
commit
54fcbd4463
@ -6,6 +6,9 @@ export PATH
|
||||
LANG="en_US.UTF-8"
|
||||
export LANG
|
||||
|
||||
MYPATH="/opt/bgpblist"
|
||||
export MYPATH
|
||||
|
||||
if [ -s "/etc/os-release" ]; then
|
||||
. /etc/os-release
|
||||
if [ ${ID} != "debian" -a ${ID} != "ubuntu" ]; then
|
||||
@ -34,16 +37,45 @@ export DEBIAN_FRONTEND
|
||||
trap "dpkg --configure -a" 1 2 3 9 11 15
|
||||
|
||||
echo "## installing tools"
|
||||
ls -al /opt/bgpblist/ >/dev/null && exit 1
|
||||
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"
|
||||
|
||||
echo "## installing service"
|
||||
mkdir -p /opt/bgpblist/
|
||||
git clone https://git.funil.de/sinuspl/bgpblist /opt/bgpblist || exit 1
|
||||
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
|
||||
function sd_restart () {
|
||||
systemctl restart bgpblacklist.service
|
||||
}
|
||||
|
||||
function sd_enable () {
|
||||
systemctl enable bgpblacklist.service
|
||||
systemctl start bgpblacklist.service
|
||||
}
|
||||
|
||||
function sd_d_reload () {
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
function sd_copyunit () {
|
||||
cp ${MYPATH}/etc/systemd/bgpblacklist.service /etc/systemd/system/bgpblacklist.service
|
||||
}
|
||||
|
||||
function bl_copy_conf () {
|
||||
if [ ! -s ${MYPATH}/etc/config.ini ]; then
|
||||
cp ${MYPATH}/etc/default/config.ini ${MYPATH}/etc/config.ini
|
||||
fi
|
||||
}
|
||||
|
||||
function git_clone () {
|
||||
git clone https://git.funil.de/sinuspl/bgpblist ${MYPATH}
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "ERROR: could not clone"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "## installing service"
|
||||
mkdir -p ${MYPATH}
|
||||
bl_copy_conf
|
||||
sd_copyunit
|
||||
sd_d_reload
|
||||
sd_enable
|
||||
sd_restart
|
||||
|
||||
echo "*** DONE ***"
|
||||
|
@ -7,6 +7,7 @@ LANG="en_US.UTF-8"
|
||||
export LANG
|
||||
|
||||
MYPATH="/opt/bgpblist"
|
||||
export MYPATH
|
||||
|
||||
MYUSER=$(whoami)
|
||||
if [ ${MYUSER} != "root" ]; then
|
||||
@ -15,8 +16,20 @@ if [ ${MYUSER} != "root" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function sd_restart () {
|
||||
systemctl restart bgpblacklist.service
|
||||
}
|
||||
|
||||
function sd_d_reload () {
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
function sd_copyunit () {
|
||||
cp ${MYPATH}/etc/systemd/bgpblacklist.service /etc/systemd/system/bgpblacklist.service
|
||||
}
|
||||
|
||||
echo "*** START ***"
|
||||
cd ${MYPATH} 2>/dev/null \
|
||||
&& ( git pull; cp /opt/bgpblist/etc/systemd/bgpblacklist.service /etc/systemd/system/bgpblacklist.service; systemctl daemon-reload; systemctl restart bgpblacklist.service ) \
|
||||
&& ( git pull; sd_copyunit; sd_d_reload; sd_restart ) \
|
||||
|| ( echo "ERROR: could not change to dir" )
|
||||
echo "*** DONE ***"
|
||||
|
Loading…
Reference in New Issue
Block a user