summaryrefslogtreecommitdiffstats
path: root/resources/config/1/uniontmp/etc/init.inactive/screen-cleanup.conf
blob: 167be0e0b7a7bcfbf3e6c7c971fbe4beb3be16c2 (plain) (blame)
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
# screen

description "GNU Screen Cleanup"
author "Dustin Kirkland <kirkland@canonical.com>"

start on filesystem

task

script
	SCREENDIR=/var/run/screen
	if [ -L $SCREENDIR ] || [ ! -d $SCREENDIR ]; then
		rm -f $SCREENDIR
		mkdir $SCREENDIR
		chown root:utmp $SCREENDIR
	fi
	find $SCREENDIR -type p -delete
	# If the local admin has used dpkg-statoverride to install the screen
	# binary with different set[ug]id bits, change the permissions of
	# $SCREENDIR accordingly
	BINARYPERM=`stat -c%a /usr/bin/screen`
	if [ "$BINARYPERM" -ge 4000 ]; then
		chmod 0755 $SCREENDIR
	elif [ "$BINARYPERM" -ge 2000 ]; then
		chmod 0775 $SCREENDIR
	else
		chmod 0777 $SCREENDIR
	fi
end script