kumquat-buildroot/package/mender/S42mender
Romain Naour 20c9e5cfd4 package/mender: remove single hyphen command (2)
Single hyphen commands has been removed since Mender 3.0.0 [1]

The hyphen was added back while fixing check-pkg and shellcheck warnings [2]

[1] fd838ec1b0
[2] 0b350cf756

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-07-24 12:28:26 +02:00

61 lines
1.3 KiB
Bash

#!/bin/sh
#
# 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
# - the filesystem is RO (i.e. we can not rm the symlink),
# 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 ] && [ "$(readlink /var/lib/mender)" = "/var/run/mender" ]
then
if rm -f /var/lib/mender >/dev/null 2>&1; then
mkdir -p /var/lib/mender
else
echo "No persistent location to store mender data. Data will be lost"
echo "at reboot. Are you sure this is what you want to do?"
mkdir -p "$(readlink /var/lib/mender)"
fi
fi
printf "Starting mender service: "
umask 077
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 -Kqp "$PIDFILE"
status=$?
[ "${status}" = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
esac
exit $?