AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.223
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /lib/runit-helper/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //lib/runit-helper/runit-helper
#!/bin/sh
# Copyright (C) 2017 Dmitry Bogatov <KAction@gnu.org>

# Author: Dmitry Bogatov <KAction@gnu.org>

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set -e

postinst () {
    local action="${1}" previous="${2:-}"

    # Fresh installation (not upgrade). It is important to not override
    # local admin decision (see #899242).
    if [ "${ENABLE}" = yes ] && [ -z "${previous}" ] ; then
        ln -sf "/etc/sv/$NAME" "/etc/runit/runsvdir/default/$NAME"
    fi
}

postrm () {
	local action="${1}"

	if [ "${action}" != 'purge' ] && [ "${action}" != 'remove' ] ; then
	    return
	fi

	# Links in other runsvdirs is responsibility of administrator.
	rm -f "/etc/runit/runsvdir/default/$NAME"

	# If runscript was never invoked, there will be no files
	# in this directory, and `dpkg' will remove it. In this case,
	# we have nothing to do.
	for supervise in "/var/lib/runit/supervise/$NAME" \
	                 "/var/lib/runit/log/supervise/$NAME" ; do
		if [ -d "$supervise" ] ; then

			# Actually only `down' may be absent, but it does not
			# matter.

			for file in control lock ok pid stat status down ; do
				rm -f "$supervise/$file"
			done

			# It should be empty now. If it is not, it means that
			# system administrator put something there. It is very
			# stupid, but will of user is sacred, and directory is
			# left as-is in such case.
			#
			# NOTE: Non-POSIX option is used. The day coreutils will
			# no longer be essential, it will require a fix.
			rmdir --ignore-fail-on-non-empty "$supervise"
		fi
	done
}

"$@"
# vim: sw=4:et

AnonSec - 2021