~ubuntu-branches/ubuntu/natty/base-passwd/natty

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Bazaar Package Importer
  • Author(s): Wichert Akkerman
  • Date: 2002-02-09 19:44:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020209194457-sutkq413kdo35jts
Tags: 3.4.1
Change directory for gnats to /var/lib/gnats on new installs. Do
not change it for existing systems. Closes: Bug#133121

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
set -e
 
4
 
 
5
pkg=base-passwd
 
6
changes=0
 
7
 
 
8
askyesno() {
 
9
        if [ "$DEBIAN_FRONTEND" = "noninteractive" ] ; then
 
10
                a=y
 
11
                return
 
12
        fi
 
13
 
 
14
        while : ; do
 
15
                echo -n "$1 "
 
16
                read a || true
 
17
                if [ "$a" = "" ] ; then
 
18
                        a="y"
 
19
                fi
 
20
                a=`echo $a | tr A-Z a-z`
 
21
                if [ "$a" = "y" -o "$a" = "n" ] ; then
 
22
                        break
 
23
                fi
 
24
                echo "Illegal answer"
 
25
        done
 
26
}
 
27
 
 
28
 
 
29
if [ ! "$1" = "configure" ] ; then
 
30
    exit 0
 
31
fi
 
32
 
 
33
if [ -d /usr/doc -a ! -e /usr/doc/$pkg -a -d /usr/share/doc/$pkg ] ; then
 
34
    ln -s ../share/doc/$pkg /usr/doc/$pkg
 
35
fi
 
36
 
 
37
if [ ! -e /etc/passwd ] ; then
 
38
        cp /usr/share/base-passwd/passwd.master /etc/passwd
 
39
fi
 
40
 
 
41
if [ ! -e /etc/group ] ; then
 
42
        cp /usr/share/base-passwd/group.master /etc/group
 
43
fi
 
44
 
 
45
if [ "$2" = "3.2.2" -a -f /etc/passwd.org ] ; then
 
46
        cat <<EOF
 
47
 
 
48
You are upgrading from version 3.2.2 of base-passwd which had a nasty
 
49
bug: it swapped the uid and gid of local accounts. If you have not
 
50
fixed this problem manually I can undo the changes by restoring your
 
51
previous passwd file from the backup /etc/passwd.org.
 
52
 
 
53
EOF
 
54
 
 
55
        askyesno "Should I restore your passwd? [Y/n]"
 
56
 
 
57
        if [ "$a" = "y" ] ; then
 
58
                cat /etc/passwd.org > /etc/passwd
 
59
                changes=1
 
60
        fi
 
61
fi
 
62
 
 
63
tmp=`tempfile`
 
64
if ! update-passwd --dry-run > $tmp ; then
 
65
        cat <<EOF
 
66
 
 
67
update-passwd has found some differences between your system accounts
 
68
and the current Debian defaults. It is advisable to allow update-passwd
 
69
to change your system; without those changes some packages might not work
 
70
correctly.  For more documentation on the Debian account policies please
 
71
see /usr/share/doc/base-passwd/README.
 
72
 
 
73
The list of proposed changes is:
 
74
 
 
75
EOF
 
76
        
 
77
        cat $tmp
 
78
        cat <<EOF
 
79
 
 
80
It is highly recommend that you allow update-passwd to make these changes
 
81
(a backup file of modified files is made with the extension .org so you can
 
82
always restore the current settings).
 
83
 
 
84
EOF
 
85
        askyesno "May I update your system? [Y/n]"
 
86
fi
 
87
 
 
88
rm -f $tmp
 
89
 
 
90
if [ "$a" = "y" ] ; then
 
91
        echo "Okay, I am going to make the necessary updates now"
 
92
        update-passwd --verbose
 
93
        changes=1
 
94
elif [ "$a" = "n" ] ; then
 
95
        cat <<EOF
 
96
 
 
97
Okay, I will not update your system. If you want to make this update later
 
98
please check the update-passwd utility.
 
99
 
 
100
EOF
 
101
fi
 
102
 
 
103
if [ "$changes" -gt 0 ] ; then
 
104
        if command -v nscd > /dev/null 2>&1 ; then
 
105
                nscd -i passwd -i group
 
106
        fi
 
107
fi
 
108
 
 
109
exit 0
 
110