#!/bin/sh
#

. /lib/live/init-config.sh

cat > /etc/lightdm/lightdm.conf <<EOF
[Seat:*]
greeter-session=lightdm-deepin-greeter
user-session=deepin
autologin-user=${LIVE_USERNAME}
autologin-user-timeout=0
EOF

# enable develop mode
mkdir -p /var/lib/deepin/developer-mode
echo -n 1 > /var/lib/deepin/developer-mode/enabled

file=/usr/share/applications/deepin-repair-tools.desktop
if [ -f "$file" ]; then
    install -d -o $LIVE_USERNAME -g $LIVE_USERNAME /home/$LIVE_USERNAME/Desktop
    install -D -o $LIVE_USERNAME -g $LIVE_USERNAME $file /home/$LIVE_USERNAME/Desktop/$(basename "$file")
fi

install -d -o $LIVE_USERNAME -g $LIVE_USERNAME /home/$LIVE_USERNAME/.config
cat > /home/$LIVE_USERNAME/.config/not_first_run_dde << EOF
Generate by deepin-installer.
Timestamp: `LC_ALL=C date`
EOF
chown $LIVE_USERNAME:$LIVE_USERNAME /home/$LIVE_USERNAME/.config/not_first_run_dde

systemctl restart lightdm
