mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 16:01:54 -09:00
package/network-manager: rewrite init script
This brings the NetworkManager init script in line with the standard Buildroot init script pattern, including the script name. Reload using SIGHUP is also supported now, note that the NetworkManager documentation cautions that not all parameters can be changed at runtime (without a full restart). Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
134a9f2beb
commit
b0a0c25e62
@@ -1003,7 +1003,6 @@ package/netsurf/0002-do-not-cross-compile-nsgenbind.patch lib_patch.Upstream
|
||||
package/netsurf/0003-fix-compilation-without-curl.patch lib_patch.Upstream
|
||||
package/netsurf/0004-framebuffer-Fix-internal-font-generated-source-for-GCC-10.patch lib_patch.Upstream
|
||||
package/nettle/0001-disable-testsuite-examples.patch lib_patch.Upstream
|
||||
package/network-manager/S45network-manager Shellcheck lib_sysv.ConsecutiveEmptyLines lib_sysv.EmptyLastLine lib_sysv.Variables
|
||||
package/nfs-utils/S60nfs Shellcheck lib_sysv.ConsecutiveEmptyLines lib_sysv.Variables
|
||||
package/nginx-modsecurity/0001-config-use-pkg-config.patch lib_patch.Upstream
|
||||
package/nginx/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch lib_patch.Upstream
|
||||
|
||||
68
package/network-manager/S45NetworkManager
Normal file
68
package/network-manager/S45NetworkManager
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="NetworkManager"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
test -r "/etc/default/$DAEMON" && . "/etc/default/$DAEMON"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
[ ! -d "/var/run/$DAEMON" ] && install -d "/var/run/$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON" \
|
||||
-- --pid-file="$PIDFILE" $NETWORKMANAGER_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
# NetworkManager deletes its PID file on exit, wait for it to
|
||||
# be gone
|
||||
while [ -f "$PIDFILE" ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
printf 'Reloading %s config: ' "$DAEMON"
|
||||
start-stop-daemon --stop --signal HUP -q --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart|reload)
|
||||
"$1";;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Allow a few customizations from a config file
|
||||
test -r /etc/default/NetworkManager && . /etc/default/NetworkManager
|
||||
|
||||
PID=`pidof NetworkManager`
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Starting NetworkManager ... "
|
||||
[ ! -d /var/run/NetworkManager ] && install -d /var/run/NetworkManager
|
||||
if [ -z "$PID" ]; then
|
||||
/usr/sbin/NetworkManager $NETWORKMANAGER_ARGS
|
||||
fi
|
||||
if [ ! -z "$PID" -o $? -gt 0 ]; then
|
||||
echo "failed!"
|
||||
else
|
||||
echo "done."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping NetworkManager ... "
|
||||
[ ! -z "$PID" ] && kill $PID > /dev/null 2>&1
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "failed!"
|
||||
else
|
||||
echo "done."
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart|sleep|wake}"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ NETWORK_MANAGER_CONF_OPTS += -Dnmcli=false
|
||||
endif
|
||||
|
||||
define NETWORK_MANAGER_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -m 0755 -D package/network-manager/S45network-manager $(TARGET_DIR)/etc/init.d/S45network-manager
|
||||
$(INSTALL) -m 0755 -D package/network-manager/S45NetworkManager $(TARGET_DIR)/etc/init.d/S45NetworkManager
|
||||
endef
|
||||
|
||||
define NETWORK_MANAGER_INSTALL_INIT_SYSTEMD
|
||||
|
||||
Reference in New Issue
Block a user