From 4cbb4f74d7a31c48323a8c7ef799afacc64c1b7a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 7 Aug 2015 22:53:28 +0100 Subject: [PATCH] Detecting systemctl --- src/freedombone-client | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/freedombone-client b/src/freedombone-client index a72aa5cc..fb4dd4d5 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -101,19 +101,19 @@ function mesh_babel { echo ' echo "Interface $IFACE was not found"' >> $babel_script echo ' ifconfig $IFACE down' >> $babel_script echo ' pkill babeld' >> $babel_script - echo ' if [ -f /etc/init.d/networking ]; then' >> $babel_script - echo ' service networking restart' >> $babel_script - echo ' else' >> $babel_script - echo ' systemctl restart networking' >> $babel_script - echo ' fi' >> $babel_script + echo ' if [ -f /bin/systemctl ]; then' >> $batman_script + echo ' systemctl restart networking' >> $batman_script + echo ' else' >> $batman_script + echo ' service networking restart' >> $batman_script + echo ' fi' >> $batman_script echo ' exit 1' >> $babel_script echo 'fi' >> $babel_script echo '' >> $babel_script - echo 'if [ -f /etc/init.d/networking ]; then' >> $babel_script - echo ' service networking stop' >> $babel_script - echo 'else' >> $babel_script - echo ' systemctl stop networking' >> $babel_script - echo 'fi' >> $babel_script + echo 'if [ -f /bin/systemctl ]; then' >> $batman_script + echo ' systemctl stop networking' >> $batman_script + echo 'else' >> $batman_script + echo ' service networking stop' >> $batman_script + echo 'fi' >> $batman_script echo 'ifconfig $IFACE down' >> $babel_script echo -n 'iwconfig $IFACE mode ad-hoc channel ' >> $babel_script echo "$WIFI_CHANNEL essid \"$ESSID\"" >> $babel_script @@ -159,7 +159,12 @@ function mesh_batman { echo ' return' >> $batman_script echo ' fi' >> $batman_script echo ' echo "info: enabling batman-adv mesh network $ESSID on $IFACE"' >> $batman_script - echo ' systemctl stop networking' >> $batman_script + + echo ' if [ -f /bin/systemctl ]; then' >> $batman_script + echo ' systemctl stop networking' >> $batman_script + echo ' else' >> $batman_script + echo ' service networking stop' >> $batman_script + echo ' fi' >> $batman_script echo ' sleep 5' >> $batman_script echo '' >> $batman_script echo ' # Might have to re-enable wifi' >> $batman_script @@ -218,7 +223,11 @@ function mesh_batman { echo ' ifconfig $IFACE down' >> $batman_script echo ' iwconfig $IFACE mode managed' >> $batman_script echo '' >> $batman_script - echo ' systemctl restart networking' >> $batman_script + echo ' if [ -f /bin/systemctl ]; then' >> $batman_script + echo ' systemctl restart networking' >> $batman_script + echo ' else' >> $batman_script + echo ' service networking restart' >> $batman_script + echo ' fi' >> $batman_script echo '}' >> $batman_script echo '' >> $batman_script echo 'if [ ! $IFACE_EXISTS ]; then' >> $batman_script