. lib/lsb/init-functions

if [ -f etc/inittab ]; then
   sed -i "s/^id:[3-5]/id:5/" etc/inittab
   log_success_msg2  "Init default set to 5 in the ${WARNING}/etc/inittab ${NORMAL}file"
fi

if [ ! -f etc/lxdm/lxdm.conf ]; then
  echo "[base]
## uncomment and set autologin username to enable autologin
# autologin=guest

## uncomment and set timeout to enable timeout autologin,
## the value should >=5
# timeout=10

## default session or desktop used when no systemwide config
# session=/usr/bin/startxfce4

## uncomment and set to set numlock on your keyboard
# numlock=0

## set this if you don't want to put xauth file at ~/.Xauthority
# xauth_path=/tmp

# not ask password for users who have empty password
# skip_password=1

## greeter used to welcome the user
greeter=/usr/libexec/lxdm-greeter-gtk

[server]
## arg used to start xserver, not fully function
# arg=/usr/bin/X -background vt1
arg=/usr/bin/X
# uncomment this if you really want xserver listen to tcp
# tcp_listen=1
# uncoment this if you want reset the xserver after logout
reset=1

[display]
## gtk theme used by greeter
gtk_theme=Clearlooks

## background of the greeter
#bg=/usr/share/backgrounds/default.png

## if show bottom pane
bottom_pane=1

## if show language select control
lang=1

## if show keyboard layout select control
keyboard=0

## the theme of greeter
theme=Industrial

[input]

[userlist]
## if disable the user list control at greeter
disable=0

## whitelist user
white=

## blacklist user
black=" > etc/lxdm/lxdm.conf
  chmod 640 etc/lxdm/lxdm.conf
  log_success_msg2  "File ${WARNING}/etc/lxdm/lxdm.conf ${NORMAL} created"
fi

SERVICE="/lib/systemd/system/lxdm.service"
if [ ! -L etc/systemd/system/display-manager.service ];then
  mkdir -p etc/systemd/system
  ln -sf $SERVICE etc/systemd/system/display-manager.service && \
  log_success_msg2  "${INFO} Created symlink /etc/systemd/system/display-manager.service -> $SERVICE${NORMAL}"
else
  ACTIVE_SERVICE="$(readlink /etc/systemd/system/display-manager.service)"
  [ "${ACTIVE_SERVICE}" != "$SERVICE" ] && \
  log_warning_msg "${WARNING} symlink /etc/systemd/system/display-manager.service -> ${ACTIVE_SERVICE} exist${NORMAL}"
fi
