Releasing debian version 2.0~a4-1.
[live-config.git] / scripts / config / 002-user-setup
1 #!/bin/sh
2
3 User_setup ()
4 {
5         # Checking if package is installed or already configured
6         if [ ! -e /var/lib/dpkg/info/user-setup.list ] || \
7            [ -e /var/lib/live/config/user-setup ]
8         then
9                 return
10         fi
11
12         echo -n " user-setup"
13
14         Configure_user_setup
15 }
16
17 Configure_user_setup ()
18 {
19         # Checking if if package is already configured differently
20         if grep -q "^${LIVE_USERNAME}" /etc/passwd
21         then
22                 return
23         fi
24
25         # Default password is: live
26         # passwords can be generated with 'echo "live" | mkpasswd -s',
27         # a blank password is 'U6aMy0wojraho'.
28         _PASSWORD="8Ab05sVQ4LLps"
29
30 cat > /tmp/debconf.live << EOF
31 user-setup passwd/make-user boolean true
32 user-setup passwd/root-password-crypted string *
33 user-setup passwd/user-password-crypted string ${_PASSWORD}
34 user-setup passwd/user-fullname string ${LIVE_USER_FULLNAME}
35 user-setup passwd/username string ${LIVE_USERNAME}
36 user-setup passwd/user-uid string 999
37 EOF
38
39         debconf-set-selections < /tmp/debconf.live
40         rm -f /tmp/debconf.live
41
42         # FIXME
43         set +e
44         touch /etc/passwd-
45         chmod 0600 /etc/passwd-
46
47         /usr/lib/user-setup/user-setup-apply 2>&1 \
48         | grep -v "Shadow passwords are now on"
49         set -e
50
51         # Creating state file
52         touch /var/lib/live/config/user-setup
53 }
54
55 User_setup