File: postinst

package info (click to toggle)
ircd 2.10.07-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,232 kB
  • ctags: 2,253
  • sloc: ansic: 27,541; makefile: 742; sh: 327; perl: 18
file content (45 lines) | stat: -rw-r--r-- 1,235 bytes parent folder | download
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
#!/bin/sh -e

if [ "$1" != "configure" ]
then
    exit 0
fi
touch /var/log/ircd/opers || true
touch /var/log/ircd/users || true
echo -n "Checking existing ircd configuration ... "
CUST="/etc/ircd/ircd.conf /etc/ircd/ircd.motd"
HOST="`hostname --fqdn`"
if [ -e /etc/news/organization ]; then
	NAME="`cat /etc/news/organization`"
else
	NAME="The World Domination Project"
fi
for i in $CUST; do
	cp $i $i.new
	perl -pe 'BEGIN { $host = shift @ARGV; $name = shift @ARGV; } \
		    s/#HOST#/$host/g; s/#NAME#/$name/g;' "$HOST" "$NAME" \
		    < $i.new > $i
	rm $i.new
done
if [ ! -f /etc/ircd/remote.motd ]
then
    cp /etc/ircd/ircd.motd /etc/ircd/remote.motd
fi
echo "done."
if ! grep "^irc:" /etc/passwd > /dev/null
then
    if [ "$2" = "" ]
    then
        echo -n "IRC user not found in /etc/passwd.  Fix?  [y/N] "
        read REPLY
        if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]
        then
            echo "Running adduser --system irc ..."
            adduser --system irc
        fi
    fi
fi
chown -R irc /var/log/ircd /etc/ircd /var/run/ircd 2> /dev/null || true
update-inetd --comment-chars "#disabled#" --disable ircd
update-inetd --add "ircd            stream  tcp     wait    irc     /usr/sbin/ircd ircd -i"
#DEBHELPER#