summaryrefslogtreecommitdiff
path: root/scripts/casper-bottom/10adduser
blob: 700f8c3f1d485f6ffcd6b733bee4f759f109cf65 (plain)
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
#!/bin/sh

PREREQ=""
DESCRIPTION="Adding live session user..."

. /scripts/functions

prereqs()
{
       echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
       prereqs
       exit 0
       ;;
esac

log_begin_msg "$DESCRIPTION"

# U6aMy0wojraho is just a blank password
chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF
set passwd/root-password-crypted *
set passwd/user-password-crypted UMxWpqk1F1hww
set passwd/user-fullname $USERFULLNAME 
set passwd/username $USERNAME
set passwd/user-uid 999
EOF

chroot /root /usr/bin/env -i HOME="/root" \
       TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \
       /usr/lib/user-setup/user-setup-apply > /dev/null

# Clear out debconf database again to avoid confusing ubiquity later.
chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF
set passwd/root-password-crypted
set passwd/user-password-crypted
set passwd/user-fullname
set passwd/username
set passwd/user-uid
EOF

if [ -f /root/etc/sudoers ]; then
	if [ -x /sbin/udevplug ]; then 
		# FIXME: ugly hack, admin is not present in debian so we do here ubuntu stuff
		# XXX - awful hack to stop xscreensaver locking the screen (#7150)
		echo 'RUNNING_UNDER_GDM="yes"' >> /root/etc/environment
        grep -q '^%admin' /root/etc/sudoers && sed -i -e '/^%admin/s/ALL$/NOPASSWD: ALL/' /root/etc/sudoers || echo '%admin  ALL=(ALL) NOPASSWD: ALL' >> /root/etc/sudoers
		for file in /usr/share/applications/ubiquity-gtkui.desktop /usr/share/applications/kde/ubiquity-kdeui.desktop; do
		    if [ -f "/root/$file" ]; then
		        chroot /root install -D -o $USERNAME -g $USERNAME $file /home/$USERNAME/Desktop/$(basename "$file")
	        	break
    		fi
		done
    else # We are in debian :-)
        echo "${USERNAME}  ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers	    
    fi
fi

if [ -L /root/home/$USERNAME/Examples ]; then
    chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/
    mv /root/home/$USERNAME/Examples /root/home/$USERNAME/Desktop/
fi

log_end_msg