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