File: runit-services.postinst

package info (click to toggle)
runit-services 0.10.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 404 kB
  • sloc: sh: 477; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 2,214 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
set -e

deploy_rsyslog_logrotate () {
	#see #1092031, #1079268, #1031399 and #1079270
	if [ -e /usr/sbin/rsyslogd ] && [ ! -f /etc/logrotate.d/aa-rsyslog-runit ]; then
		if [ -f /etc/logrotate.d/aa-rsyslog-runit.disabled ]; then
			mv -f /etc/logrotate.d/aa-rsyslog-runit.disabled /etc/logrotate.d/aa-rsyslog-runit
		else
			cp /usr/share/runit-services/logrotate.d/aa-rsyslog-runit   /etc/logrotate.d/
		fi
	fi
	if [ ! -e /usr/sbin/rsyslogd ] && [ -f /etc/logrotate.d/aa-rsyslog-runit ]; then
		mv -f /etc/logrotate.d/aa-rsyslog-runit  /etc/logrotate.d/aa-rsyslog-runit.disabled
	fi
}

case "$1" in
    configure)
	#bookworm-trixie upgrade cleanup: REMOVE after trixie +1
	if dpkg --compare-versions "$2" le-nl "0.8.1"; then
		#fix elogind in /etc/sv/, see #1095025, this requires a NEWS
		if [ -f /etc/sv/elogind/.meta/bin ]; then
			echo "/usr/libexec/elogind" > /etc/sv/elogind/.meta/bin
		fi
		if [ -f /etc/sv/elogind/run ]; then
			if [ -f /usr/share/runit/sv/elogind/run ]; then
				mv /etc/sv/elogind/run /etc/sv/elogind/run.pkgbk
				cp /usr/share/runit/sv/elogind/run /etc/sv/elogind/
			fi
		fi
		#metafiles cleanup; defaults are now implicit, so we can remove files with default content
		for path in  /usr/share/runit/sv.now/* ; do
			rm -f "$path"/.meta/noscripts # no longer used
			rm -f "$path"/.meta/logscript # no longer used
			if [ -r "$path"/.meta/enable ]; then
				isenable=$(cat "$path"/.meta/enable)
				[ "$isenable" = 'yes' ] && rm -f "$path"/.meta/enable # enable=yes is default
			fi
			if [ -r "$path"/.meta/onupgrade ]; then
				isupgrade=$(cat "$path"/.meta/onupgrade)
				[ "$isupgrade" = 'restart' ] && rm -f "$path"/.meta/onupgrade # onupgrade=restart is default
			fi
		done
	fi
	#END: bookwarm-trixie upgrade cleanup
	if [ ! -d /etc/runit/override-sysv.d ]; then
		mkdir -p /etc/runit/override-sysv.d #to be removed after runit-2.1.2-61 reaches oldstable
	fi
	deploy_rsyslog_logrotate
	if [ -z "${DPKG_ROOT:-}" ] ; then
		echo "sync runit services.."
		# this will copy and enable appropriate services
		/lib/runit/trigger_sv setup
		/lib/runit/trigger_sv upgrade
		echo ".. done"
	fi
    ;;
    triggered)
	deploy_rsyslog_logrotate
    ;;
esac

#DEBHELPER#

exit 0