summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/systemd/systemd-general/build-spec/debian
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
commit75808db17caf8b960b351e3408e74142f4c85aac (patch)
tree7989e9c09a4240248bf4658a22208a0a52d991c4 /t/recipes/checks/systemd/systemd-general/build-spec/debian
parentInitial commit. (diff)
downloadlintian-upstream.tar.xz
lintian-upstream.zip
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/recipes/checks/systemd/systemd-general/build-spec/debian')
-rwxr-xr-xt/recipes/checks/systemd/systemd-general/build-spec/debian/bootmisc.sh59
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/init153
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/install3
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/links1
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/postrm10
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/rules30
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.masked.init22
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.service9
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.sh.init22
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init152
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.test.service13
-rw-r--r--t/recipes/checks/systemd/systemd-general/build-spec/debian/test.conf2
12 files changed, 476 insertions, 0 deletions
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/bootmisc.sh b/t/recipes/checks/systemd/systemd-general/build-spec/debian/bootmisc.sh
new file mode 100755
index 0000000..5c73683
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/bootmisc.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: bootmisc
+# Required-Start: $remote_fs
+# Required-Stop:
+# Should-Start: udev
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Miscellaneous things to be done during bootup.
+# Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh.
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
+. /lib/init/vars.sh
+
+do_start () {
+ #
+ # If login delaying is enabled then create the flag file
+ # which prevents logins before startup is complete
+ #
+ case "$DELAYLOGIN" in
+ Y*|y*)
+ echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
+ ;;
+ esac
+
+ # Create /var/run/utmp so we can login.
+ : > /var/run/utmp
+ if grep -q ^utmp: /etc/group
+ then
+ chmod 664 /var/run/utmp
+ chgrp utmp /var/run/utmp
+ fi
+
+ # Remove bootclean's flag files.
+ # Don't run bootclean again after this!
+ rm -f /tmp/.clean /run/.clean /run/lock/.clean
+ rm -f /tmp/.tmpfs /run/.tmpfs /run/lock/.tmpfs
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop|status)
+ # No-op
+ ;;
+ *)
+ echo "Usage: bootmisc.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/init b/t/recipes/checks/systemd/systemd-general/build-spec/debian/init
new file mode 100644
index 0000000..96f6ed2
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/init
@@ -0,0 +1,153 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: systemd-general
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: S 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example Lintian initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d.
+### END INIT INFO
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Description of the service"
+NAME=daemonexecutablename
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS="--options args"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/install b/t/recipes/checks/systemd/systemd-general/build-spec/debian/install
new file mode 100644
index 0000000..eb4680b
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/install
@@ -0,0 +1,3 @@
+debian/systemd-general.test.service etc/systemd/system/
+debian/systemd-general.test.service usr/lib/systemd/system/
+debian/test.conf etc/tmpfiles.d/
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/links b/t/recipes/checks/systemd/systemd-general/build-spec/debian/links
new file mode 100644
index 0000000..c022cff
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/links
@@ -0,0 +1 @@
+/dev/null /lib/systemd/system/masked.service
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/postrm b/t/recipes/checks/systemd/systemd-general/build-spec/debian/postrm
new file mode 100644
index 0000000..6e5813a
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/postrm
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "purge" ] && which systemctl >/dev/null 2>&1; then
+ systemctl || true
+fi
+
+#DEBHELPER#
+
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/rules b/t/recipes/checks/systemd/systemd-general/build-spec/debian/rules
new file mode 100644
index 0000000..68b3e30
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/rules
@@ -0,0 +1,30 @@
+#!/usr/bin/make -f
+
+ETC_DIR=debian/$(shell dh_listpackages)/etc/
+INITD_DIR=$(ETC_DIR)/init.d
+SYSD_DIR=$(ETC_DIR)/systemd/system
+
+%:
+ dh $@
+
+override_dh_install:
+ dh_install
+ install -m 0755 -d $(INITD_DIR) $(SYSD_DIR)
+ mkfifo $(INITD_DIR)/fifo-pipe-as-init
+ mkfifo $(SYSD_DIR)/fifo-pipe-as-init.service
+ install -m 0755 debian/bootmisc.sh $(INITD_DIR)
+ install -m 0755 debian/systemd-general.masked.init $(INITD_DIR)/masked
+ touch $(INITD_DIR)/README
+
+override_dh_fixperms:
+ dh_fixperms
+ chmod -x $(INITD_DIR)/README
+
+override_dh_installinit:
+ dh_installinit
+ dh_installinit --name systemd-aliasd
+ dh_installinit --name sourced.sh
+
+override_dh_installsystemd:
+ dh_installsystemd
+ dh_installsystemd --name sourced
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.masked.init b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.masked.init
new file mode 100644
index 0000000..b884a82
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.masked.init
@@ -0,0 +1,22 @@
+#!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+ set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
+### BEGIN INIT INFO
+# Provides: masked
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example Lintian initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d. This example start a
+# single forking daemon capable of writing a pid
+# file. To get other behaviors, implement
+# do_start(), do_stop() or other functions to
+# override the defaults in /lib/init/init-d-script.
+### END INIT INFO
+
+DESC="Description of the service"
+DAEMON=/usr/sbin/daemonexecutablename
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.service b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.service
new file mode 100644
index 0000000..f3775af
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.service
@@ -0,0 +1,9 @@
+[Unit]
+After=network.target
+Documentation=man:sourced(1)
+
+[Service]
+ExecStart=/usr/bin/test
+
+[Install]
+WantedBy=sleep.target
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.sh.init b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.sh.init
new file mode 100644
index 0000000..6657c99
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.sourced.sh.init
@@ -0,0 +1,22 @@
+#!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+ set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
+### BEGIN INIT INFO
+# Provides: sourced
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example Lintian initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d. This example start a
+# single forking daemon capable of writing a pid
+# file. To get other behaviors, implement
+# do_start(), do_stop() or other functions to
+# override the defaults in /lib/init/init-d-script.
+### END INIT INFO
+
+DESC="Description of the service"
+DAEMON=/usr/sbin/daemonexecutablename
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init
new file mode 100644
index 0000000..95e791c
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init
@@ -0,0 +1,152 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: systemd-aliasd
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example Lintian initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d.
+### END INIT INFO
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Description of the service"
+NAME=daemonexecutablename
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS="--options args"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+. /lib/lsb/init-functionsh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.test.service b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.test.service
new file mode 100644
index 0000000..a456a3d
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/systemd-general.test.service
@@ -0,0 +1,13 @@
+[Unit]
+After=network.target \
+syslog.target
+BindTo=foo
+
+[Service]
+ExecStartPre = /bin/true
+ExecStart=/usr/bin/test
+
+[Install]
+WantedBy=multi-user.target unusual.target
+Alias=systemd-aliasd.service
+Alias=anothertest
diff --git a/t/recipes/checks/systemd/systemd-general/build-spec/debian/test.conf b/t/recipes/checks/systemd/systemd-general/build-spec/debian/test.conf
new file mode 100644
index 0000000..b0c4604
--- /dev/null
+++ b/t/recipes/checks/systemd/systemd-general/build-spec/debian/test.conf
@@ -0,0 +1,2 @@
+# See tmpfiles.d(5) for details
+d /var/run/bacula 2775 bacula bacula -