File: postinst

package info (click to toggle)
base-passwd 3.1.10
  • links: PTS
  • area: main
  • in suites: potato
  • size: 200 kB
  • ctags: 115
  • sloc: ansic: 1,149; sh: 232; makefile: 76
file content (73 lines) | stat: -rwxr-xr-x 1,547 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

set -e

pkg=base-passwd

if [ ! "$1" = "configure" ]; then
    exit 0
fi

if [ -d /usr/doc -a ! -e /usr/doc/$pkg -a -d /usr/share/doc/$pkg ] ; then
    ln -s ../share/doc/$pkg /usr/doc/$pkg
fi

if [ ! -e /etc/passwd ] ; then
	cp /usr/share/base-passwd/passwd.master /etc/passwd
fi

if [ ! -e /etc/group ] ; then
	cp /usr/share/base-passwd/group.master /etc/group
fi

tmp=`tempfile`
if ! update-passwd --dry-run > $tmp ; then
	cat <<EOF
update-passwd has found some differences between your system accounts
and the current Debian defaults. It is advisable to allow update-passwd
to change your system; without those changes some packages might not work
correctly.  For more documentation on the Debian account policies please
see /usr/share/doc/base-passwd/README.

The last of proposed changes is:

EOF
	
	cat $tmp
	cat <<EOF

It is highly recommend that you allow update-passwd to make these changes
(a backup file of modified files is made with the extension .old so you can
always restore the current settings).

EOF
	while : ; do
		echo -n "May I update your system? [Y/n] "
		read a
		if [ "$a" = "" ] ; then
			a="y"
		fi
		a=`echo $a | tr A-Z a-z`
		if [ "$a" = "y" -o "$a" = "n" ] ; then
			break
		fi
		echo "Illegal answer"
	done
fi

rm -f $tmp

if [ "$a" = "y" ] ; then
	echo "Okay, I am going to make the necessary updates now"
	update-passwd --verbose
elif [ "$a" = "n" ] ; then
	cat <<EOF

Okay, I will not update your system. If you want to make this update later
please check the update-passwd utility.

EOF
fi

exit 0