#!/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/mate/oem-setup.desktop /home/oem/.config/autostart/
cp -af /usr/share/tuxedo/mate/xdotool.sh /home/oem/.local/bin/

cp -af /usr/share/tuxedo/gnome/oem-config/calamares.rules /etc/polkit-1/rules.d/
cp -af /usr/share/tuxedo/mate/ubuntumate2404/tuxedo.layout /usr/share/mate-panel/layouts

rm -rf /home/oem/Desktop/*

cp -af /usr/share/tuxedo/mate/lightdm.conf /etc/lightdm/lightdm.conf

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/mate/ubuntumate2404/settings_crypt.conf /etc/calamares/settings.conf
else
    cp -af /usr/share/tuxedo/mate/ubuntumate2404/settings.conf /etc/calamares/settings.conf
fi

chown -R oem:oem /home/oem/
