Upload var/lib/dpkg/info/base-passwd.postinst with huggingface_hub
Browse files
var/lib/dpkg/info/base-passwd.postinst
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#! /bin/sh
|
2 |
+
|
3 |
+
set -e
|
4 |
+
|
5 |
+
# Load the debconf confmodule if it is available. It may not be because this
|
6 |
+
# package is essential and therefore can't depend on debconf directly.
|
7 |
+
if [ -f /usr/share/debconf/confmodule ]; then
|
8 |
+
. /usr/share/debconf/confmodule
|
9 |
+
fi
|
10 |
+
|
11 |
+
changes=0
|
12 |
+
|
13 |
+
askyesno () {
|
14 |
+
if [ "$DEBIAN_FRONTEND" = "noninteractive" ] ; then
|
15 |
+
a=y
|
16 |
+
return
|
17 |
+
fi
|
18 |
+
|
19 |
+
while : ; do
|
20 |
+
echo -n "$1 "
|
21 |
+
read a || true
|
22 |
+
if [ "$a" = "" ] ; then
|
23 |
+
a="y"
|
24 |
+
fi
|
25 |
+
a=`echo $a | tr A-Z a-z`
|
26 |
+
if [ "$a" = "y" ] || [ "$a" = "n" ] ; then
|
27 |
+
break
|
28 |
+
fi
|
29 |
+
echo "Illegal answer"
|
30 |
+
done
|
31 |
+
}
|
32 |
+
|
33 |
+
# A cut-down version of 'which' from debianutils.
|
34 |
+
searchpath () {
|
35 |
+
PROGRAM="$1"
|
36 |
+
IFS_SAVE="$IFS"
|
37 |
+
IFS=:
|
38 |
+
RET=1
|
39 |
+
for ELEMENT in $PATH; do
|
40 |
+
if [ -z "$ELEMENT" ]; then
|
41 |
+
ELEMENT=.
|
42 |
+
fi
|
43 |
+
if [ -f "$ELEMENT/$PROGRAM" ] && \
|
44 |
+
[ -x "$ELEMENT/$PROGRAM" ]; then
|
45 |
+
RET=0
|
46 |
+
break
|
47 |
+
fi
|
48 |
+
done
|
49 |
+
IFS="$IFS_SAVE"
|
50 |
+
return "$RET"
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
if [ ! "$1" = "configure" ] ; then
|
55 |
+
exit 0
|
56 |
+
fi
|
57 |
+
|
58 |
+
if [ ! -e /etc/passwd ] ; then
|
59 |
+
cp /usr/share/base-passwd/passwd.master /etc/passwd
|
60 |
+
fi
|
61 |
+
|
62 |
+
if [ ! -e /etc/group ] ; then
|
63 |
+
cp /usr/share/base-passwd/group.master /etc/group
|
64 |
+
fi
|
65 |
+
|
66 |
+
if [ "$2" = "3.2.2" ] && [ -f /etc/passwd.org ] ; then
|
67 |
+
cat <<EOF
|
68 |
+
|
69 |
+
You are upgrading from version 3.2.2 of base-passwd which had a nasty
|
70 |
+
bug: it swapped the uid and gid of local accounts. If you have not
|
71 |
+
fixed this problem manually I can undo the changes by restoring your
|
72 |
+
previous passwd file from the backup /etc/passwd.org.
|
73 |
+
|
74 |
+
EOF
|
75 |
+
|
76 |
+
askyesno "Should I restore your passwd? [Y/n]"
|
77 |
+
|
78 |
+
if [ "$a" = "y" ] ; then
|
79 |
+
cat /etc/passwd.org > /etc/passwd
|
80 |
+
changes=1
|
81 |
+
fi
|
82 |
+
fi
|
83 |
+
|
84 |
+
tmp=`tempfile`
|
85 |
+
if ! update-passwd --dry-run > $tmp ; then
|
86 |
+
if [ -f /usr/share/debconf/confmodule ] ; then
|
87 |
+
db_version 2.0
|
88 |
+
update-passwd --verbose
|
89 |
+
changes=1
|
90 |
+
else
|
91 |
+
cat <<EOF
|
92 |
+
|
93 |
+
update-passwd has found some differences between your system accounts
|
94 |
+
and the current Debian defaults. It is advisable to allow update-passwd
|
95 |
+
to change your system; without those changes some packages might not work
|
96 |
+
correctly. For more documentation on the Debian account policies, please
|
97 |
+
see /usr/share/doc/base-passwd/README.
|
98 |
+
|
99 |
+
The list of proposed changes is:
|
100 |
+
|
101 |
+
EOF
|
102 |
+
|
103 |
+
cat $tmp
|
104 |
+
cat <<EOF
|
105 |
+
|
106 |
+
It is highly recommended that you allow update-passwd to make these changes
|
107 |
+
(a backup file of modified files is made with the extension .org so you can
|
108 |
+
always restore the current settings).
|
109 |
+
|
110 |
+
EOF
|
111 |
+
askyesno "May I update your system? [Y/n]"
|
112 |
+
fi
|
113 |
+
|
114 |
+
if [ "$a" = "y" ] ; then
|
115 |
+
echo "Okay, I am going to make the necessary updates now"
|
116 |
+
update-passwd --verbose
|
117 |
+
changes=1
|
118 |
+
elif [ "$a" = "n" ] ; then
|
119 |
+
cat <<EOF
|
120 |
+
|
121 |
+
Okay, I will not update your system. If you want to make this update later
|
122 |
+
please check the update-passwd utility.
|
123 |
+
|
124 |
+
EOF
|
125 |
+
|
126 |
+
fi
|
127 |
+
fi
|
128 |
+
|
129 |
+
rm -f $tmp
|
130 |
+
|
131 |
+
if [ "$changes" -gt 0 ] ; then
|
132 |
+
if searchpath nscd; then
|
133 |
+
nscd -i passwd -i group || true
|
134 |
+
fi
|
135 |
+
fi
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
exit 0
|