File: netplan.postinst

package info (click to toggle)
plan 1.8.7-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,196 kB
  • ctags: 1,971
  • sloc: ansic: 24,392; perl: 1,361; sh: 1,030; makefile: 514; yacc: 120; sed: 17
file content (95 lines) | stat: -rw-r--r-- 3,032 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh

set -e

#
# netplan post-installation script
#

#Commented out for debconf: Gopal Narayanan 
if [ "$1" != "configure" ] ; then
    exit 0
fi  


# Check to see if both user netplan _and_ group netplan already exist,
# as well as if /var/lib/plan/netplan.dir/ exists.
if ! { getent group | grep -q '^netplan:[^:]*:' && \
       getent passwd | grep -q '^netplan:[^:]*:' && \
       [ -d /var/lib/plan/netplan.dir ] ; }
then
    # if at least one exists, but not all, remove all
    # before attempting to recreate them, or adduser will barf.
    # Note: Gopal Narayanan <gopal@debian.org> Jan 28, 2002:
    # removed -d check - netplan.dir created by package -will 
    # always fail
    if grep -q '^netplan:[^:]*:63434' /etc/group || \
	grep -q '^netplan:[^:]*:63434' /etc/passwd 
#	[ -d /var/lib/plan/netplan.dir ]
    then
	echo >&2 "Existing config is broken."
	echo >&2 "You may see errors while suppressing user+group \`netplan'."
	userdel -r netplan || true
	groupdel netplan || true
	echo >&2 "User+group \`netplan' were deleted.  Proceeding with configuration."
    fi

    # Add user netplan with uid 63434 and create a new group with the gid
    # equal to the uid. Also create home directory /var/lib/plan. If this
    # fails due to one of user or group already existing fail and cat message.
    if ! adduser --system --uid 63434 --group --home /var/lib/plan/netplan.dir\
	--disabled-password --gecos "netplan daemon user" netplan
    then
	cat >&2 <<EOF

 Unable to create the netplan user and group with uid 63434.

 Please correct this problem and reinstall.

 Note that both user and group IDs in the range 60000-64999 are globally
 allocated by the Debian project.
EOF
	exit 1
    fi

    if [ -r /etc/plan/netplan-acl ]
    then
	echo >&2 "Found existing /etc/plan/netplan-acl"
    else
	# Create empty netplan appointment file and set proper permissions.
	#echo >&2 "Creating empty file /etc/plan/netplan-acl.  See netplan(8)."
	if [ -d /etc/plan ]
	then
	    echo >&2 "# Please read the netplan(8) man page before editing this file." \
		> /etc/plan/netplan-acl
	    chmod 755 /etc/plan
	    chown netplan:netplan /etc/plan/netplan-acl
	    chmod 644 /etc/plan/netplan-acl
	else
	    echo >&2 "/etc/plan does not exist. Aborting."
	    echo >&2 "Please report this bug."
	    exit 1
	fi
    fi
fi

#echo >&2 "Setting permissions on /var/lib/plan/netplan.dir/.  See netplan(8)."
find /var/lib/plan/netplan.dir -type d | xargs chmod 755 
chown -R netplan:netplan /var/lib/plan/netplan.dir
find /var/lib/plan/netplan.dir -type f | xargs -r chmod 644

if [ ! -f /etc/default/netplan ] || grep -q "^ENABLED=0$" /etc/default/netplan
then
  cat >&2 <<EOF
 The netplan daemon, for IP servicing of calendar data, is currently
 disabled. Edit /etc/default/netplan to enable.

 Set ENABLE=1 to turn on the netplan daemon upon reboot. Please read
 the netplan(8) manpage carefully for configuration details. The
 default configuration file, /etc/plan/netplan-acl is currently empty.
EOF
fi

#DEBHELPER#

exit 0