mirror of
https://git.busybox.net/buildroot.git
synced 2024-12-02 18:03:39 +08:00
package/mender/S42mender: fix check-pkg and shellcheck warnings
Copy the basic syntax of package/polkit/S50polkit and change the following: - Add DAEMON, DAEMON_PATH, PIDFILE and DAEMON_ARGS variables. - Fix shellcheck warning SC2166 on line 16. - Fix shellcheck warning SC2181 on lines 29 and 34 by assigning the return code from the start-stop-daemon binary to a variable, and then check the value of the variable. Signed-off-by: Adam Duskett <aduskett@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
f67720baa3
commit
0b350cf756
@ -2,6 +2,10 @@
|
||||
#
|
||||
# Starts mender service.
|
||||
#
|
||||
DAEMON="mender"
|
||||
DAEMON_PATH="/usr/bin/mender"
|
||||
PIDFILE="/var/run/${DAEMON}.pid"
|
||||
DAEMON_ARGS="-daemon"
|
||||
|
||||
start() {
|
||||
# If /var/lib/mender is a symlink to /var/run/mender, and
|
||||
@ -9,8 +13,7 @@ start() {
|
||||
# create the directory pointed to by the symlink.
|
||||
# - the filesystem is RW (i.e. we can rm the symlink),
|
||||
# replace the symlink with an actual directory
|
||||
if [ -L /var/lib/mender \
|
||||
-a "$(readlink /var/lib/mender)" = "/var/run/mender" ]
|
||||
if [ -L /var/lib/mender ] && [ "$(readlink /var/lib/mender)" = "/var/run/mender" ]
|
||||
then
|
||||
if rm -f /var/lib/mender >/dev/null 2>&1; then
|
||||
mkdir -p /var/lib/mender
|
||||
@ -23,15 +26,16 @@ start() {
|
||||
|
||||
printf "Starting mender service: "
|
||||
umask 077
|
||||
|
||||
start-stop-daemon -S -q -b -m -p /var/run/mender.pid \
|
||||
--exec /usr/bin/mender -- daemon
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${DAEMON_ARGS}
|
||||
status=$?
|
||||
[ "${status}" = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping mender service: "
|
||||
start-stop-daemon -K -q -p /var/run/mender.pid
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
start-stop-daemon -Kqp "$PIDFILE"
|
||||
status=$?
|
||||
[ "${status}" = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
restart() {
|
||||
stop
|
||||
@ -49,7 +53,7 @@ case "$1" in
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
echo "Usage: $0 {start|stop|reload|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user