HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //var/lib/dpkg/info/runit.preinst
#!/bin/sh
set -eu

servlink=$(readlink -f /etc/service)

# We are at pre-inst, this directory may not exist yet. See #927442.
mkdir -p /etc/runit/runsvdir
if [ ! -e /etc/runit/runsvdir/current ]; then
	#rm any broken/old symlink, just to be sure
	rm -f /etc/runit/runsvdir/current
	echo 'runit: setting up for runsvchdir'
	#now current symlink does not exists, we can safely create it
	ln -s /etc/runit/runsvdir/default /etc/runit/runsvdir/current
	echo 'runit: current symlink succesfully created'
fi

if [ "$servlink" = '/etc/runit/runsvdir/default' ]; then
	# we are running in the default rundir, proceed with the switch
	# note that ln is not safe to use here as it does an unlink before
	# creating the new link; using mv instead
	printf "runit: switching /etc/service to current... "
	ln -s /etc/runit/runsvdir/current /etc/service-new
	mv -T /etc/service-new /etc/service
	printf "done\n"
fi