#!/bin/bash

set -e

oem_mode=
if grep -q 'test-mode' /proc/cmdline; then
    oem_mode="oem-automatic"
else
    oem_mode="oem"
fi

#cp -a /usr/share/applications/kylin-os-installer.desktop /etc/xdg/autostart || echo "kylin-os-installer.desktop is unexit" >>/var/log/installer/kylin-os-installer.log
#sed -i "/Exec/d" /etc/xdg/autostart/kylin-os-installer.desktop
#echo "Exec=/usr/bin/kylin-os-installer-${oem_mode}" >>/etc/xdg/autostart/kylin-os-installer.desktop

if [[ -f /usr/share/kylin-os-installer/96-kylin-os-installer.conf ]]; then
       mv /usr/share/kylin-os-installer/96-kylin-os-installer.conf /usr/share/lightdm/lightdm.conf.d
fi

if [[ -e /usr/share/kylin-os-installer/99-ukui-installer.conf ]]; then
	mv /usr/share/kylin-os-installer/99-ukui-installer.conf /usr/share/lightdm/lightdm.conf.d
fi



if [[ -f /etc/xdg/autostart/oem-qc.desktop ]]; then
      rm -f /etc/xdg/autostart/oem-qc.desktop
fi

if [[ -f /etc/xdg/autostart/oem-unlock.desktop ]]; then
        rm -f /etc/xdg/autostart/oem-unlock.desktop
fi
if [[ -f /usr/sbin/oem-unlock ]]; then
        rm -f /usr/sbin/oem-unlock
fi

if [[ -d /home/oem ]]; then
        mkdir -p /oemback
	rsync -a /home/oem /oemback
fi


