File: postinst

package info (click to toggle)
xbanner 1.31-13
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,108 kB
  • ctags: 832
  • sloc: ansic: 5,084; sh: 263; csh: 168; makefile: 150
file content (78 lines) | stat: -rw-r--r-- 2,310 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
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh -e

#DEBHELPER#

if [ "$1" == abort-upgrade -o "$1" == abort-remove \
	-o "$1" == abort-deconfigure ] ; then 
	exit
fi

XSETUP0="`grep 'DisplayManager._0.setup' /usr/lib/X11/xdm/xdm-config | \
	awk '{print $2}'`"
XSTARTUP0="`grep 'DisplayManager._0.startup' /usr/lib/X11/xdm/xdm-config | \
	awk '{print $2}'`"
XSETUP="`grep 'DisplayManager\*setup' /usr/lib/X11/xdm/xdm-config | \
	awk '{print $2}'`"
XSTARTUP="`grep 'DisplayManager\*startup' /usr/lib/X11/xdm/xdm-config | \
	awk '{print $2}'`"

if [ ! -f "$XSETUP0" -o ! -f "$XSTARTUP0" -o \
     ! -f "$XSETUP"  -o ! -f "$XSTARTUP" ]; then
	echo "Can't find xdm config files. Won't try to add xbanner to xdm."
	exit;
fi

cat <<EOF

Xbanner configuration
---------------------

A popular use of xbanner is to make it run when xdm is run, to beautify
the xdm login screen. I can modify some files to make this work, if you
want.

EOF
echo -n "Should I modify xdm files to make xbanner be launched on xdm startup? [Y/n] "
read answer

if [ "$answer" = 'n' -o "$answer" = 'N' ]; then
	echo "All right, I won't do that."
else
	echo "# XBanner - begin"		>> $XSETUP0
	echo "/usr/X11R6/bin/freetemp"		>> $XSETUP0
	echo "/usr/X11R6/bin/xbanner -file /etc/X11/XBanner.ad" >> $XSETUP0
	echo "# XBanner - end"			>> $XSETUP0

	echo "# XBanner - begin"		>> $XSETUP
	echo "/usr/X11R6/bin/freetemp"		>> $XSETUP
	echo "/usr/X11R6/bin/xbanner -file /etc/X11/XBanner.ad" >> $XSETUP
	echo "# XBanner - end"			>> $XSETUP

	tmphead=`tempfile -p head`
	tmpbody=`tempfile -p body`
	tmpnew=`tempfile -p new`

	head -1 $XSTARTUP0 > $tmphead
	sed '1d' $XSTARTUP0 > $tmpbody
	echo "# XBanner - begin"		>  $tmpnew
	echo "/usr/X11R6/bin/freetemp"          >> $tmpnew
	echo "# XBanner - end"                  >> $tmpnew
	cat $tmphead $tmpnew $tmpbody >	$XSTARTUP0
	chmod a+x $XSTARTUP0
	rm -f $tmphead $tmpbody $tmpnew

	tmphead=`tempfile -p head`                
	tmpbody=`tempfile -p body`
	tmpnew=`tempfile -p new`

	head -1 $XSTARTUP > $tmphead
	sed '1d' $XSTARTUP > $tmpbody
	echo "# XBanner - begin"                >  $tmpnew
	echo "/usr/X11R6/bin/freetemp"          >> $tmpnew
	echo "# XBanner - end"                  >> $tmpnew
	cat $tmphead $tmpnew $tmpbody > $XSTARTUP
	chmod a+x $XSTARTUP
	rm -f $tmphead $tmpbody $tmpnew

	echo "Xdm files modified to run xbanner."
fi