[Pkg-utopia-maintainers] Bug#989137: cockpit-ws: No sysvinit script

Simon Walter simon at explicit.technology
Wed May 26 14:52:25 BST 2021


Package: cockpit-ws
Version: 188-1
Severity: normal
Tags: patch

Dear Maintainer,

Here is a patch for a sysvinit script.

-- System Information:
Debian Release: 10.9
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-16-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit
LSM: AppArmor: enabled

Versions of packages cockpit-ws depends on:
ii  adduser             3.118
ii  glib-networking     2.58.0-2+deb10u2
ii  libc6               2.28-10
ii  libglib2.0-0        2.58.3-2+deb10u2
ii  libgssapi-krb5-2    1.17-3+deb10u1
ii  libjson-glib-1.0-0  1.4.4-2
ii  libkrb5-3           1.17-3+deb10u1
ii  libpam0g            1.3.1-5
ii  libsystemd0         241-7~deb10u7
ii  openssl             1.1.1d-0+deb10u6

cockpit-ws recommends no packages.

cockpit-ws suggests no packages.

-- no debconf information


#!/bin/sh
### BEGIN INIT INFO
# Provides:          cockpit
# Required-Start:    $local_fs $network $named $time $syslog
# Required-Stop:     $local_fs $network $named $time $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: cockpit management webserver
# Description:       cockpit management webserver
### END INIT INFO

cmd="/usr/sbin/remotectl certificate --ensure --user=root --group=cockpit-ws --selinux-type="
cmd1="/usr/lib/cockpit/cockpit-ws"
name=$(basename "$0")
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"

test -x "$cmd1" || exit 0

get_pid() {
    cat "$pid_file"
}

is_running() {
    [ -f "$pid_file" ] && ps -p "$(get_pid)" > /dev/null 2>&1
}

case "$1" in
    start) if is_running; then
               echo "Already started"
           else
               echo "Starting $name"
               $cmd >> "$stdout_log" 2>> "$stderr_log"
               $cmd1 >> "$stdout_log" 2>> "$stderr_log" &
               echo $! > "$pid_file"
               if ! is_running; then
                   echo "Unable to start, see $stdout_log and $stderr_log"
                   exit 1
               fi
           fi
           ;;
     stop) if is_running; then
               echo "Stopping $name.."
               kill "$(get_pid)"
               i=0
               while [ "$i" -lt 10 ]
               do
                   if ! is_running; then
                       break
                   fi
                   echo "."
                   sleep 1
                   i=$((i+1))
               done
               echo
               if is_running; then
                   echo "Not stopped; may still be shutting down or shutdown may have failed"
                   exit 1
               else
                   echo "Stopped"
                   if [ -f "$pid_file" ]; then
                       rm "$pid_file"
                   fi
               fi
           else
               echo "Not running"
           fi
           ;;
  restart) $0 stop
           if is_running; then
               echo "Unable to stop, will not attempt to start"
               exit 1
           fi
           $0 start
           ;;
   status) if is_running; then
               echo "Running"
           else
               echo "Stopped"
               exit 1
           fi
           ;;
        *) echo "Usage: $0 {start|stop|restart|status}"
           exit 1
           ;;
esac

exit 0



More information about the Pkg-utopia-maintainers mailing list