File: postinst

package info (click to toggle)
ndtpd 2.3.6-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,688 kB
  • ctags: 3,377
  • sloc: ansic: 24,078; sh: 7,530; perl: 1,335; makefile: 646
file content (57 lines) | stat: -rw-r--r-- 1,626 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
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

set -e

if ! grep -q ndtpd /etc/inetd.conf; then
	update-inetd --add "ndtp stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/ndtpd --inetd"
fi

install-info --quiet --section "Miscellaneous" "ndtpd" \
    --description="NDTP Server" /usr/share/info/ndtpd.gz
install-info --quiet --section "Miscellaneous" "eb-ja" \
    --description="NDTP Server(Japanese)" /usr/share/info/ndtpd-ja.gz

# default facility
facility=local0
logfile=/var/log/ndtpd.log

syslogline="$facility.info  $logfile"
restartsyslog=0

if grep "^$syslogline$" /etc/syslog.conf > /dev/null; then
   echo "You have already configured syslog facility $facility logged to $logfile"
elif grep "^$facility" /etc/syslog.conf > /dev/null; then
   echo "syslog facility \`$facility' already used"
   echo "Not fixed: you should check your syslog configuration yourself."
else
   echo "In syslog file, facility $facility does not used yet."
   echo -n "Adding to syslog.conf..."
   cp -p /etc/syslog.conf /etc/syslog.conf.dpkg-old
   echo "# Added by ndtpd package" >> /etc/syslog.conf
   echo $syslogline >> /etc/syslog.conf
   echo "done"
   restartsyslog=1
fi

case "$restartsyslog" in
 1) 
    (umask 027; touch $logfile)
    if [ -x /etc/init.d/sysklogd ]; then
        /etc/init.d/sysklogd restart
    fi
    ;;
esac

# Add ndtpd

if ! grep -q ^ndtpd: /etc/passwd; then
  if [ -x /usr/bin/ypwhich ]; then
    ypmatch ndtpd passwd 2>&1 | grep -q ^ndtpd: || adduser --system --home /var/lib/ndtpd --gecos ndtpd ndtpd
  else
    adduser --system --home /var/lib/ndtpd --gecos ndtpd ndtpd
  fi
fi

chown ndtpd.nogroup /var/lib/ndtpd/

#DEBHELPER#