Merge pull request #564 from Bugagazavr/packages-fix

Fix packages install without bc
This commit is contained in:
Brad Rydzewski 2014-10-14 08:01:56 -07:00
commit 7790253772
3 changed files with 14 additions and 22 deletions

View file

@ -21,18 +21,18 @@ dist() {
} }
version() { version() {
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' | awk -F. '{ print $1 }'
} }
upstart() { upstart() {
if [ -d /etc/init ]; then if [ -d /etc/init ]; then
echo "Your system $(dist) $(version): using upstart to control Drone"
if [ -f /usr/local/bin/droned ]; then if [ -f /usr/local/bin/droned ]; then
if pidof /usr/local/bin/droned >/dev/null; then if pidof /usr/local/bin/droned >/dev/null; then
initctl stop drone || : initctl stop drone || :
fi fi
fi fi
echo "You have $(dist) $(version): using upstart to control Drone"
cp -r /usr/share/drone/init/drone.conf /etc/init/drone.conf cp -r /usr/share/drone/init/drone.conf /etc/init/drone.conf
initctl start drone || : initctl start drone || :
else else
@ -44,17 +44,13 @@ upstart() {
systemd() { systemd() {
if which systemctl > /dev/null; then if which systemctl > /dev/null; then
echo "Your system $(dist) $(version): using systemd to control Drone"
cp /usr/share/drone/systemd/drone.service /lib/systemd/system/drone.service cp /usr/share/drone/systemd/drone.service /lib/systemd/system/drone.service
systemctl daemon-reload || : systemctl daemon-reload || :
if [ "$1" = 1 ] ; then if [ "$1" = "configure" ] ; then
# first time install echo "Your system $(dist) $(version): using systemd to control Drone"
systemctl enable drone || : systemctl enable drone || :
systemctl start drone || : systemctl restart drone || :
else
echo "Upgrading drone"
systemctl restart drone
fi fi
else else
echo "Couldn't find systemd to control Drone, cannot proceed." echo "Couldn't find systemd to control Drone, cannot proceed."
@ -63,20 +59,16 @@ systemd() {
fi fi
} }
validate_ver() {
echo "$(version) < $1" | bc
}
case "$(dist)" in case "$(dist)" in
debian) debian)
if [ $(validate_ver "8.0") -eq 1 ]; then if [ "$(version)" -lt "8" ]; then
upstart upstart
else else
systemd $1 systemd $1
fi fi
;; ;;
ubuntu) ubuntu)
if [ $(validate_ver "14.10") -eq 1 ]; then if [ "$(version)" -lt "15" ]; then
upstart upstart
else else
systemd $1 systemd $1

View file

@ -7,7 +7,7 @@ dist() {
} }
version() { version() {
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' | awk -F. '{ print $1 }'
} }
upstart() { upstart() {
@ -24,14 +24,14 @@ validate_ver() {
case "$(dist)" in case "$(dist)" in
debian) debian)
if [ $(validate_ver "8.0") -eq 1 ]; then if [ "$(version)" -lt "8" ]; then
upstart upstart
else else
systemd systemd
fi fi
;; ;;
ubuntu) ubuntu)
if [ $(validate_ver "14.10") -eq 1 ]; then if [ "$(version)" -lt "15" ]; then
upstart upstart
else else
systemd systemd

View file

@ -6,7 +6,7 @@ dist() {
} }
version() { version() {
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' | awk -F. '{ print $1 }'
} }
echo Stopping drone echo Stopping drone
@ -16,7 +16,7 @@ upstart() {
} }
systemd() { systemd() {
if [ "$1" -eq 0 ] ; then if [ $1 = "remove" ] ; then
systemctl --no-reload disable drone || : systemctl --no-reload disable drone || :
systemctl stop drone || : systemctl stop drone || :
fi fi
@ -28,14 +28,14 @@ validate_ver() {
case "$(dist)" in case "$(dist)" in
debian) debian)
if [ $(validate_ver "8.0") -eq 1 ]; then if [ "$(version)" -lt "8" ]; then
upstart upstart
else else
systemd $1 systemd $1
fi fi
;; ;;
ubuntu) ubuntu)
if [ $(validate_ver "14.10") -eq 1 ]; then if [ "$(version)" -lt "15" ]; then
upstart upstart
else else
systemd $1 systemd $1