Added support for sysV systems, like debian 7

This commit is contained in:
Kirill Zaitsev
2014-11-02 16:35:22 +03:00
parent b44ca14fb7
commit 000387d10b
4 changed files with 111 additions and 3 deletions

View File

@@ -42,6 +42,26 @@ upstart() {
fi
}
sysv() {
if [ -d /etc/init.d ]; then
echo "Your system $(dist) $(version): using SysV to control Drone"
if [ -f /usr/local/bin/droned ] && [ -f /etc/init.d/drone ]; then
if pidof /usr/local/bin/droned >/dev/null; then
/etc/init.d/drone stop
fi
fi
cp -r /usr/share/drone/init.d/drone /etc/init.d/drone
chmod 0755 /etc/init.d/drone
update-rc.d drone defaults
exec /etc/init.d/drone start || :
else
echo "Couldn't find SysV to control Drone, cannot proceed."
echo "Open an issue and tell us about your system."
exit 1
fi
}
systemd() {
if which systemctl > /dev/null; then
cp /usr/share/drone/systemd/drone.service /lib/systemd/system/drone.service
@@ -62,7 +82,7 @@ systemd() {
case "$(dist)" in
debian)
if [ "$(version)" -lt "8" ]; then
upstart
sysv
else
systemd $1
fi

View File

@@ -18,6 +18,11 @@ systemd() {
rm -f /lib/systemd/system/drone.service
}
sysv() {
update-rc.d -f drone remove
rm -f /etc/init.d/drone
}
validate_ver() {
echo "$(version) < $1" | bc
}
@@ -25,7 +30,7 @@ validate_ver() {
case "$(dist)" in
debian)
if [ "$(version)" -lt "8" ]; then
upstart
sysv
else
systemd
fi

View File

@@ -22,6 +22,14 @@ systemd() {
fi
}
sysv() {
if [ -f /etc/init.d/drone ] ; then
if pidof /usr/local/bin/droned >/dev/null; then
exec /etc/init.d/drone stop || :
fi
fi
}
validate_ver() {
echo "$(version) < $1" | bc
}
@@ -29,7 +37,7 @@ validate_ver() {
case "$(dist)" in
debian)
if [ "$(version)" -lt "8" ]; then
upstart
sysv
else
systemd $1
fi