|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
1 |
#! /bin/sh
|
2 |
set -e
|
|
3 |
||
4 |
. /usr/share/debconf/confmodule |
|
5 |
||
6 |
if [ "$1" ]; then |
|
|
39.1.363
by Frans Pop
user-setup-apply: avoid locale errors from perl when used in D-I |
7 |
export LANG=C # avoid locale errors from perl |
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
8 |
ROOT="$1" |
9 |
chroot=chroot |
|
10 |
log='log-output -t user-setup' |
|
11 |
else
|
|
12 |
ROOT= |
|
13 |
chroot= |
|
14 |
log= |
|
15 |
fi
|
|
16 |
||
17 |
. /usr/lib/user-setup/functions.sh |
|
18 |
||
19 |
# Set a password, via chpasswd.
|
|
|
46
by Colin Watson
* Don't use perl to pass parameters to chpasswd. Speeds up the live cd |
20 |
# Use a heredoc rather than echo, to avoid the password
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
21 |
# showing in the process table. (However, this is normally
|
|
30
by Joey Hess
use a for loop |
22 |
# only called when first installing the system, when root has no
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
23 |
# password at all, so that should be an unnecessary precaution).
|
24 |
#
|
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
25 |
# Pass in four arguments: the user, the password, 'true' if the
|
26 |
# password has been pre-crypted (by preseeding), and a 'true' if
|
|
27 |
# the home directory is encrypted
|
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
28 |
setpassword () { |
|
197
by Dustin Kirkland
* user-setup-apply: karmic's merge brought in new functionality that |
29 |
local USER PASSWD PAM_SET_PWD
|
|
46
by Colin Watson
* Don't use perl to pass parameters to chpasswd. Speeds up the live cd |
30 |
USER="$1" |
31 |
PASSWD="$2" |
|
|
39.1.435
by Frans Pop
user-setup-apply: restore compatibility with Lenny version of passwd (without PAM support) |
32 |
|
|
39.1.437
by Otavio Salvador
user-setup-apply: use dpkg-query instead of dpkg -s to get the passwd |
33 |
local VERSION=$($chroot $ROOT dpkg-query -W -f '${Version}\n' passwd) |
|
197
by Dustin Kirkland
* user-setup-apply: karmic's merge brought in new functionality that |
34 |
PAM_SET_PWD=false |
|
39.1.436
by Frans Pop
Add quotes just to be safe |
35 |
if $chroot $ROOT dpkg --compare-versions "$VERSION" ge "1:4.1.4-1"; then |
|
39.1.435
by Frans Pop
user-setup-apply: restore compatibility with Lenny version of passwd (without PAM support) |
36 |
# support for versions with PAM support (Squeeze)
|
|
197
by Dustin Kirkland
* user-setup-apply: karmic's merge brought in new functionality that |
37 |
PAM_SET_PWD=true |
|
39.1.435
by Frans Pop
user-setup-apply: restore compatibility with Lenny version of passwd (without PAM support) |
38 |
if [ "$3" = true ]; then |
39 |
$chroot $ROOT usermod --password=$PASSWD $USER |
|
40 |
else
|
|
41 |
$chroot $ROOT chpasswd <<EOF |
|
42 |
$USER:$PASSWD
|
|
43 |
EOF
|
|
44 |
fi
|
|
|
39.1.432
by Christian Perrier
Do not use chpasswd when the password is preseeded |
45 |
else
|
|
39.1.435
by Frans Pop
user-setup-apply: restore compatibility with Lenny version of passwd (without PAM support) |
46 |
# compatibility support for versions without PAM support (Lenny)
|
47 |
local OPTS
|
|
48 |
if [ "$3" = true ]; then |
|
49 |
OPTS=-e |
|
50 |
else
|
|
51 |
OPTS=-m |
|
52 |
fi
|
|
53 |
$chroot $ROOT chpasswd $OPTS <<EOF |
|
|
39.1.65
by Tollef Fog Heen
Don't use perl to pass parameters to chpasswd. |
54 |
$USER:$PASSWD
|
55 |
EOF
|
|
|
39.1.432
by Christian Perrier
Do not use chpasswd when the password is preseeded |
56 |
fi
|
|
197
by Dustin Kirkland
* user-setup-apply: karmic's merge brought in new functionality that |
57 |
# If the password was set using PAM, pam_ecryptfs will handle the initial
|
58 |
# passphrase wrapping. Otherwise, we need this hack...
|
|
59 |
if [ "$4" = true ] && [ "$PAM_SET_PWD" = false ]; then |
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
60 |
local UNWRAPPED_PASSPHRASE_FILE WRAPPED_PASSPHRASE_FILE MOUNT_PASSPHRASE |
61 |
UNWRAPPED_PASSPHRASE_FILE=/dev/shm/.ecryptfs-$USER |
|
|
187
by Colin Watson
Error out more gracefully, although with a clear red-screen error, if |
62 |
if [ -e "$UNWRAPPED_PASSPHRASE_FILE" ]; then |
63 |
WRAPPED_PASSPHRASE_FILE=/home/$USER/.ecryptfs/wrapped-passphrase |
|
64 |
MOUNT_PASSPHRASE=$($chroot $ROOT cat $UNWRAPPED_PASSPHRASE_FILE) |
|
65 |
$chroot $ROOT ecryptfs-wrap-passphrase $WRAPPED_PASSPHRASE_FILE - <<EOF |
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
66 |
$MOUNT_PASSPHRASE
|
67 |
$PASSWD
|
|
68 |
EOF
|
|
|
187
by Colin Watson
Error out more gracefully, although with a clear red-screen error, if |
69 |
$chroot $ROOT rm -f $UNWRAPPED_PASSPHRASE_FILE |
70 |
$chroot $ROOT chown $USER:$USER $WRAPPED_PASSPHRASE_FILE |
|
71 |
else
|
|
72 |
echo "$UNWRAPPED_PASSPHRASE_FILE does not exist, but should!" >&2 |
|
73 |
db_input critical user-setup/encrypt-home-failed || true |
|
74 |
db_go || true |
|
75 |
fi |
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
76 |
fi
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
77 |
}
|
78 |
||
79 |
# Enable/disable shadow passwords.
|
|
80 |
db_get passwd/shadow |
|
81 |
if [ "$RET" = true ]; then |
|
82 |
$log $chroot $ROOT shadowconfig on |
|
83 |
else
|
|
84 |
$log $chroot $ROOT shadowconfig off |
|
85 |
fi
|
|
86 |
||
87 |
if ! root_password; then |
|
88 |
# Was the root password preseeded encrypted?
|
|
89 |
if db_get passwd/root-password-crypted && [ "$RET" ]; then |
|
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
90 |
# The root password was preseeded encrypted.
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
91 |
ROOT_PW="$RET" |
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
92 |
PRECRYPTED=true |
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
93 |
else |
94 |
db_get passwd/root-password
|
|
95 |
ROOT_PW="$RET" |
|
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
96 |
PRECRYPTED=false |
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
97 |
fi |
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
98 |
# Clear the root password from the database, and set the password.
|
99 |
db_set passwd/root-password-crypted ''
|
|
100 |
db_set passwd/root-password ''
|
|
101 |
db_set passwd/root-password-again ''
|
|
|
56
by Colin Watson
merge from Debian 1.2 |
102 |
if [ "$ROOT_PW" ]; then |
103 |
setpassword root "$ROOT_PW" "$PRECRYPTED" |
|
104 |
fi
|
|
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
105 |
ROOT_PW= |
106 |
else
|
|
107 |
# Just in case, clear any preseeded root password from the database
|
|
108 |
# anyway.
|
|
109 |
db_set passwd/root-password-crypted ''
|
|
110 |
db_set passwd/root-password ''
|
|
111 |
db_set passwd/root-password-again ''
|
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
112 |
fi
|
113 |
||
114 |
db_get passwd/make-user |
|
115 |
if [ "$RET" = true ] && ! is_system_user; then |
|
116 |
if db_get passwd/user-password-crypted && [ "$RET" ]; then |
|
117 |
USER_PW="$RET" |
|
118 |
USER_PW_CRYPTED=true |
|
119 |
else |
|
120 |
db_get passwd/user-password
|
|
121 |
USER_PW="$RET" |
|
122 |
USER_PW_CRYPTED=false |
|
123 |
fi |
|
124 |
||
125 |
if db_get passwd/user-uid && [ "$RET" ]; then |
|
126 |
if [ -x $ROOT/usr/sbin/adduser ]; then |
|
127 |
UIDOPT="--uid $RET" |
|
128 |
else
|
|
129 |
UIDOPT="-u $RET" |
|
130 |
fi
|
|
131 |
else
|
|
132 |
UIDOPT= |
|
133 |
fi
|
|
134 |
||
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
135 |
ENCRYPT_HOME="false" |
|
133
by Evan Dandrea
Changes for LP: #302870 |
136 |
ENCRYPT_HOME_OPT= |
|
263
by Colin Watson
If OVERRIDE_ALREADY_ENCRYPTED_SWAP is set in the environment, copy |
137 |
if [ "$OVERRIDE_ALREADY_ENCRYPTED_SWAP" ]; then |
138 |
ENCRYPT_HOME="true" |
|
139 |
ENCRYPT_HOME_OPT="--encrypt-home" |
|
140 |
elif db_get user-setup/encrypt-home && [ "$RET" = true ]; then |
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
141 |
ENCRYPT_HOME="true" |
|
133
by Evan Dandrea
Changes for LP: #302870 |
142 |
ENCRYPT_HOME_OPT="--encrypt-home" |
|
141
by Colin Watson
Load aes, cbc, and ecb modules after installing crypto-modules but |
143 |
if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then |
144 |
ANNA_QUIET=1 DEBIAN_FRONTEND=none $log anna-install crypto-modules || true |
|
145 |
depmod -a >/dev/null 2>&1 || true |
|
146 |
fi |
|
147 |
for module in aes cbc ecb; do |
|
148 |
modprobe -q "$module" || true |
|
149 |
done |
|
|
251
by Colin Watson
apt-install ecryptfs-utils and cryptsetup in user-setup-apply, not |
150 |
apt-install ecryptfs-utils 2>/dev/null
|
151 |
apt-install cryptsetup 2>/dev/null |
|
|
200
by Evan Dandrea
Mount /proc, bind-mount /dev, and pass the necessary options for |
152 |
|
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
153 |
umountproc=false |
|
231
by Evan Dandrea
Mount /sys in the chroot for swap encryption, so that devtmpfs can |
154 |
umountsys=false |
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
155 |
umountdev=false |
156 |
if [ ! -e $ROOT/proc/cmdline ]; then |
|
157 |
$log $chroot $ROOT mount -t proc proc /proc |
|
158 |
umountproc=: |
|
159 |
fi
|
|
|
231
by Evan Dandrea
Mount /sys in the chroot for swap encryption, so that devtmpfs can |
160 |
if [ ! -e $ROOT/sys/block ]; then |
161 |
# We need /sys for devtmpfs to create block devices.
|
|
162 |
$log $chroot $ROOT mount -t sysfs sysfs /sys |
|
163 |
umountsys=: |
|
164 |
fi
|
|
|
271
by Colin Watson
Fix syntax error in user-setup-apply if $ROOT is unset (LP: #1066256). |
165 |
if [ "$(stat -c %d "$ROOT/dev")" -eq "$(stat -c %d "$ROOT/")" ]; then |
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
166 |
mount --bind /dev $ROOT/dev |
167 |
umountdev=: |
|
|
231
by Evan Dandrea
Mount /sys in the chroot for swap encryption, so that devtmpfs can |
168 |
else
|
|
233
by Evan Dandrea
Trigger udev rather than remounting /dev (LP: #693027). |
169 |
$log $chroot $ROOT udevadm settle |
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
170 |
fi
|
|
200
by Evan Dandrea
Mount /proc, bind-mount /dev, and pass the necessary options for |
171 |
if ! $log $chroot $ROOT ecryptfs-setup-swap -f -n; then |
|
197.1.1
by Evan Dandrea
Encrypt all swap partitions when the encrypt-home option is set. |
172 |
echo "ecryptfs-setup-swap failed." >&2 |
173 |
db_input critical user-setup/encrypt-home-failed || true |
|
174 |
db_go || true |
|
|
200
by Evan Dandrea
Mount /proc, bind-mount /dev, and pass the necessary options for |
175 |
ENCRYPT_HOME="false" |
176 |
ENCRYPT_HOME_OPT= |
|
|
197.1.1
by Evan Dandrea
Encrypt all swap partitions when the encrypt-home option is set. |
177 |
fi
|
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
178 |
if $umountproc; then |
179 |
$log $chroot $ROOT umount /proc |
|
180 |
fi
|
|
|
231
by Evan Dandrea
Mount /sys in the chroot for swap encryption, so that devtmpfs can |
181 |
if $umountsys; then |
182 |
$log $chroot $ROOT umount /sys |
|
183 |
fi
|
|
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
184 |
if $umountdev; then |
185 |
umount $ROOT/dev |
|
186 |
fi
|
|
|
133
by Evan Dandrea
Changes for LP: #302870 |
187 |
fi
|
188 |
||
189 |
||
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
190 |
# Add the user to the database, using adduser in noninteractive
|
191 |
# mode.
|
|
192 |
db_get passwd/username |
|
193 |
USER="$RET" |
|
194 |
db_get passwd/user-fullname |
|
195 |
||
|
52
by Colin Watson
* Backport from trunk (closes: Malone #16640): |
196 |
HOME_EXISTED= |
197 |
if [ -d "$ROOT/home/$USER" ]; then |
|
198 |
HOME_EXISTED=1 |
|
|
166
by Colin Watson
Don't offer encrypting the home directory if the selected user's home |
199 |
# user-setup-ask shouldn't have allowed this, but for safety:
|
200 |
ENCRYPT_HOME="false" |
|
201 |
ENCRYPT_HOME_OPT= |
|
|
52
by Colin Watson
* Backport from trunk (closes: Malone #16640): |
202 |
fi
|
203 |
||
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
204 |
umountsys=false |
|
149
by Evan Dandrea
chroot to get the mount passphrase and mount /sys and /dev/shm to |
205 |
if [ -n "$ENCRYPT_HOME_OPT" ]; then |
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
206 |
if [ ! -e $ROOT/sys/kernel ]; then |
207 |
$log $chroot $ROOT mount -t sysfs sysfs /sys |
|
208 |
umountsys=: |
|
209 |
fi
|
|
|
242
by Colin Watson
Make sure /dev/shm exists before mounting it for ecryptfs (LP: #820460). |
210 |
mkdir -p $ROOT/dev/shm |
|
149
by Evan Dandrea
chroot to get the mount passphrase and mount /sys and /dev/shm to |
211 |
$log $chroot $ROOT mount -t tmpfs tmpfs /dev/shm |
212 |
fi
|
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
213 |
if [ -x $ROOT/usr/sbin/adduser ]; then |
|
133
by Evan Dandrea
Changes for LP: #302870 |
214 |
$log $chroot $ROOT adduser --disabled-password --gecos "$RET" $UIDOPT $ENCRYPT_HOME_OPT "$USER" >/dev/null || true |
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
215 |
else |
|
29
by Christian Perrier
Add more logging to user-setup-apply |
216 |
$log $chroot $ROOT useradd -c "$RET" -m "$USER" $UIDOPT >/dev/null || true |
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
217 |
fi |
218 |
||
219 |
# Clear the user password from the database.
|
|
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
220 |
db_set passwd/user-password-crypted ''
|
221 |
db_set passwd/user-password ''
|
|
222 |
db_set passwd/user-password-again ''
|
|
|
143
by Colin Watson
Merge patch from Dustin Kirkland: |
223 |
setpassword "$USER" "$USER_PW" "$USER_PW_CRYPTED" "$ENCRYPT_HOME" |
|
149
by Evan Dandrea
chroot to get the mount passphrase and mount /sys and /dev/shm to |
224 |
if [ -n "$ENCRYPT_HOME_OPT" ]; then |
|
206
by Evan Dandrea
Check if filesystems are already mounted before attempting to mount |
225 |
if $umountsys; then |
226 |
$log $chroot $ROOT umount /sys |
|
227 |
fi
|
|
|
149
by Evan Dandrea
chroot to get the mount passphrase and mount /sys and /dev/shm to |
228 |
$log $chroot $ROOT umount /dev/shm |
229 |
fi
|
|
|
29
by Christian Perrier
Add more logging to user-setup-apply |
230 |
|
|
52
by Colin Watson
* Backport from trunk (closes: Malone #16640): |
231 |
if [ "$HOME_EXISTED" ]; then |
232 |
# The user's home directory already existed before we called
|
|
233 |
# adduser. This often means that a mount point under
|
|
234 |
# /home/$USER was selected in (and thus created by) partman,
|
|
235 |
# and the home directory may have ended up owned by root.
|
|
236 |
$log $chroot $ROOT chown "$USER:$USER" "/home/$USER" >/dev/null || true |
|
237 |
fi |
|
238 |
||
|
29
by Christian Perrier
Add more logging to user-setup-apply |
239 |
if [ -n "$USER" ]; then |
|
103
by Colin Watson
Create sambashare group and add the initial user to it (thanks, Mantas |
240 |
for group in lpadmin sambashare; do |
|
40
by Colin Watson
* Port Ubuntu changes from passwd.config: |
241 |
$log $chroot $ROOT addgroup --system $group >/dev/null 2>&1 || true |
242 |
done |
|
|
86
by Colin Watson
* Only call archdetect if we have it, in order not to break use of the |
243 |
if type archdetect >/dev/null 2>&1; then |
244 |
SUBARCH="$(archdetect)" |
|
245 |
case $SUBARCH in |
|
246 |
powerpc/ps3|powerpc/cell)
|
|
247 |
$log $chroot $ROOT addgroup --system spu >/dev/null 2>&1 || true |
|
248 |
;; |
|
249 |
esac
|
|
250 |
fi
|
|
|
88
by Colin Watson
merge from Debian 1.16 |
251 |
db_get passwd/user-default-groups
|
|
39.1.297
by Otavio Salvador
Add support to change the default set of groups for the first user |
252 |
for group in $RET; do |
|
30
by Joey Hess
use a for loop |
253 |
$log $chroot $ROOT adduser "$USER" $group >/dev/null 2>&1 || true |
254 |
done |
|
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
255 |
|
256 |
# Configure desktop auto-login if instructed by preseeding
|
|
257 |
db_get passwd/auto-login |
|
258 |
if [ "$RET" = true ]; then |
|
|
177
by Colin Watson
Add preseedable passwd/auto-login-backup question; if set (e.g. to |
259 |
db_get passwd/auto-login-backup
|
260 |
BACKUP="${RET:+.$RET}" |
|
261 |
||
|
295
by Mathieu Trudel-Lapierre
Fix paths for GDM configs which are now in /etc/gdm3. (LP: #1571415) |
262 |
if [ -d "$ROOT/etc/gdm3" ]; then |
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
263 |
# Configure GDM autologin
|
|
295
by Mathieu Trudel-Lapierre
Fix paths for GDM configs which are now in /etc/gdm3. (LP: #1571415) |
264 |
GDMCustomFile=$ROOT/etc/gdm3/custom.conf |
|
209.1.1
by Didier Roche
user-setup-apply: preserve old values in custom.conf. Only replace |
265 |
if [ -e "$GDMCustomFile" ] && [ "$BACKUP" ]; then |
266 |
cp "$GDMCustomFile" "${GDMCustomFile}$BACKUP" |
|
|
192
by Colin Watson
Use /etc/gdm/custom.conf rather than /etc/gdm/gdm.conf-custom (LP: |
267 |
fi
|
|
210
by Colin Watson
merge lp:~didrocks/user-setup/fix-derivatives-session |
268 |
AutologinParameters="AutomaticLoginEnable=true\n\ |
|
287
by Mathieu Trudel-Lapierre
Fix typo in previous upload: AutomaticLogin line for gdm was containing |
269 |
AutomaticLogin=$USER\n"
|
|
209.1.1
by Didier Roche
user-setup-apply: preserve old values in custom.conf. Only replace |
270 |
|
|
210
by Colin Watson
merge lp:~didrocks/user-setup/fix-derivatives-session |
271 |
# Prevent from updating if parameters already present (persistent usb key)
|
272 |
if ! `grep -qs "AutomaticLogin=$USER" $GDMCustomFile` ; then |
|
|
212
by Mario Limonciello
Fix automatic login on situations where custom.conf didn't exist |
273 |
if [ -e "$GDMCustomFile" ]; then |
|
283.2.1
by Tim Lunn
Don't set TimedLogin, this gets set when Auto login is selected |
274 |
sed -i '/\(Automatic\)Login/d' $GDMCustomFile |
|
212
by Mario Limonciello
Fix automatic login on situations where custom.conf didn't exist |
275 |
fi
|
|
210
by Colin Watson
merge lp:~didrocks/user-setup/fix-derivatives-session |
276 |
if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then |
277 |
echo '[daemon]' >> $GDMCustomFile |
|
278 |
fi
|
|
279 |
sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile |
|
280 |
fi
|
|
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
281 |
fi
|
282 |
|
|
|
157.1.1
by Roman Shtylman
changed to use kde4 as default |
283 |
if $chroot $ROOT [ -f /etc/kde4/kdm/kdmrc ]; then |
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
284 |
# Configure KDM autologin
|
|
177
by Colin Watson
Add preseedable passwd/auto-login-backup question; if set (e.g. to |
285 |
$log $chroot $ROOT sed -i$BACKUP -r \ |
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
286 |
-e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \ |
287 |
-e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USER/" \ |
|
288 |
-e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \ |
|
|
157.1.1
by Roman Shtylman
changed to use kde4 as default |
289 |
/etc/kde4/kdm/kdmrc |
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
290 |
fi
|
|
227.1.1
by Julien Lavergne
Add support for autologin when lxdm is installed (LP: #546445) |
291 |
|
292 |
if $chroot $ROOT [ -f /etc/lxdm/lxdm.conf ]; then |
|
293 |
# Configure LXDM autologin with LXDE session
|
|
294 |
$log $chroot $ROOT sed -i$BACKUP -r \ |
|
295 |
-e "s/^# autologin=dgod/autologin=$USER/" \ |
|
296 |
-e "s/^# session/session/" \ |
|
297 |
/etc/lxdm/lxdm.conf |
|
298 |
fi
|
|
299 |
||
300 |
if $chroot $ROOT [ -f /etc/xdg/lubuntu/lxdm/lxdm.conf ]; then |
|
301 |
# Configure LXDM autologin with Lubuntu session
|
|
302 |
$log $chroot $ROOT sed -i$BACKUP -r \ |
|
303 |
-e "s/^# autologin=dgod/autologin=$USER/" \ |
|
304 |
-e "s/^# session/session/" \ |
|
305 |
-e "s/startlxde/startlubuntu/" \ |
|
306 |
/etc/xdg/lubuntu/lxdm/lxdm.conf |
|
307 |
fi
|
|
|
237
by Colin Watson
Add LightDM autologin support (LP: #797669). |
308 |
|
|
282
by Colin Watson
whitespace |
309 |
if $chroot $ROOT [ -f /usr/bin/sddm ]; then |
|
283.1.1
by Jörn Schönyan
fix SDDM autologin for non-plasma desktops |
310 |
# Configure SDDM autologin with an appropiate session
|
|
282
by Colin Watson
whitespace |
311 |
$log $chroot $ROOT /bin/sh -c "cat > /etc/sddm.conf" << EOF |
|
279.1.1
by Rohan Garg
Add SDDM autologin support |
312 |
[Autologin]
|
313 |
User=$USER
|
|
|
283.1.1
by Jörn Schönyan
fix SDDM autologin for non-plasma desktops |
314 |
Session=PLACEHOLDER
|
|
279.1.2
by Rohan Garg
Structure the code a bit better |
315 |
EOF
|
|
283.1.1
by Jörn Schönyan
fix SDDM autologin for non-plasma desktops |
316 |
if $chroot $ROOT [ -f /usr/share/xsessions/plasma.desktop ]; then |
317 |
sed -i 's/PLACEHOLDER/plasma.desktop/' /etc/sddm.conf |
|
318 |
elif $chroot $ROOT [ -f /usr/share/xsessions/Lubuntu.desktop ]; then |
|
319 |
sed -i 's/PLACEHOLDER/Lubuntu.desktop/' /etc/sddm.conf |
|
320 |
elif $chroot $ROOT [ -f /usr/share/xsessions/lxqt.desktop ]; then |
|
321 |
sed -i 's/PLACEHOLDER/lxqt.desktop/' /etc/sddm.conf |
|
322 |
else #fallback if some other DE/WM is used |
|
323 |
SDDMSESSION=$(ls /usr/share/xsessions | head -1) |
|
324 |
sed -i "s/PLACEHOLDER/$SDDMSESSION/" sddm.conf
|
|
325 |
fi
|
|
|
282
by Colin Watson
whitespace |
326 |
fi
|
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
327 |
if $chroot $ROOT [ -d /etc/lightdm ]; then |
|
237
by Colin Watson
Add LightDM autologin support (LP: #797669). |
328 |
# Configure LightDM autologin
|
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
329 |
LightDMCustomFile=$ROOT/etc/lightdm/lightdm.conf |
|
246
by Mario Limonciello
Don't restrict guest login from login screen if autologin was configured, |
330 |
AutologinParameters="autologin-guest=false\n\ |
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
331 |
autologin-user=$USER\n\
|
|
289
by Robert Ancell
* Update autologin LightDM confgiguration to used [Seat:*] sections instead of |
332 |
autologin-user-timeout=0"
|
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
333 |
if ! grep -qs '^autologin-user' $LightDMCustomFile; then |
|
290
by Mathieu Trudel-Lapierre
user-setup-apply: use correct syntax escaping, fix the lightdm |
334 |
if ! grep -qs '^\[Seat:\*\]' $LightDMCustomFile; then |
|
289
by Robert Ancell
* Update autologin LightDM confgiguration to used [Seat:*] sections instead of |
335 |
echo '[Seat:*]' >> $LightDMCustomFile |
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
336 |
fi
|
|
290
by Mathieu Trudel-Lapierre
user-setup-apply: use correct syntax escaping, fix the lightdm |
337 |
sed -i "s/\[Seat:\*\]/\[Seat:\*\]\n$AutologinParameters/" $LightDMCustomFile |
|
245
by Mario Limonciello
In the oem-config scenario, just sed out the oem user for the correct user |
338 |
#oem config scenario
|
339 |
else
|
|
340 |
sed -i "s/^\(\(str *\)\?autologin-user\)=.*$/\1=$USER/g;" $ROOT/etc/lightdm/lightdm.conf |
|
|
244
by Mario Limonciello
add 1.28ubuntu19 that was not committed to bzr |
341 |
fi
|
|
237
by Colin Watson
Add LightDM autologin support (LP: #797669). |
342 |
fi
|
|
108
by Colin Watson
Add preseedable passwd/auto-login question; if set to true, configure |
343 |
fi
|
|
29
by Christian Perrier
Add more logging to user-setup-apply |
344 |
fi
|
|
40
by Colin Watson
* Port Ubuntu changes from passwd.config: |
345 |
|
|
39.1.86
by Joey Hess
* Add passwd/root-login question (asked at medium priority), currently |
346 |
db_get passwd/root-login
|
347 |
if [ "$RET" = false ] && [ -n "$USER" ]; then |
|
348 |
# Ensure sudo is installed, and set up the user to be able
|
|
349 |
# to use it.
|
|
350 |
if [ ! -e $ROOT/etc/sudoers ]; then |
|
351 |
# try to work in d-i and out; it's better to
|
|
352 |
# use apt-install in d-i
|
|
|
39.1.296
by Joey Hess
* Additionally, fix chroot call bug in sudo installation code. |
353 |
apt-install sudo 2>/dev/null || $log $chroot $ROOT apt-get -q -y install sudo || true |
|
39.1.86
by Joey Hess
* Add passwd/root-login question (asked at medium priority), currently |
354 |
fi |
355 |
if [ -e $ROOT/etc/sudoers ]; then |
|
|
39.1.522
by Christian Perrier
Add the newly created user to the sudo group if root is disabled |
356 |
# Test if we can add the user to the sudo group
|
357 |
# (possible if sudo >= 1.7.2-2 is installed on the target system)
|
|
358 |
# If we can, do it this way, otherwise add the user to sudoers
|
|
359 |
# See #597239
|
|
360 |
if ! $log $chroot $ROOT adduser "$USER" sudo >/dev/null 2>&1; then |
|
361 |
echo "$USER ALL=(ALL) ALL" >> $ROOT/etc/sudoers |
|
362 |
fi
|
|
|
39.1.86
by Joey Hess
* Add passwd/root-login question (asked at medium priority), currently |
363 |
else
|
364 |
# sudo failed to install, system won't be usable
|
|
365 |
exit 1
|
|
|
40
by Colin Watson
* Port Ubuntu changes from passwd.config: |
366 |
fi
|
|
39.1.166
by Joey Hess
* Configure gksu to use sudo, via an alternative, if libgksu2-0 version |
367 |
# Configure gksu to use sudo, via an alternative, if it's
|
368 |
# installed and the alternative is registered.
|
|
|
39.1.294
by Joey Hess
* Fix user-setup-apply to properly set up gksu alternatives for sudo mode. |
369 |
if $chroot $ROOT update-alternatives --display libgksu-gconf-defaults >/dev/null 2>&1; then |
370 |
$log $chroot $ROOT update-alternatives --set libgksu-gconf-defaults /usr/share/libgksu/debian/gconf-defaults.libgksu-sudo |
|
|
39.1.368
by Colin Watson
Don't exit user-setup-apply if update-gconf-defaults fails. |
371 |
$log $chroot $ROOT update-gconf-defaults || true |
|
39.1.166
by Joey Hess
* Configure gksu to use sudo, via an alternative, if libgksu2-0 version |
372 |
fi |
|
39.1.531
by Otavio Salvador
Configure aptitude to use sudo if possible. Thanks to Mehdi Dogguy by reporting it. |
373 |
# Configure aptitude to use sudo.
|
374 |
echo 'Aptitude::Get-Root-Command "sudo:/usr/bin/sudo";' > $ROOT/etc/apt/apt.conf.d/00aptitude |
|
|
194
by Colin Watson
If a root user is being created so we aren't in sudo mode, configure |
375 |
else
|
376 |
# Configure gksu to use su, via an alternative, if it's
|
|
377 |
# installed and the alternative is registered.
|
|
378 |
if $chroot $ROOT update-alternatives --display libgksu-gconf-defaults >/dev/null 2>&1; then |
|
379 |
$log $chroot $ROOT update-alternatives --set libgksu-gconf-defaults /usr/share/libgksu/debian/gconf-defaults.libgksu-su |
|
380 |
$log $chroot $ROOT update-gconf-defaults || true |
|
381 |
fi |
|
|
39.1.86
by Joey Hess
* Add passwd/root-login question (asked at medium priority), currently |
382 |
fi
|
|
263
by Colin Watson
If OVERRIDE_ALREADY_ENCRYPTED_SWAP is set in the environment, copy |
383 |
if [ -z "$OVERRIDE_ALREADY_ENCRYPTED_SWAP" ] && \ |
384 |
[ -n "$ENCRYPT_HOME_OPT" ] && [ -e $ROOT/etc/crypttab ]; then |
|
|
202
by Evan Dandrea
Zero out swap devices at the end of install when encryption is |
385 |
# Zero out all encrypted swap partitions. It is assumed that
|
386 |
# passwords are not used beyond this point in the install.
|
|
387 |
# cryptswap0 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
|
|
|
216
by Evan Dandrea
Provide a progress message for wiping swap space (LP: #432422). |
388 |
# Ideally we would set up a new progress bar here, but we're
|
389 |
# inside finish-install's and cdebconf doesn't support nested
|
|
390 |
# progress bars.
|
|
391 |
db_progress INFO user-setup/progress/wipe-swap |
|
|
202
by Evan Dandrea
Zero out swap devices at the end of install when encryption is |
392 |
while read name device source options; do |
393 |
if echo "$options" | grep -q "swap"; then |
|
394 |
if swapoff $device; then |
|
|
223
by Oliver Grawert
make zeroing swap work also with swapfiles if encrypted home is selected Bug #646421 |
395 |
if [ ! -b $device ]; then |
|
225
by Oliver Grawert
adjust the dd command for zeroing out swapfiles |
396 |
ONE_MEG=$((1024*1024)) |
|
226
by Colin Watson
Fix syntax error introduced in 1.28ubuntu9. |
397 |
size=$(($(stat -c %s ${device})/${ONE_MEG})) |
|
225
by Oliver Grawert
adjust the dd command for zeroing out swapfiles |
398 |
dd if=/dev/zero of=$device bs=${ONE_MEG} count=$size 2>/dev/null || true |
|
223
by Oliver Grawert
make zeroing swap work also with swapfiles if encrypted home is selected Bug #646421 |
399 |
else |
400 |
dd if=/dev/zero of=$device bs=16M 2>/dev/null || true |
|
401 |
fi |
|
|
202
by Evan Dandrea
Zero out swap devices at the end of install when encryption is |
402 |
fi
|
403 |
fi
|
|
404 |
done < $ROOT/etc/crypttab |
|
405 |
fi
|
|
|
109.1.1
by Colin Watson
Ask whether the user wants to set up an encrypted private directory. |
406 |
|
|
39.1.118
by Colin Watson
* Be more paranoid about clearing passwords from the cdebconf database. |
407 |
else
|
408 |
# Just in case, clear any preseeded user password from the database
|
|
409 |
# anyway.
|
|
410 |
db_set passwd/user-password-crypted ''
|
|
411 |
db_set passwd/user-password ''
|
|
412 |
db_set passwd/user-password-again ''
|
|
|
12
by Christian Perrier
Patch from Colin to split out the questions and ask them earlier. The real |
413 |
fi
|
414 |
||
415 |
exit 0
|