mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
Merge pull request #11103 from fzakaria/issue-10795
lint: fix shellcheck for misc/systemv/nix-daemon
This commit is contained in:
commit
6867cb1096
3 changed files with 13 additions and 6 deletions
|
@ -324,6 +324,7 @@
|
||||||
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
|
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
|
||||||
++ [
|
++ [
|
||||||
pkgs.buildPackages.cmake
|
pkgs.buildPackages.cmake
|
||||||
|
pkgs.shellcheck
|
||||||
modular.pre-commit.settings.package
|
modular.pre-commit.settings.package
|
||||||
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
||||||
modular.pre-commit.settings.installationScript)
|
modular.pre-commit.settings.installationScript)
|
||||||
|
|
|
@ -495,7 +495,6 @@
|
||||||
excludes = [
|
excludes = [
|
||||||
# We haven't linted these files yet
|
# We haven't linted these files yet
|
||||||
''^config/install-sh$''
|
''^config/install-sh$''
|
||||||
''^misc/systemv/nix-daemon$''
|
|
||||||
''^misc/bash/completion\.sh$''
|
''^misc/bash/completion\.sh$''
|
||||||
''^misc/fish/completion\.fish$''
|
''^misc/fish/completion\.fish$''
|
||||||
''^misc/zsh/completion\.zsh$''
|
''^misc/zsh/completion\.zsh$''
|
||||||
|
|
|
@ -34,6 +34,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Source function library.
|
# Source function library.
|
||||||
|
# shellcheck source=/dev/null
|
||||||
. /etc/init.d/functions
|
. /etc/init.d/functions
|
||||||
|
|
||||||
LOCKFILE=/var/lock/subsys/nix-daemon
|
LOCKFILE=/var/lock/subsys/nix-daemon
|
||||||
|
@ -41,14 +42,20 @@ RUNDIR=/var/run/nix
|
||||||
PIDFILE=${RUNDIR}/nix-daemon.pid
|
PIDFILE=${RUNDIR}/nix-daemon.pid
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
base=${0##*/}
|
# https://www.shellcheck.net/wiki/SC3004
|
||||||
|
# Check if gettext exists
|
||||||
|
if ! type gettext > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
# If not, create a dummy function that returns the input verbatim
|
||||||
|
gettext() { printf '%s' "$1"; }
|
||||||
|
fi
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
|
||||||
mkdir -p ${RUNDIR}
|
mkdir -p ${RUNDIR}
|
||||||
chown ${NIX_DAEMON_USER}:${NIX_DAEMON_USER} ${RUNDIR}
|
chown ${NIX_DAEMON_USER}:${NIX_DAEMON_USER} ${RUNDIR}
|
||||||
|
|
||||||
echo -n $"Starting nix daemon... "
|
printf '%s' "$(gettext 'Starting nix daemon... ')"
|
||||||
|
|
||||||
daemonize -u $NIX_DAEMON_USER -p ${PIDFILE} $NIX_DAEMON_BIN $NIX_DAEMON_OPTS
|
daemonize -u $NIX_DAEMON_USER -p ${PIDFILE} $NIX_DAEMON_BIN $NIX_DAEMON_OPTS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
@ -58,7 +65,7 @@ start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n $"Shutting down nix daemon: "
|
printf '%s' "$(gettext 'Shutting down nix daemon: ')"
|
||||||
killproc -p ${PIDFILE} $NIX_DAEMON_BIN
|
killproc -p ${PIDFILE} $NIX_DAEMON_BIN
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
|
[ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
|
||||||
|
@ -67,7 +74,7 @@ stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
echo -n $"Reloading nix daemon... "
|
printf '%s' "$(gettext 'Reloading nix daemon... ')"
|
||||||
killproc -p ${PIDFILE} $NIX_DAEMON_BIN -HUP
|
killproc -p ${PIDFILE} $NIX_DAEMON_BIN -HUP
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
|
@ -105,7 +112,7 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
|
printf '%s' "$(gettext "Usage: $0 {start|stop|status|restart|condrestart}")"
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue