#!/bin/bash

### Check for building a Devuan system
if [ -e /etc/devuan_version ]
   then _plymouthcfg="/usr/share/initramfs-tools/scripts/init-premount/plymouth"
	grep -B100 "mkdir -m 0755" ${_plymouthcfg}      >  ${_plymouthcfg}.new
	echo -e "\tudevadm trigger -s graphics"         >> ${_plymouthcfg}.new
	echo -e "\t udevadm settle"			>> ${_plymouthcfg}.new
	echo -e '\t[ "$quiet" = "y" ] && reset'		>> ${_plymouthcfg}.new
	echo -e '\techo "Starting PeppermintOS Devuan"'	>> ${_plymouthcfg}.new
	grep -A10 "/usr/sbin/plymouthd" ${_plymouthcfg} >> ${_plymouthcfg}.new
	echo -e ""				        >> ${_plymouthcfg}.new
	mv ${_plymouthcfg}.new ${_plymouthcfg}
	chmod +x ${_plymouthcfg}
#	plymouth-set-default-theme futureprototype --rebuild-initrd

### Fixes "No OffLine Installs" in Devuan versions.
	sed s/bullseye/chimaera/ /usr/sbin/sources-media > /tmp/sources-media
	chmod +x /tmp/sources-media && mv /tmp/sources-media /usr/sbin/sources-media

### Some Gnome-ish software only looks for machine-id in /etc/
	[ ! -e /etc/machine-id ] && ln -s /var/lib/dbus/machine-id /etc/machine-id

### Differentiate the Devuan slides from the Debian slides.
	mv /etc/calamares/branding/peppermint/slides/devuan/s*.png /etc/calamares/branding/peppermint/
	rm -rf /etc/calamares/branding/peppermint/slides/

else	mv /etc/calamares/branding/peppermint/slides/debian/s*.png /etc/calamares/branding/peppermint/
	rm -rf /etc/calamares/branding/peppermint/slides/
fi

