#!/bin/sh
[ "$(id -u)" = "0" ] || exit 1

apt-get update
apt-get --yes install kanotix-starrise-base kmenu-icon-kanotix kdm-theme-kanotix-starrise ksplash-theme-kanotix-starrise plymouth-theme-kanotix-logo grub2-splashimage-kanotix-logo plasma-widgets-addons badge-icon-kanotix etcskel-kanotix user-profile-kanotix

#apt-get --yes install kanotix-plasma-script etcskel-kanotix

perl -pi -e 's/^(GRUB_DISTRIBUTOR)=.*/\1=`[ "\$\(uname -m\)" = "x86_64" ] && echo Kanotix64 || echo Kanotix`/' /etc/default/grub
perl -pi -e 's/.*(GRUB_DISABLE_LINUX_RECOVERY)=.*/\1="true"/' /etc/default/grub
perl -pi -e 's/^(GRUB_CMDLINE_LINUX_DEFAULT)=.*/\1="quiet"/' /etc/default/grub
perl -pi -e 's/.*(GRUB_DISABLE_RECOVERY)=.*/\1="true"/' /etc/default/grub
if grep -q splash /proc/cmdline; then

# if lsmod|grep -q drm_kms_helper; then
  perl -pi -e 's/^(GRUB_CMDLINE_LINUX)=.*/\1="splash"/' /etc/default/grub
# else
#  perl -pi -e 's/^(GRUB_CMDLINE_LINUX)=.*/\1="vga=791 splash"/' /etc/default/grub
# fi
else
# if lsmod|grep -q drm_kms_helper; then
  perl -pi -e 's/^(GRUB_CMDLINE_LINUX)=.*/\1=""/' /etc/default/grub
# else
#  perl -pi -e 's/^(GRUB_CMDLINE_LINUX)=.*/\1="vga=791"/' /etc/default/grub
# fi
fi

[ -d /boot/grub ] && update-grub
