#!/bin/sh

touch /etc/hostname
echo "tuxedo" >  /etc/hostname
hostnamectl hostname tuxedo

mkdir -p /home/oem/.config/autostart/
mkdir -p /home/oem/.local/bin

cp -af /usr/share/tuxedo/xfce/oem-setup.desktop /home/oem/.config/autostart/
cp -af /usr/share/tuxedo/xfce/xdotool.sh /home/oem/.local/bin/
cp -af /usr/share/tuxedo/gnome/oem-config/calamares.rules /etc/polkit-1/rules.d/
rm -rf /home/oem/Desktop/*
cp -af /usr/share/tuxedo/xfce/lightdm.conf /etc/lightdm/lightdm.conf

mkdir -p /home/oem.config/xfce4/xfconf/xfce-perchannel-xml/
cp -af /usr/share/tuxedo/xfce/xfce4-screensaver.xml /home/oem/.config/xfce4/xfconf/xfce-perchannel-xml/

find /home/*/.config/autostart -name cryptshutdown* -delete
find /home/*/.config/autostart -name set-click* -delete
find /etc/skel/.config/autostart -name cryptshutdown* -delete
find /etc/skel/.config/autostart -name set-click* -delete
find /usr/local/bin -name cryptshutdown.sh -delete
find /usr/local/bin -name firstshutdown.sh -delete
find /usr/local/bin -name rmfirstshutdown.sh -delete

if lsblk | grep -q crypt_dev; then
    cp -af /usr/share/tuxedo/xfce/xubuntu2404/settings_crypt.conf /etc/calamares/settings.conf
else
    cp -af /usr/share/tuxedo/xfce/xubuntu2404/settings.conf /etc/calamares/settings.conf
fi

chown -R oem:oem /home/oem/
