post_install() {
	if [[ -f "ultimate-common" ]]; then
		source ultimate-common
		elif [[ -f "/usr/share/ultimate_edition/ultimate-common" ]]; then
		source /usr/share/ultimate_edition/ultimate-common
	else
		echo "No Ultimate Edition common source. Please install ultimate-edition-common."
		exit 1;
	fi
	FullBar

	# Detect distro and set GRUB location and update method
	GRUB_DIR='grub'
	UPDATE_GRUB=''
	BOOT_MODE='legacy'
	GRUB_THEME="Windows10"
	if [[ -d /boot/efi && -d /sys/firmware/efi ]]; then
		BOOT_MODE='UEFI'
	fi
	Encapsulate "Boot mode: ${BOOT_MODE}"
	Encapsulate 'Removing other themes from GRUB config'
	sed -i '/^GRUB_THEME=/d' /etc/default/grub
	Encapsulate 'Making sure GRUB uses graphical output'
	sed -i 's/^\(GRUB_TERMINAL\w*=.*\)/#\1/' /etc/default/grub
	Encapsulate 'Removing empty lines at the end of GRUB config' # optional
	sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' /etc/default/grub
	Encapsulate 'Adding new line to GRUB config just in case' # optional
	echo | tee -a /etc/default/grub 2&>/dev/null
	if [[ -f "/usr/share/${GRUB_DIR}/themes/${GRUB_THEME}/theme.txt" ]]; then
		Encapsulate 'Adding theme to GRUB config'
		echo "GRUB_THEME=/usr/share/${GRUB_DIR}/themes/${GRUB_THEME}/theme.txt" | tee -a /etc/default/grub 2&>/dev/null
	fi
	# Check inode of rootfs if anything other then 2 we are in a chroot environment
	# use above IUSER results to further our cause.& guarantee our success ;)
	# Inform user of current findings:
	root_inode=$(stat -c %i /);
	IUSER=${SUDO_USER:-$USER}
	HOME="/home/$IUSER"
	if [ $root_inode -ne 2 ]; then
		Encapsulate "Chroot environment detected.  Not updating Grub."
	else
		Encapsulate "We are NOT in a chroot environment. User detected as ${IUSER}"
		FullBar
		if which update-initramfs >/dev/null 2>&1; then
			update-initramfs -u
		fi
		if which grub-mkconfig >/dev/null 2>&1;	then
			grub-mkconfig -o /boot/grub/grub.cfg
		fi
	fi
	FullBar
}
post_upgrade() {
	post_install
}
