#!/bin/bash
# ==============================================================================
# title			:ultimate-edition-core-builder
# description	:Builds Ultimate Edition core files.
# author		:theemahn <theemahn@ultimateedition.info>
# date			:05/18/2016
# version		:1.9.7
# usage			:uecorebuilder --help
# manual		:man uecorebuilder
# notes			:See change-log below for further information.
# ==============================================================================
# Change-log:
#	1.8.8:	Initial public release
#
#	1.8.9:	Internal test release.
#
#	1.9.0:	Public release, added aditional DE (Desktop Environments)
#			Added support for foreign Architectures PPC and ARM
#			Multitude of bug fixes
#
#	1.9.1	Bug fixes, added ability to set the default desktop
#			environment (DE).
#
#	1.9.2	Bug squashing release, introduced internal --BUILDALL -YES
# 			Will build all x86 and x64 based Operating systems back to back
#			with 0 user intervention. Introduction of software automation.
#
#			Ultimate Edition. Code written to not only remove malicous
#			software, but increase end user privacy.
#
#			Removed case sensitivity in command line interpreter:
#			tmosb --build ultimate-edition-4.4-x64.iso KdE MaTe LXQT awesome
#			will now work. Command line interpreter now rejects all non-
#			applicable information.
#
#			Fixed bugs in directory detection of current build,
#			souped up eyecandy Updated donors software to automously
#			generate list of donors, date they donated and amt.
#
#			Initiated the no-one left behind aspect train of thought.
#			Ultimate Edition enters the server world.
#			General server configation begins - Apache, Mysql, Wordpress
#			all command line switchabilty in the build process.
#
#			A few extra hundred O/S's it will build.
#	1.9.3:	Fixed issues with network manager applet not autoloading / working
#
#			Added initial support for Vivid Vervet (Ubuntu 15.04).
#
#	1.9.4	Added and fully implemented the build of 4.6 / 4/7 (Ubuntu Vivid)
#			Fixed ubiquity splash issues.
#			Added compiz support (autostart) into UE 4.6 / 4.7
#			Fixed gamers not working, broken wine in 15.04 - Vivid Vervet
#	1.9.5	Added new copy agent.
#			Added Ultimate Edition 4.7 & Ultimate Edition 4.8 to the mix
#
#			Repostormed pre-built "dumby" packages for anti-malware
#			inititive
#
#			Added support for Ultimate Edition 4.9
#
#	1.9.6	Added a few new toys, welcome aboard Pithos & planetfx
#			Added Support for 5.0 & 5.1 (Wily & Xerial)
#	1.9.7	Closed the gap for LTS Releases (16.04)
#	1.9.8 	bump
#			Ajusted external software in software I have written it pulls from the internet
#	1.9.9 Adjusted again the above.
#	2.0.7	Added initial support for "Jammy Jellyfish" / Ultimate Edition 7.4 & 7.5
# ==============================================================================
# Version Control

APPNAME="TheeMahn O/S Builder"
PROGNAME="internal"
VERSION="2.0.7"
BUILDDATE="12/02/2021"
WEBSITE="os-builder.com"
AUTHOR="TheeMahn"
EMAIL="<$AUTHOR@${WEBSITE}>"

source ultimate-common
mount -t proc proc /proc
txtrst='\e[0m'    # Text Reset
PREREQ="-f -y --allow-unauthenticated"

ARCH=$(getconf LONG_BIT)
if [ "${ARCH}" = "64" ]; then
	ARCH="amd64"
else
	ARCH="i386"
fi
PPC=$(uname -a | grep "ppc")
ARM=$(uname -a | grep "arm")
if [[ "$ARM" ]]; then
	ARCH="armhf"
fi
if [[ "$PPC" ]]; then
	ARCH="powerpc"
fi

# LTS Detection
if [[ -f "/etc/lsb-release" ]]; then
	ISLTS=$(grep -i "LTS" /etc/lsb-release)
	if [[ "${ISLTS}" ]]; then
		LTS="YES"
	else
	    LTS="NO"
	fi
fi
RECOMMENDS=$(echo "$@" | grep -i "recommends=")
if [[ "${RECOMMENDS}" ]]; then
	RECOMMENDS=$(echo "$@" | grep -i "recommends=" | sed "s/^.*recommends=//g" | cut -d" " -f1)
else
	# Set default recommends option as yes null if not specified. << - we can expand here ;)
	RECOMMENDS="YES"
fi
THEMEFOLDER="http://os-builder.com/themes"
ROOTFOLDER="http://os-builder.com/UETOYS"
#DEB LIST GENERATOR for TheeMahn's personal use: echo -e -n "declare -a FILELIST=("; for i in `ls *.deb`; do echo -e -n " '"; dpkg-deb --info ${i} | grep 'Package:' |cut -d: -f2 | sed 's/ //g' | tr '\n' "'"; done; echo -e " );"
#DEB LIST GENERATOR for TheeMahn's personal use: echo -e -n "declare -a FILENAMES=("; for i in `ls *.deb`; do echo -e -n " '${i}'"; done; echo -e " );"
declare -a CUSTOMPACKAGES=();
declare -a CYCLE=( "x86" "x64" "armel" "armhf" "powerpc" "powerpc-smp" "ppc64el" );
declare -a FILELIST=( 'ultimate-edition-os-builder_2.0.5_all.deb' '100-emerald-themes-0.0.1_all.deb' 'any-color-you-like-icon-theme-0.9.4_all.deb' 'apt-fast_0.0.1_all.deb' 'bin2iso_1.9-2_'${ARCH}'.deb' 'boje-themes-1.2.1-all.deb' 'ultimate-edition-conky-builder-1.32_all.deb' 'conky-fonts-0.0.2_all.deb' 'faenza-cupertino-0.0.1_all.deb' 'faenza-darker-0.0.1_all.deb' 'gimp-brushes-1.1.0_all.deb' 'gimp-scripts-2.8.0_all.deb' 'nouvegnomegray-0.0.1_all.deb' 'revolt-0.0.2_all.deb' 'tm-rename-1.0.6_all.deb' 'ultimate-cover-grabber_1.1.1-1_all.deb' 'ultimate-edition-code-cleanup_1.7.4_all.deb' 'ultimate-edition-cursors-0.0.7_all.deb' 'ultimate-edition-female-themes-1.0-all.deb' 'ultimate-edition-icons-baby-blue-0.0.1_all.deb' 'ultimate-edition-icons-dark-glass.0.0.5_all.deb' 'ultimate-edition-multi-monitor_1.7.5_all.deb' 'ultimate-edition-nas-tools_2.0.5_all.deb' 'ultimate-edition-repairtheme-1.7.3-1_all.deb' 'ultimate-edition-sound-scheme-0.0.6_all.deb' 'ultimate-edition-thumbos_1.1.2_all.deb' 'ultimate-edition-user-contributed-wallpapers-1.0_all.deb' 'zoncolor-0.0.1_all.deb' 'zoncolorbrown-0.0.1_all.deb' 'zoncolorgreen-0.0.1_all.deb' 'zoncolorgrey-0.0.1_all.deb' 'zoncolormaroon-0.0.1_all.deb' 'zoncolororange-0.0.1_all.deb' 'zoncolorpink-0.0.1_all.deb' 'zoncolorpurple-0.0.1_all.deb' 'zoncolorred-0.0.1_all.deb' 'zoncolorsilver-0.0.1_all.deb' 'zoncolorsky-0.0.1_all.deb' 'zoncolorslate-0.0.1_all.deb' 'zoncolorturquoise-0.0.1_all.deb' 'zoncolorwhite-0.0.1_all.deb' 'zoncolorxtra-faenzadarkest-0.0.1_all.deb' 'zoncolorxtra-silverfaenzadarkest-0.0.1_all.deb' 'zoncolorxtra-skyfaenzalight-0.0.1_all.deb' 'zoncolorxtra-slatefaenzalight-0.0.1_all.deb' 'pithos_1.4.1-0york1~18.04_all.deb' 'ultimate-edition-roku-ripper-all_1.0.6.deb' 'ultimate-edition-ultimate-network-optimizer-all_1.0.2.deb' );
declare -a MFILELIST=( 'ultimate-edition-os-builder_2.0.5_all.deb' 'apt-fast_0.0.1_all.deb' 'bin2iso_1.9-2_'${ARCH}'.deb' 'ultimate-edition-conky-builder-1.32_all.deb' 'conky-fonts-0.0.2_all.deb' 'tm-rename-1.0.6_all.deb' 'ultimate-cover-grabber_1.1.1-1_all.deb' 'ultimate-edition-code-cleanup_1.7.4_all.deb' 'ultimate-edition-multi-monitor_1.7.5_all.deb' 'ultimate-edition-nas-tools_2.0.5_all.deb' 'ultimate-edition-repairtheme-1.7.3-1_all.deb' 'ultimate-edition-sound-scheme-0.0.6_all.deb' 'ultimate-edition-thumbos_1.1.2_all.deb' 'ultimate-edition-roku-ripper-all_1.0.6.deb' 'ultimate-edition-ultimate-network-optimizer-all_1.0.2.deb' );
declare -a MINSTALLNAMES=( 'ultimate-edition-multi-monitor' 'ultimate-edition-nas-tools' 'ultimate-edition-ultimate-network-optimizer' );
declare -a FILELIST=( 'nvidia-ultimate-live' 'ventoy' 'conky-fonts' 'fonts-liberation' 'ultimate-edition-conky-builder' 'ultimate-edition-cursors' 'ultimate-edition-icons-dark-glass' 'ultimate-edition-sound-scheme' 'ultimate-edition-ultimate-network-optimizer' 'ultimate-edition-nas-tools' 'apt-fast' 'bashtop' 'nordvpn' 'tm-rename' 'ultimate-edition-media-server' 'ultimate-edition-os-builder' 'google-chrome' 'ultimate-edition-roku-ripper' );
declare -a INSTALLNAMES=( 'nvidia-ultimate-live_1.9_all.deb' 'ventoy-1.0.33_amd64.deb' 'conky-fonts-0.0.2_all.deb' 'fonts-liberation_1.07.4-5_all.deb' 'ultimate-edition-conky-builder-1.32_all.deb' 'ultimate-edition-cursors-0.0.7_all.deb' 'ultimate-edition-icons-dark-glass.0.0.5_all.deb' 'ultimate-edition-sound-scheme-0.0.6_all.deb' 'ultimate-edition-ultimate-network-optimizer-all_1.0.2.deb' 'ultimate-edition-nas-tools_2.0.5_all.deb' 'apt-fast_0.0.1_all.deb' 'bashtop_0.9.25-1_all.deb' 'nordvpn-release_1.0.0_all.deb' 'tm-rename-1.0.6_all.deb' 'ultimate-edition-media-server_1.3.0_amd64.deb' 'ultimate-edition-os-builder_2.0.5_all.deb' 'google-chrome-stable_current_amd64.deb' 'ultimate-edition-roku-ripper-all_1.0.6.deb' );
declare -a UETHEMES=( '2.0' '2.1' '2.2' '2.3' '2.4' '2.5' '2.6' '2.7' '2.8' '2.9' '3.0' '3.1' '3.2' '3.3' '3.4' '3.5' '3.6' '3.7' '3.8' '3.9' '4.0' '4.1' '4.2' '4.3' '4.4' '4.5' '4.6' '4.7' '4.8' '4.9' '5.0' '5.1' '5.3' '5.2' '5.4' '5.5' '5.6' '5.7' '5.8' '5.9' '6.0' '6.1' '6.2' '6.3' '6.5' '6.6' '6.7' '6.8' '6.9' '7.0' '7.1' '7.2' '7.3' );
declare -i ICONS=( 'ultimate-edition-cursors' 'ultimate-edition-icons-baby-blue' 'ultimate-edition-icons-dark-glass' 'ultimate-edition-icons-dark-glow' 'ultimate-edition-icons-dark-one' 'ultimate-edition-icons-gold' 'ultimate-edition-icons-light' 'ultimate-edition-icons-red' );
declare -a LITEPACKAGES=( "chkrootkit" "command-not-found" "viewnior" "tmosb" "dialog" "bash-completion" 'boot-repair' 'nvme-cli' 'nano' 'fonts-liberation2' 'stacer' 'inxi' 'xdg-user-dirs-gtk' 'xinit' 'xserver-xorg' 'udisks' 'gnome-disk-utility' 'broadcom-sta-common' 'ubuntu-restricted-extras' 'p7zip-full' 'alsa-oss' 'arj' 'b43-fwcutter' 'faac' 'faad' 'ffmpeg2theora' 'flac' 'fslint' 'ftp' 'gftp' 'gimp' 'gnome-codec-install' 'wavpack' 'preload' 'pidgin-plugin-pack' 'gstreamer-tools' 'unrar' 'mppenc' 'gstreamer0.10-plugins-ugly' 'vorbis-tools' 'pidgin-extprefs' 'pidgin-themes' 'xvid4conf' 'gtkpod' 'id3v2' 'hardinfo' 'python-chm' 'gstreamer0.10-plugins-bad-multiverse' 'soundkonverter' 'vorbisgain' 'isomaster' 'brasaro' 'phatch' 'gnupod-tools' 'pidgin-guifications' 'oss-compat' 'simplescreenrecorder' 'rar' 'phatch-cli' 'cabextract' 'gstreamer0.10-fluendo-mp3' 'pidgin' 'wifi-radar' 'mpg321' 'ntfs-config' 'winbind' 'xnest' 'unace' 'htop' 'lintian' 'linux-firmware-nonfree' 'youtube-dl' 'qemuctl' 'qemubuilder' 'broadcom-sta-common' 'terminator' 'vlc' 'gdebi' 'samba' 'clementine' 'mediainfo' 'system-config-samba' 'synaptic' 'xscreensaver-gl-extra' 'xscreensaver-data-extra' 'dconf-tools' 'qdbus' 'gtk3-engine*' 'transmission-gtk' 'firefox' 'hddtemp' 'libreoffice' 'ubuntu-restricted*' 'flashplugin-installer' 'ffmpegthumbnailer' 'stacer' 'mkvtoolnix' 'mkvtoolnix-gui' 'mc' 'gerbera' "pithos" );
declare -a FULLPACKAGES=( "chkrootkit" "command-not-found" 'grub-customizer' "viewnior" "tmosb" "lynis" "dialog" "bash-completion" 'tcpdump' 'boot-repair' 'nvme-cli' 'grub-customizer' 'mp3blaster' 'nano' 'dialog' 'inxi' 'apt-utils' 'liberation-ttf' 'fonts-liberation2' 'net-tools' 'shellcheck' 'xdg-user-dirs-gtk' 'xinit' 'xserver-xorg' 'aisleriot' 'alien' 'alsa-oss' 'arj' 'aspell' 'b43-fwcutter' 'bc' 'bchunk' 'binutils' 'bootchart' 'broadcom-sta-common' 'build-essential' 'bum' 'bzip2' 'bzr' 'cabextract' 'cairo-clock' 'ccd2iso' 'cdparanoia' 'cdrdao' 'cervisia' 'checkgmail' 'webcamoid' 'clamav' 'clamav-freshclam' 'clamtk' 'clementine' 'cmake' 'cvs' 'dconf-tools' 'dctrl-tools' 'debootstrap' 'devede' 'devscripts' 'dh-buildinfo' 'dvdrip' 'dvdrip-utils' 'dvd-slideshow' 'dvdstyler' 'dvgrab' 'entagged' 'faac' 'faad' 'fakeroot' 'fancontrol' 'ffmpeg2theora' 'file-roller' 'flac' 'fslint' 'f-spot' 'ftp' 'gdebi-gtk' 'genisoimage' 'gftp' 'gimp' 'git' 'gnome-codec-install' 'gpp' 'gstreamer0.10-fluendo-mp3' 'gstreamer0.10-plugins-bad-multiverse' 'gstreamer0.10-plugins-ugly' 'gstreamer-tools' 'simplescreenrecorder' 'hardinfo' 'hddtemp' 'htop' 'icedtea-8-plugin' 'id3v2' 'imagination' 'isomaster' 'k3b' 'k3b-extrathemes' 'k3d' 'kdeartwork-emoticons' 'kdemultimedia-kio-plugins' 'kdenlive' 'kino' 'kolourpaint4' 'kompare' 'kopete' 'kopete-message-indicator' 'krita' 'ksnapshot' 'ktorrent' 'kvirc' 'libk3b6-extracodecs' 'lintian' 'linux-firmware-nonfree' 'lives' 'lynx' 'mdf2iso' 'mediainfo' 'medit' 'mkvtoolnix' 'mp3gain' 'mpg321' 'mppenc' 'ndisgtk' 'nrg2iso' 'ntfs-config' 'oss-compat' 'oxygen-cursor-theme-extra' 'p7zip' 'p7zip-full' 'phatch' 'phatch-cli' 'preload' 'python-chm' 'python-lxml' 'python-numpy' 'python-pyexiv2' 'python-renderpm' 'python-uniconvertor' 'python-wxversion' 'qemu' 'qemubuilder' 'qemuctl' 'qemu-launcher' 'rar' 'recordmydesktop' 'ripoff' 'samba' 'sound-juicer' 'soundkonverter' 'squashfs-tools' 'subversion' 'synaptic' 'system-config-samba' 'terminator' 'transmission-gtk' 'tvtime' 'ubuntu-dev-tools' 'unace' 'unrar' 'videotrans' 'vlc' 'vorbisgain' 'vorbis-tools' 'wavpack' 'wifi-radar' 'winbind' 'wireshark' 'xcftools' 'xscreensaver-data-extra' 'xscreensaver-gl-extra' 'xvid4conf' 'firefox' 'libreoffice' 'ubuntu-restricted*' 'filezilla' 'ffmpegthumbnailer' 'stacer' 'mkvtoolnix' 'mkvtoolnix-gui' 'kodi' 'clementine' 'mc' 'gerbera' 'simplescreenrecorder' "pithos" );
declare -a GAMERSPACKAGES=( "chkrootkit" "command-not-found" "viewnior" "dialog" "bash-completion" 'lutris' 'nvme-cli' 'nano' 'dialog' 'fonts-liberation2' 'inxi' 'apt-utils' 'xdg-user-dirs-gtk' 'xinit' 'xserver-xorg' 'broadcom-sta-common' 'ubuntu-restricted-extras' 'p7zip-full' 'alsa-oss' 'arj' 'b43-fwcutter' 'bzip2' 'conky-all' 'preload' 'gstreamer-tools' 'unrar' 'gstreamer0.10-plugins-ugly' 'xvid4conf' 'gstreamer0.10-plugins-bad-multiverse' 'rar' 'gstreamer0.10-fluendo-mp3' 'ntfs-config' 'broadcom-sta-common' 'terminator' 'vlc' 'gdebi' 'samba' 'system-config-samba' 'gtk3-engine*' 'firefox' 'childsplay' 'capitalism' 'billard-gl' 'chromium-bsu' 'scummvm' 'spring' 'dreamchess' 'warzone2100' 'defendguin' 'xboard' 'djl' 'scorched3d' 'enigma' 'gnome-games' 'armagetronad' 'gelide' 'pax-britannica' 'bastet' 'ninvaders' 'pacman4console' 'nsnake' 'greed' 'bsdgames' 'moon-buggy' 'steam' 'supertuxkart' 'neverball' 'simplescreenrecorder' "pithos" ) ;
declare -a MINIMALPACKAGES=( "auditd" "chkrootkit" "command-not-found" "lynis" "dialog" "bash-completion" 'tcpdump' 'nvme-cli' 'mp3blaster' 'nano' 'dialog' 'awstats' 'fail2ban' 'inxi' 'nload' 'bmon' 'slurm' 'bwm-ng' 'cbm' 'speedometer' 'netload' 'vnstat' 'ifstat' 'dstat' 'collectl' 'iftop' 'iptraf' 'tcptrack' 'pktstat' 'netwatch' 'trafshow' 'shellcheck' 'openssh-client' 'lamp-server^' 'nfs-server' 'nfs-client' 'smbclient' 'phpmyadmin' 'ssh' 'apache2' 'vsftpd' 'libapache2-mod-security2' 'libapache2-modsecurity' 'libapache2-mod-evasive' 'mc' 'gerbera' );
declare -a SERVERPACKAGES=( "auditd" "chkrootkit" "webmin" "command-not-found" "lynis" "dialog" "bash-completion" 'awstats' 'tcpdump' 'nvme-cli' 'grub-customizer' 'mp3blaster' 'nano' 'dialog' 'fail2ban' 'stacer' 'inxi' 'apt-utils' 'nload' 'bmon' 'slurm' 'bwm-ng' 'cbm' 'speedometer' 'netload' 'vnstat' 'ifstat' 'dstat' 'collectl' 'iftop' 'iptraf' 'tcptrack' 'pktstat' 'netwatch' 'trafshow' 'shellcheck' 'openssh-client' 'lamp-server^' 'nfs-server' 'nfs-client' 'smbclient' 'phpmyadmin' 'ssh' 'apache2' 'vsftpd' 'libapache2-mod-security2' 'libapache2-modsecurity' 'libapache2-mod-evasive' 'liberation-ttf' 'net-tools' 'mysql-server' 'phpmyadmin' 'ssh' 'apache2' 'vsftpd' 'php' 'php7' 'libapache2-mod-php7' 'php7-mcrypt' 'libapache2-mod-security2' 'letsencrypt' 'udisks' 'gnome-disk-utility' 'gnome-themes-standard' 'broadcom-sta-common' 'ubuntu-restricted-extras' 'p7zip-full' 'alien' 'alsa-oss' 'arj' 'b43-fwcutter' 'bchunk' 'binutils' 'bootchart' 'build-essential' 'bum' 'bzip2' 'bzr' 'cvs' 'faac' 'faad' 'fakeroot' 'ffmpeg2theora' 'flac' 'fslint' 'ftp' 'genisoimage' "filezilla" 'gnome-codec-install' 'wavpack' 'preload' 'gstreamer-tools' 'debootstrap' 'unrar' 'mppenc' 'gstreamer0.10-plugins-ugly' 'vorbis-tools' 'xvid4conf' 'id3v2' 'hardinfo' 'patchutils' 'python-chm' 'gstreamer0.10-plugins-bad-multiverse' 'dh-buildinfo' 'vorbisgain' 'squashfs-tools' 'gnome-themes-extras' 'tidy' 'oss-compat' 'devscripts' 'simplescreenrecorder' 'rar' 'cabextract' 'gstreamer0.10-fluendo-mp3' 'wireshark' 'ubuntu-dev-tools' 'wifi-radar' 'mpg321' 'gnome-icon-theme-nuovo' 'ntfs-config' 'sysinfo' 'winbind' 'xnest' 'unace' 'htop' 'lintian' 'linux-firmware-nonfree' 'broadcom-sta-common' 'terminator' 'vlc' 'gdebi' 'samba' 'mediainfo' 'system-config-samba' 'synaptic' 'dconf-tools' 'git' 'subversion' 'cmake' 'qdbus' 'gtk3-engine*' 'hddtemp' 'ubuntu-restricted*' 'openvpn' 'certbot' 'network-manager-pptp-gnome' 'network-manager-openvpn-gnome' 'ethtool' 'iperf3' 'mc' 'lftp' 'openvpn' 'ca-certificates' 'gerbera' 'libxml-dumper-perl' 'ipmitool' 'mailutils' );
declare -a EXTRAPACKAGES=( "chkrootkit" "command-not-found" "viewnior" "dialog" "bash-completion" "mate-system-monitor" "caja" "pluma" "engrampa" "caja-actions" "caja-admin" "caja-eiciel" "caja-extensions-common" "caja-gtkhash" "caja-image-converter" "caja-open-terminal" "caja-rename" "caja-seahorse" "caja-sendto" "caja-share" "caja-wallpaper" "caja-xattr-tags" "terminator" "filezilla" "gdebi" "unrar" "clementine" 'gerbera' "pithos" );
declare -a DEVELOPMENTPACKAGES=( "virtualbox" "chkrootkit" "alien" "command-not-found" "bash-builtins" "bash-doc" 'genisoimage' 'fakeroot' 'binutils' 'bootchart' 'bum' 'bzip2' 'bzr' 'patchutils' "viewnior" "inxi" "htop" "terminator" "clementine" "tmosb" "lynis" "dialog" "bash-completion" 'qtcreator' 'qt5-doc' 'qt5-doc-html qtbase5-doc-html' 'qtbase5-examples' 'qtdesigner' 'bluefish' 'boot-repair' 'tidy' 'nvme-cli' 'grub-customizer' 'ubuntu-dev-tools' 'nano' 'dialog' 'build-essential' 'git' 'subversion' 'cmake' 'vim' 'codelite' 'codeblocks' 'codeblocks-contrib' 'geany' 'kate' 'qt5-designer' 'qt5-make' 'qt4-designer' 'qt4-qmake' 'devscripts' 'dh-buildinfo' 'codium' 'gambas2' 'gambas3' 'qt5-default' 'qttools5-dev-tools' 'golang-go' 'gimp' );
#declare -a DEVELOPMENTPACKAGES=( "build-essential" 'git' 'subversion' 'cmake' 'code' 'vim' 'atom' 'gedit' 'bluefish' 'codelite' 'codeblocks' 'codeblocks-contrib' 'geany' 'kate' 'qt4-designer' 'qt4-qmake' 'devscripts' 'build-essential' 'dh-buildinfo' );
declare -a FFPREFS=( '7qdy7sjf.default' 'q2l51o82.default' )
declare -a WINEVERSIONS=( 'winehq-stable' 'winehq-development' 'wine-stable' 'wine-development' );

# OPEN A CAN OF WORMS? - Writing software again.  Was it worth it?  Don't know yet still writing.  We are going to dig to the bottom, this will open up Architectures.
declare -a ABSOLUTE=( "libglib2.0-bin" "wget" );
declare -a HOLDPACKAGES=( "gnome-terminal" "gnome-session-bin" "gnome-shell" "fonts-noto*" "snap" "snapd" "mate-user-guide" "fluid-soundfont-gm" "calibre" );


LIQUORIX=$(echo "$*" | grep -i 'LIQUORIX')

# On the event of crash or exit
finish () {
  apt-get autoremove -f -y
  UNHOLD=$(apt-mark unhold fonts-noto* snap snapd mate-user-guide fluid-soundfont-gm calibre)
  apt-get clean
  apt-get autoclean
  #HOLD=$(apt-mark unhold snapd)
  #apt-get remove --purge fonts-noto* snap snapd mate-user-guide fluid-soundfont-gm calibre kodi ultimate-edition-theme-2* ultimate-edition-theme-3* ultimate-edition-theme-4* ultimate-edition-theme-5* openjdk-11-jre-headless fonts-roboto-unhinted java-common kodi-bin kodi-data kodi-repository-kodi kodi-visualization-spectrum kodi-x11 libatk-wrapper-java libatk-wrapper-java-jni libbsh-java libcec4 libcrossguid0 libfstrcmp0 libhsqldb-java libjs-iscroll libmicrohttpd12 libp8-platform2 libpython2.7 libservlet-api-java python-olefile python-pil python-pycryptodome squareness
}

#Work in progress...
InstallIcons () {
	for EACH in "${ICONS[@]}"
	do
		echo "NOT IMPLEMENTED YET."
	done
}

# LTS Detection
if [[ -f "/etc/lsb_release" ]]; then
	ISLTS=$(grep -i "LTS" /etc/lsb_release)
	if [[ "${ISLTS}" ]]; then
		LTS="YES"
	fi
fi

if ! [[ "$LTS" ]]; then
    if [[ -f "/etc/lsb-release" ]]; then
	    ISLTS=$(grep -i "LTS" /etc/lsb-release)
	    if [[ "${ISLTS}" ]]; then
	    	LTS="YES"
	    fi
    fi
fi

# Broken in 64 bit, we may as well just rectify the situation.  Not my fucking job, damn GAMERS lol.
WineUp () {
    # fix it has failed. prior
    ISSUE=$(dpkg --add-architecture i386)
    # refresh sources
    Encapsulate "Refreshing sources"
    apt-get update 2>/dev/null & Spinner "Refreshing sources"

    Encapsulate "LTS: $LTS"

    declare -a WINEVERSIONS=( 'wine-stable' 'winehq-stable' 'winehq-unstable' 'wine-unstable' 'wine-development' );
    declare -a STABLEWINE=( 'winehq-stable' 'wine-stable' );
    declare -a UNSTABLEWINE=( 'winehq-unstable' 'wine-unstable' 'wine-development' );

    # test installation first
    for EACH in "${WINEVERSIONS[@]}"
    do
        ISINSTALLED=$((dpkg-query -l "${EACH}" | grep "ii")2>/dev/null)
        if [[ "${ISINSTALLED}" ]]; then
            INSTALLED=1
            break;
        fi
    done
    if [[ "${INSTALLED}" != "1" ]]; then
        if [[ "$LTS" == "YES" ]]; then
            for EACH in "${STABLEWINE[@]}"
            do
                ISAVAILIBLE=$(apt-cache search "${EACH}" 2>/dev/null)
                if [[ "${ISAVAILIBLE}" ]]; then
                    Encapsulate "Stable Wine version availible: ${EACH}"
                    TOINSTALL="${EACH}"
                fi
            done
        else
            for EACH in "${UNSTABLEWINE[@]}"
            do
                ISAVAILIBLE=$(apt-cache search "${EACH}" 2>/dev/null)
                if [[ "${ISAVAILIBLE}" ]]; then
                    Encapsulate "Unstable Wine version availible: ${EACH}"
                fi
            done
        fi
    else
        Encapsulate "Wine has already been installed."
    fi
    if [[ "${INSTALLED}" != "1" ]]; then
        if [[ "${TOINSTALL}" ]]; then
            Encapsulate "Installing: ${TOINSTALL}"
			Encapsulate "Add recommended packages: ${RECOMMENDS^^}"
			FullBar
            if [[ "${RECOMMENDS^^}" == "NO" ]]; then
				apt-get install -y -f --allow-unauthenticated --no-install-recommends "${TOINSTALL}"
			else
				apt-get install -y -f "${TOINSTALL}"
			fi
        else
            Error "No wine version to install."
        fi
    fi
	if [[ -f "/usr/share/doc/wine/examples/wine.desktop" ]]; then
		Encapsulate "Setting wine as default extension for exe based applications."
		cp /usr/share/doc/wine/examples/wine.desktop /usr/share/applications/
	fi
	ISAVAILIBLE=$(apt-cache search "lutris" 2>/dev/null)
	if [[ "${ISAVAILIBLE}" ]]; then
		Encapsulate "Installing Lutris"
		Encapsulate "Add recommended packages: ${RECOMMENDS^^}"
		FullBar
		if [[ "${RECOMMENDS^^}" == "NO" ]]; then
			apt-get install -y -f --allow-unauthenticated --no-install-recommends "lutris"
		else
			apt-get install -y -f "lutris"
		fi
	else
		Error "Lutris is not availible and will not be installed."
	fi
}

SETDEFAULT=$(echo "$*" | grep -i "defaultde=")
if [[ "${SETDEFAULT}" ]]; then
	DEFAULTDE=$(echo "$*" | grep -i 'defaultde=' | sed 's/^.*defaultde=//g' | cut -d' ' -f1)
	DEFAULTDE=$(echo "${DEFAULTDE}" | tr '[:lower:]' '[:upper:]')
else
	if [[ -f "DEFAULTDE=" ]]; then
		DEFAULTDE=$(cat /tmp/DE)
	fi
fi
DEBUG=$(echo "$*" | grep -i "debug")
if [[ "${DEBUG}" ]]; then
	echo "DEBUGGING: 1:${1} 2:${2} 3:$3 4:$4 5:$5 6:$6 7:$7 *:$*"
fi

if [[ "${RECOMMENDS}" ]]; then
	Encapsulate "Recommends specified as: ${RECOMMENDS}"
else
	RECOMMENDS="YES"
	Encapsulate "Recommends set at: ${RECOMMENDS}"
fi
Timer "Start"

# Prevent installation of naughty packages.
HoldM () {
	if ! [[ -f "/etc/apt/preferences" ]]; then
		touch "/etc/apt/preferences"
	else
		Encapsulate "/etc/apt/preferences exists:"
		cat "/etc/apt/preferences"
	fi
	for HOLDPACKAGE in "${HOLDPACKAGES[@]}"
	do
		Encapsulate "Holding: ${HOLDPACKAGE}"
		echo "Package: ${HOLDPACKAGE}" >> "/etc/apt/preferences"
		echo "Pin: release *" >> "/etc/apt/preferences"
		echo "Pin-Priority: -1" >> "/etc/apt/preferences"
		echo " " >> "/etc/apt/preferences"
		HOLD=$(apt-mark hold "${HOLDPACKAGES[@]}")
	done
	MESSAGE=$(apt-mark showhold)
	Encapsulate "Held packages: ${MESSAGE}"
}

DisableIPV6 () {
	Center "Disabling IPV6 Protocol."
	if [[ -d "/proc/sys/net/ipv6/conf/" ]]; then
    	sysctl -w net.ipv6.conf.all.disable_ipv6=1 >&2
	    sysctl -w net.ipv6.conf.default.disable_ipv6=1 >&2
	    sysctl -w net.ipv6.conf.lo.disable_ipv6=1 >&2
	fi
	FullBar
	Encapsulate "Refreshing sysctl"
	sysctl --system
}

EnableIPV6 () {
	Center "Enabling IPV6 Protocol."
	if [[ -d "/proc/sys/net/ipv6/conf/" ]]; then
    	sysctl -w net.ipv6.conf.all.disable_ipv6=0 >&2
	    sysctl -w net.ipv6.conf.default.disable_ipv6=0 >&2
	    sysctl -w net.ipv6.conf.lo.disable_ipv6=0 >&2
	fi
	FullBar
	Encapsulate "Refreshing sysctl"
	sysctl --system
}

BlueToothBug () {
    INSTALLED=$((dpkg-query -l "blueman" | grep "iF")2>/dev/null)
    FTO="/var/lib/dpkg/info/blueman.postinst"
    if [[ "${INSTALLED}" ]]; then
        Encapsulate "Blueman (Bluetooth app) is broken rectifying: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878814"
        if [[ -f "$FTO" ]]; then
            sed -i "s/set/#set/g" "${FTO}"
            apt-get install -f -y
            INSTALLED=$((dpkg-query -l "blueman" | grep "ii")2>/dev/null)
            if [[ "${INSTALLED}" ]]; then
                Encapsulate "Blueman (Bluetooth app) is fixed. You are welcome ;)"
            else
                Error "Fixed failed."
            fi
        fi
    fi
}

# Set a timer to display duration of download (s)
# Usage:  Timer [start|stop]
DownloadTimer () {
   	Tcmd="${1^^}"

    case "$Tcmd" in
        START) _SSecs=$(date +%s)
            ;;
        STOP) _StSecs=$(date +%s)
                [[ ! $_SSecs ]] && Error "[Internal Error] Timer did not record a start time." && return
                (( _DSecs=_StSecs-_SSecs ))
                DLAPSE=$(date -u -d@"$_DSecs" +"%-Hh%-Mm%-Ss")
            ;;
        *) Error "[Internal Error] Unknown arg ${Tcmd}"
            ;;
    esac
	TOTALTIME+="$_DSecs"
}

# Incorporated new features to allow support for all architectures...
Builddeb () {
	Encapsulate "Building deb: ${1}"
	FOLDER="${1%%.deb}"
	dpkg --build "${FOLDER}" 2>/dev/null
	FILE="${1}.deb"
	if [[ -f "${FILE}" && -d "${1}/" ]]; then
		Encapsulate "Cleaning up."
		rm -R "${1:?/}" 2>/dev/null
	fi
}

KernelSanders () {
	# We are going to build a database of Linux kernels on a large scale.  Tripple nested array.
	declare -a KERNELTYPES=( "generic" "lowlatency" );  # Start simple
	for EACH in "${KERNELTYPES[@]}"
	do
		GREPIT=$(echo "$*,," | grep "${EACH}")
		if [[ "${GREPIT}" ]]; then
			SELECTEDTYPE="${EACH}"
		fi
	done
	if [[ "${SELECTEDTYPE}" ]]; then
		Encapsulate "User has requested: ${SELECTEDTYPE}"
	fi
	declare -a LATESTKERNEL=(); # Create an array to store the latest of each type.
	declare -a REPOSITORIES=(); # Let's not piss around, multiple sources.
	declare -a INSTALLCOMMAND=(); # Command that will be used to install the Kernel & dependancies.
	declare -a INSTALLSHELL=(); # Selected kernel
	INDEX=0 # Reset the index
	for EACH in "${KERNELTYPES[@]}"
	do
		(( INDEX = INDEX +1 ))
		LATESTKERNEL[${INDEX}]=$(apt-get install linux-image-*-"${EACH}" 2> /dev/null | tail -1 | cut -d ":" -f3 | cut -d " " -f2 | sed "s/linux-image//g")
		INSTALLCOMMAND[${INDEX}]="apt-get install -f -y --allow-unauthenticated linux-{image,headers,modules}${LATESTKERNEL[${INDEX}]}"
		INSTALLSHELL[${INDEX}]="${LATESTKERNEL[${INDEX}]}"
	done
	if [[ "${INDEX}" -gt 1 ]]; then
		INDEX=0 # Reset the Index.
		Encapsulate "Information found:"
		for EACH in "${LATESTKERNEL[@]}"
		do
			(( INDEX = INDEX +1 ))
			Encapsulate "linux-image${EACH} found installation command: ${INSTALLCOMMAND[${INDEX}]}"
			if [[ "${SELECTEDTYPE}" ]]; then
				GREPIT=$(echo "${EACH}" | grep -i "${SELECTEDTYPE}")
			fi
			if [[ "${GREPIT}" ]]; then
				Encapsulate "Installing: ${INSTALLCOMMAND[${INDEX}]}, please wait..."
				INSTALLIT=$(apt-get install -f -y --allow-unauthenticated linux-{image,headers,modules}${LATESTKERNEL[${INDEX}]} dkms bcmwl-kernel-source)
			fi
		done
	else
		Error "No Kernel found."
	fi
}

Extractdeb () {
	FILE="${1}"
	FOLDER="${FILE%%.deb}"
	#Toss a little eye candy
	FullBar
	Center "Beginning extraction of ${FILE}"
	Encapsulate "to ${FOLDER}/"
	ar x "${FILE}" >> "${CURRENT}/ar.log" 2>&1
	mkdir -p "${FOLDER}/DEBIAN/"

	if [[ -f "control.tar.gz" ]]; then
		mv control.tar.gz "${FOLDER}/DEBIAN/"
	else
		echo -e "${txtred}Error: No control files in deb: ${FILE}${txtrst}"
		exit 1;
	fi

	if [[ -d "${FOLDER}/DEBIAN/" ]]; then
		cd "${FOLDER}/DEBIAN/" || exit 1
	else
		Error "Not a Debian file, exiting..."
		exit 1;
	fi

	Encapsulate "Extracting Control files from ${FILE}"
	echo "Extracting Control files from ${FILE}" >> "${CURRENT}/tar.log"
	tar xfv control.tar.gz >> "${CURRENT}/tar.log" 2>&1
	rm control.tar.gz 2>/dev/null

	if [[ -d "${CURRENT}" ]]; then
		cd "${CURRENT}" || exit 1;
	else
		Error "Critical Error: No ${CURRENT}/  DEBUG: We are in ${PWD}"
	fi

	if [[ -f "data.tar.gz" ]]; then
		mv data.tar.gz "${FOLDER}/"
	fi

	if [[ -f "data.tar.xz" ]]; then
		mv data.tar.xz "${FOLDER}/"
	fi

	if ! [[ -f "${FOLDER}/data.tar.gz" || "${FOLDER}/data.tar.xz" ]]; then
		Error "Error: No data files in deb: ${FILE}"
		exit 1;
	fi

	if [[ -d "${FOLDER}" ]]; then
		cd "${FOLDER}" || exit 1;
	else
		Error "Critical Error: No ${FOLDER}/  DEBUG: We are in ${PWD}"
		exit 1;
	fi

	Encapsulate "Extracting data files from ${FILE}"
	echo "Extracting data files from ${FILE}" >> "${CURRENT}/tar.log"
	if [[ -f "data.tar.gz" ]]; then
		tar xfv "data.tar.gz" >> "${CURRENT}/tar.log" 2>&1
		rm "data.tar.gz" 2>/dev/null
	else
		tar xfv "data.tar.xz" >> "${CURRENT}/tar.log" 2>&1
		rm "data.tar.xz" 2>/dev/null
	fi

	if [[ "${CURRENT}" ]]; then
		cd "${CURRENT}" || exit 1;
	else
		Error "Critical Error: No ${CURRENT}/  DEBUG: We are in ${PWD}"
	fi

	if [[ -f "debian-binary" ]]; then
		rm "debian-binary" 2>/dev/null
	fi

	if [[ -f "tar.log" ]]; then
		rm "tar.log" 2>/dev/null
	fi

	if [[ -f "ar.log" ]]; then
		rm "ar.log" 2>/dev/null
	fi
}

DarkenUbuiquity () {
    Ultimate=$(lsb_release -a | grep -i 'Ultimate')
    Convert=$(type -p convert)
    VersionDump
    if ! [[ "$Convert" ]]; then
        Encapsulate "Installing Convert."
        apt-get install -f -y imagemagick
    fi
    Center "TESTING: We are testing function DarkenUbiquity"
    # bust out an array, I am used to them changing things w/o thought of other programmers / O/S developers.  Makes it easier to wipe out thier decisions. Inform the enduser.
    Encapsulate "I am used to infinite wisdom (Ubuntu) making changes with disregard.  See code Function DarkenUbuiquity in tmmount."
    declare -a UbiquityImages=( "/usr/share/ubiquity/qt/images/main.png" "/usr/share/ubiquity/qt/images/breadcrumb_ltr.png" "/usr/share/ubiquity/qt/images/breadcrumb_rtl.png" );
    UbiquityLogo="/usr/share/ubiquity/qt/images/branding.svgz"
    for EACH in "${UbiquityImages[@]}"
    do
        if [[ -f "${EACH}" ]]; then
            Encapsulate "File: ${EACH} exists, converting to a dark theme with transparency."
            Encapsulate "If you want to complain about this dirty hack, please file a bug with Ubiquity and their lack of supporting dark themes since 2014."
            Encapsulate "I no longer file bug reports.  I fix or work around them as in this case."
            Encapsulate "Bug info: https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1343651"
        fi
    done
    if [[ -f "$UbiquityLogo" && "$Ultimate" ]]; then
        Encapsulate "Theme based logo found & Ultimate Edition based O/S, please wait logo stamping..."
        if [[ -f "/usr/share/ultimate_edition/logo.svgz" ]]; then
            Encapsulate "Logo detected, replacing with Ultimate Edition Logo."
            cp "/usr/share/ultimate_edition/logo.svgz" "$UbiquityLogo"
        fi
    fi
}

# Scans and sets KDE splash via various resolutions
KDESPLASH () {
	INFOLDER="${PWD}"
	RESOLUTIONS=( "1024x768" "1280x1024" "1280x800" "1366x768" "1440x900" "1600x1200" "1680x1050" "1920x1080" "1920x1200" "2560x1440" "2560x1600" "3200x1800" "3200x2000" "3840x2160" "5120x2880" );
	if [[ "${DISTREL}" ]]; then
		Encapsulate "Version detected as: ${DISTREL}"
	else
		Error "Version not detected. Exiting."
		exit 1;
	fi

    SOURCEFILE="/usr/share/wallpapers/Ultimate_Edition_${DISTREL}.png"
	DESTFOLDER="/usr/share/kde4/apps/ksplash/Themes/Default/"
    if [[ -f "/usr/share/sddm/themes/breeze/components/artwork/background.png" ]]; then
        Encapsulate "Newer version of KDE detected. Setting up as required."
        DESTFOLDER="/usr/share/sddm/themes/breeze/components/artwork/"
        cd "${DESTFOLDER}" || exit 1;
        STRIPPEDSLASH="background.png"
        Encapsulate "Converting image ${SOURCEFILE} in ${PWD} to 3840×2160! to ${DESTFOLDER}${STRIPPEDSLASH}"
        convert "${SOURCEFILE}" -resize 3840x2160! -quality 100 -strip "${DESTFOLDER}${STRIPPEDSLASH}"
        Encapsulate "Success, exiting."
        exit 0;
    fi
	CONVERSION=$(type -p convert)
	DESTFOLDER="/usr/share/wallpapers/Ultimate_Edition_${DISTREL}/contents/"
	if [[ "${SOURCEFILE}" ]]; then
		if ! [[ -d "/usr/share/wallpapers/Ultimate_Edition_${DISTREL}/contents/images/" ]]; then
			Encapsulate "Creating Wallpaper Folder."
			mkdir -p "/usr/share/wallpapers/Ultimate_Edition_${DISTREL}/contents/images/"
		fi
	fi
	if [[ "${CONVERSION}" && -f "${SOURCEFILE}" && -d "${DESTFOLDER}" ]]; then
		Encapsulate "Copying Wallpaper: ${SOURCEFILE} to ${DESTFOLDER}/screenshot.png."
		cp "${SOURCEFILE}" "${DESTFOLDER}/screenshot.png"
	    cd "${DESTFOLDER}" || exit 1;
		SOURCEFILE="screenshot.png"
		DESTFOLDER="images/"
	    for EACH in "${RESOLUTIONS[@]}"
	    do
			if ! [[ -f "${DESTFOLDER}/${EACH}.jpg" ]]; then
		        Encapsulate "Converting image ${SOURCEFILE} at ${PWD} to ${DESTFOLDER}/${EACH}.jpg"
		        convert "${SOURCEFILE}" -resize "${EACH}!" -quality 100 -strip "${DESTFOLDER}/${EACH}.jpg"
			fi
	    done
{
		echo '[Desktop Entry]'
		echo "Name=Ultimate_Edition_${DISTREL}"
		echo "Name[en_GB]=Ultimate_Edition_${DISTREL}"
		echo ''
		echo "X-KDE-PluginInfo-Name=Ultimate_Edition_${DISTREL}"
		echo 'X-KDE-PluginInfo-Author=Glenn Cady'
		echo 'X-KDE-PluginInfo-Email=theemahn@gmail.com'
		echo 'X-KDE-PluginInfo-License=GPL2.0'
}  > metadata.desktop
	    Center "Ksplash will be themed in ${DISTREL}"
	else
	    if ! [[ "$CONVERSION" ]]; then
	    	Error "Imagemagick is not installed, ksplash will not be themed."
	    fi
	    if ! [[ "${SOURCEFILE}" ]]; then
	    	Error "Ultimate Edition ${DISTREL} theme is not installed."
	    fi
	    if ! [[ "${DESTFOLDER}" ]]; then
	    	Error "Ksplash has not been installed, or has not been programmed. Not themeing."
	    fi
	    Error "Ksplash will not be themed."
    fi
    if [[ -d "${INFOLDER}" ]]; then
    	cd "${INFOLDER}" || exit 1;
    fi
    if [[ "${DISTREL}" ]]; then
        DarkenUbuiquity
    fi
}

EXIT () {
	if [[ -f "/usr/lib/ubiquity/apt-setup/generators/40cdrom" ]];then
		Encapsulate "Removing apt-cdrom."
		FullBar
		rm "/usr/lib/ubiquity/apt-setup/generators/40cdrom"
		UNHOLD=$(apt-mark unhold fonts-noto* snapd mate-user-guide fluid-soundfont-gm calibre)
		#UNHOLD=$(apt mark unhold snapd)
	fi
#rm /etc/resolv.conf
#rm /var/lib/apt/extended_states
#rm /var/crash/*
#BAIL OUT
	Encapsulate "Unmounting..."
	umount -f /proc/sys/fs/binfmt_misc > /dev/null 2>&1
#Lazily umount -l device
#umount /proc
#umount /sys
#umount /dev/pts
	for D in $(mount | sed 's/.*on \(\/.\+\) type.*/\1/'); do echo -e -n "\\e[0;32mUNMOUNTING $D..."; umount -l "$D"; echo -e " [DONE]\\e[0m"; > /dev/null 2>&1 || echo -e "\\e[1;31mError: Can not unmount $D lsof please\\e[0m"; done;
	Encapsulate "Cleaning up tmp files and history..."
	rm -rf ~/.bash_history /var/cache/apt/*.bin /home/root/.bash_history /root/.bash_history /etc/apt/*.save /etc/apt/sources.list.d/*.save /var/crash/* /*.old 2>/dev/null
#rm -R /var/cache/apt /var/lib/apt/lists /var/cache/apt/*.bin
	if [[ -f "/etc/lsb-release" ]]; then
		FullBar
		Center "Final internal deployment information:..."
		FullBar
		lsb_release -a
		Encapsulate "os-release:"
		cat /etc/os-release
		Encapsulate "issue:"
		cat /etc/issue
		Encapsulate "issue.net:"
		cat /etc/issue.net
	fi
	Center "Exiting Chroot environment."
	FullBar
	exit 0
}

# Dump program header
VersionDump
# DETECT CHROOTED ARCH
ARCH=$(getconf LONG_BIT)
if ! [[ "$ARM" ]]; then
	if [ "${ARCH}" == "64" ]; then
		Center "64 Bit chrooted architecture detected."
		ARCH="amd64"
	else
		Center "32 Bit chrooted architecture detected."
		ARCH="i386"
	fi
else
	Center "ARMHF chrooted architecture detected."
fi

# Turn off end user prompting
export DEBIAN_FRONTEND=noninteractive

ValidateURL() {
	EXISTS=$(wget -S --spider "${1}"  2>&1 | grep 'HTTP/1.1 200 OK')
	if [[ "${EXISTS}" ]]; then
		Encapsulate "Package: ${1} exists."
		return 0
	else
		Error "Package: ${1} does not exist. Your custom grub will be minimally customized."
		return 1
	fi
}

# The above Function functioned perfectly, just too damn slow & I don't like to wait for anything.
# Package not availible?  Find it and rebuild the array, in one clean sweep.
QuestForSpeed () {
    HOLD=$(apt-mark hold fonts-noto-* mate-user-guide mate-user-guide calibre)
    #HOLD=$(apt-mark hold snapd)
	declare -i INDEX
	INDEX=0
	# Setup an array to store all good packages.
	declare -a CLEANPACKAGES=();
	# Case the joint, what type of O/S is the user wanting to build.
	Center "Installing: ${DISTTYPE}, please wait this will most likely take a long time."
	Encapsulate "Add recommended packages: ${RECOMMENDS^^}"
	FullBar
	case "${DISTTYPE}" in
		basepackages) # Install Base Packages.
			Center "Installing base packages."
			# Test to see if we have broken packages.
			(apt-get install -y -f "${BASEPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${BASEPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi
			Encapsulate "Installing Keysnatcher & Ultimate Edition repositories"
			Repositories "$@"
			FullBar;;
		developer) # Install development based packages.
			Center "Installing development based packages."
			# Test to see if we have broken packages.
			(apt-get install -y -f "${DEVELOPMENTPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${DEVELOPMENTPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi
			#Encapsulate "Installing PyCharm"
			#snap install pycharm-community --classic
			FullBar;;
		extra) # Find the offending package(s) that are broken / missing. Redirect error output to a file to parse latter.
			# Test to see if we have broken packages.
			(apt-get install -y -f "${EXTRAPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${EXTRAPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
				apt-get remove --purge -y -f mate-terminal mate-terminal-common
				if [[ -f "/usr/bin/pluma" ]]; then
					FullBar
					Encapsulate "Setting Pluma as default editor."
					update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /usr/bin/pluma 15
					update-alternatives --install /usr/bin/editor editor /usr/bin/pluma 15
					if [[ -f "/usr/bin/gedit" ]]; then
						update-alternatives --remove gnome-text-editor /usr/bin/gedit
						update-alternatives --auto gnome-text-editor
					fi
				fi
			else
				if [[ -f "/usr/bin/pluma" ]]; then
					FullBar
					Encapsulate "Setting Pluma as default editor."
					update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /usr/bin/pluma 15
					update-alternatives --install /usr/bin/editor editor /usr/bin/pluma 15
					if [[ -f "/usr/bin/gedit" ]]; then
						update-alternatives --remove gnome-text-editor /usr/bin/gedit
						update-alternatives --auto gnome-text-editor
					fi
				fi
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		lite)	# Find the offending package(s) that are broken / missing. Redirect error output to a file to parse latter.
			# Test to see if we have broken packages.
			(apt-get install -y -f "${LITEPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${LITEPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		full)	(apt-get install -y -f "${FULLPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${FULLPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		server)	(apt-get install -y -f "${SERVERPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${SERVERPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi
			# FIX for mysqld
			KILLALLINSTALLED=$(type -p killall)
			if [[ "${KILLALLINSTALLED}" ]]; then
			    KILLALL=$(killall mysqld >/dev/null 2>&1)
			fi
			apt-get install -f -y 2>/dev/null;;
		minimal-server) (apt-get install -y -f "${MINIMALPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${MINIMALPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}"  "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		gamers)	(apt-get install -y -f "${GAMERSPACKAGES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${GAMERSPACKAGES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}" "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		allgames) (apt-get install -y -f "${ALLGAMES[@]}" 2>errors)
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${ALLGAMES[@]}";
				do
					CHECKFORERROR=$(grep -i "${EACH}" "errors")
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					apt-get install -y -f --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
				else
					apt-get install -y -f "${CLEANPACKAGES[@]}"
				fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
		custom) # Find the offending package(s) that are broken / missing. Redirect error output to a file to parse latter.
			# Test to see if we have broken packages.
			if [[ "${RECOMMENDS^^}" == "NO" ]]; then
			    apt-get install -f -y --allow-unauthenticated --no-install-recommends "${CUSTOMPACKAGES[@]}" 2>errors
			else
			    apt-get install -f -y --allow-unauthenticated "${CUSTOMPACKAGES[@]}" 2>errors
			fi
			# Woopsie, Repo issue?  Let's rectify.
			if [[ -s "errors" ]]; then
				FullBar
				Encapsulate "Broken packages detected, Rectifying."
				# Build a array of good packages rip out the bad packages.
				# Break out a nested for loop.
				for EACH in "${CUSTOMPACKAGES[@]}";
				do
					if [[ -f "errors" ]]; then
						CHECKFORERROR=$(grep -i "${EACH}" "errors")
					fi
					if ! [[ "${CHECKFORERROR}" ]]; then
						CLEANPACKAGES[${INDEX}]="${EACH}"
						INDEX=$((INDEX + 1))
					else
						Encapsulate "Package: ${EACH} is broken and will not be installed."
					fi
				done
				FullBar
				if [[ "${RECOMMENDS^^}" == "NO" ]]; then
    				apt-get install -f -y --allow-unauthenticated --no-install-recommends "${CLEANPACKAGES[@]}"
    			else
    			    apt-get install -f -y --allow-unauthenticated "${CLEANPACKAGES[@]}"
    			fi
			else
				Center "All packages for ${DISTTYPE}, were successfully installed."
			fi;;
	esac
	if [[ -f "errors" ]]; then
		rm "errors"
	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 /);
if [ "$root_inode" -ne 2 ]; then
	Encapsulate "Chroot environment detected. Setting up appropriately."
else
	Error "Non-chroot environment detected. I refuse to execute. Exiting..."
	exit 1;
fi

#This was a rough one to chew ;)
#Detecting 32 bit or 64 bit in a chroot when the end user
#Could be running a 64 bit host building a 32 bit client.

if [[ -d "/tmp/" ]]; then
	cd "/tmp/" || exit 1
fi
#Encapsulate "Mounting necessary points."
#mount -t devpts none /dev/pts
#mount -t proc none /proc
#mount -t sysfs none /sys
export HOME=/root
export LC_ALL=C

#Turn off prompting for packages.
export DEBIAN_FRONTEND=noninteractive ;
export DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_PRIORITY=critical ;
unset UCF_FORCE_CONFFOLD
export UCF_FORCE_CONFFNEW=YES

#LISTS=$(ls /var/cache/apt/*.bin 2>/dev/null)
Encapsulate "Pulling preliminary sources list, please wait..."
FullBar
echo -e "${txtrst}"
Encapsulate "Pulling preliminary sources list, please wait..."
apt-get update >/dev/null & Spinner "Pulling preliminary sources list, please wait..."

if ! [[ -f "/etc/NetworkManager/conf.d/10-globally-managed-devices.conf" ]]; then
    Error "Ubuntu based bug detected: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1638842"
    Encapsulate "Rectifying bug from 2016, otherwise you would have no internet a showstopper. Please get it together Cannonical."
    mkdir -p /etc/NetworkManager/conf.d/
    touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
    if [[ -f "/etc/NetworkManager/conf.d/10-globally-managed-devices.conf" ]]; then
        Encapsulate "Done."
    else
        Error "Massive error, exiting."
        exit 1;
    fi
fi
Center "Rectifing dependency issues."
FullBar
if [[ "${RECOMMENDS^^}" == "NO" ]]; then
	apt-get install -f -y --allow-unauthenticated --no-install-recommends bc
else
	apt-get install -f -y --allow-unauthenticated bc
fi
Center "Pulling preliminary apps & prerequisites."
FullBar
CUSTOMPACKAGES=( "ubuntu-minimal" "ca-certificates" "wget" "gnupg2" "ca-certificates" "bc" "dialog" "gnupg2" "binutils" "xz-utils" "base-files" "lsb-release" "apt-utils" "ubiquity-casper" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}"
DISTREL=$(cat /etc/lsb-release | sed -n 's/^DISTRIB_RELEASE=[ \t]*\(.*\)/\1/p' 2>/dev/null)
VER=$(echo "${DISTREL}" | cut -d "." -f2)
SETDEFAULT=$(echo "$*" | grep -i "defaultde=")
REPOSTORMDEFAULT=$(echo "$*" | grep -i "repostorm")
if [[ -f "release.info" ]]; then
	TRUEVER=$(cat release.info)
fi

if [[ -f "/etc/issue" ]]; then
	COREINSTALLED=$(grep -i "ultimate" /etc/issue)
fi
INSTALLED=$((dpkg-query -l "python3" | grep 'ii')2>/dev/null)
if [[ "${INSTALLED}" ]]; then
    FullBar
    Encapsulate "Setting Python3 as the default interpreter."
    SETPYTHON3=$(update-alternatives --install /usr/bin/python python /usr/bin/python3 10)
    FullBar
fi
if [[ "${VER}" != "${TRUEVER}" ]]; then
	if ! [[ "${COREINSTALLED}" ]]; then
		Error "No core files have been installed for ${TRUEVER}"
		CORE=$(find . -name "ultimate-edition-${TRUEVER}-*-core-files.deb") 2>/dev/null
		if [[ "${CORE}" ]]; then
			Encapsulate "Core files found: ${CORE}."
			#Extractdeb "${CORE}"
			#Builddeb "${CORE}"
			Encapsulate "Installing: ${CORE}"
			FullBar
			#if [[ -f "/etc/issue" ]]; then
			#	rm "/etc/issue"
			#fi
			#if [[ -f "/etc/issue.net" ]]; then
		    #	rm "/etc/issue.net"
			#fi
            #if [[ -f "/etc/hostname" ]]; then
            #    rm "/etc/hostname"
            #fi
			#if [[ -f "/etc/lsb-release" ]]; then
			#	rm "/etc/lsb-release"
			#fi
			#if [[ -f "/etc/sysctl.conf" ]]; then
			#	rm "/etc/sysctl.conf"
			#fi
			dpkg -i --force-overwrite "${CORE}" 2>/dev/null
			FullBar
			rm "ultimate-edition-${TRUEVER}-*" 2>/dev/null
		fi
	else
		Encapsulate "Scanning for installation of core files: Success"

		if [[ "${SETDEFAULT}" ]]; then
			Encapsulate "Core files found, newer perhaps different default DE specified re-installing."
			Encapsulate "Installing: ${CORE}"
			dpkg -i --force-overwrite Dpkg::Options::="--force-confdef" "${CORE}" 2>/dev/null
			rm "ultimate-edition-${TRUEVER}-*" 2>/dev/null
			Encapsulate "Success."
		fi
		rm "ultimate-edition-${TRUEVER}-*" 2>/dev/null
	fi
fi
# reset distrelease info we installed the core package above.
# LTS Detection
if [[ -f "/etc/lsb_release" ]]; then
	ISLTS=$(grep -i "LTS" /etc/lsb_release)
	if [[ "${ISLTS}" ]]; then
		LTS="YES"
	fi
fi
CUTTINGEDGE=$(echo "$@" | grep -i "edge")
LOCALSOURCES=$(echo "$@" | grep -i "local")
if [[ "${LOCALSOURCES}" ]]; then
	if [[ -f "/etc/apt/sources.list" ]]; then
		rm "/etc/apt/sources.list"
	fi
	if [[ -f "/etc/apt/sources.list.d/local.list" ]]; then
		GREPIT=$(grep -i "#Local Repository" "/etc/apt/sources.list.d/local.list")
		if ! [[ "${GREPIT}" ]]; then
			Encapsulate "Injecting local sources."
			echo "deb http://192.168.1.189/ultimate-edition/ ultimate-edition all #Local Repository" >> "/etc/apt/sources.list.d/local.list"
		fi
	else
		Encapsulate "Injecting local sources."
		echo "deb http://192.168.1.189/ultimate-edition/ ultimate-edition all #Local Repository" > "/etc/apt/sources.list.d/local.list"
	fi
fi
    #ADDED 09/01/2020
	FullBar
	KERNELS=();
	if [[ "${CUTTINGEDGE}" ]]; then
		Encapsulate "Installing Latest & greatest Kernel"
		if ! [[ "${LIQUORIX}" ]]; then
			#apt-get remove --purge --yes --assume-yes linux-{headers,image,modules}-5.4* fonts-noto* kerneloops --allow-change-held-packages
			#if [[ "${2}" == "L" ]]; then
			KERNELS=( "linux-headers-5.8.5-050805-lowlatency_5.8.5_amd64.deb" "linux-headers-5.8.5-050805_5.8.5_all.deb" "linux-image-unsigned-5.8.5-050805-lowlatency_amd64.deb" "linux-modules-5.8.5-050805-lowlatency_5.8.5_amd64.deb" );
		else
			KERNELS=( "linux-headers-5.8.0-13.1-liquorix-amd64_5.8-12ubuntu1~focal_amd64.deb" "linux-headers-liquorix-amd64_5.8-12ubuntu1~focal_amd64.deb" "linux-image-5.8.0-13.1-liquorix-amd64_5.8-12ubuntu1~focal_amd64.deb" "linux-image-liquorix-amd64_5.8-12ubuntu1~focal_amd64.deb" );
		fi
	fi
	TEPO="${PWD}"
	if ! [[ "${KERNELS[@]}" == "" ]]; then
		cd "/tmp/" || exit 1;

		#rm -R *
		for EACH in "${KERNELS[@]}"
		do
		    if ! [[ -f "${EACH}" ]]; then
    			wget "http://os-builder.com/KERNEL_SANDERS/${EACH}"
    		else
    		    Encapsulate "Exists: ${EACH} in cache. Not downloading."
    		fi
		done
		dpkg -i linux-*.deb
		FullBar
		rm linux-*.deb
		cd "${TEPO}" || exit 1;
	fi
DISTREL=$(cat /etc/lsb-release | sed -n 's/^DISTRIB_RELEASE=[ \t]*\(.*\)/\1/p' 2>/dev/null)
INSTALLED=$((dpkg-query -l "ultimate-edition-repositories-apt-source" | grep "ii")2>/dev/null)
if ! [[ "${INSTALLED}" ]]; then
	Center "Retriving Ultimate Edition Repositories..."
	FullBar
	if ! [[ -f "ultimate-edition-repositories-0.2.5-apt-source_all.deb" ]]; then
		Download "${ROOTFOLDER}/ultimate-edition-repositories-0.2.5-apt-source_all.deb"
		FullBar
	fi
	if [[ -f "ultimate-edition-repositories-0.2.5-apt-source_all.deb" ]]; then
		dpkg -i "ultimate-edition-repositories-0.2.5-apt-source_all.deb"
		apt-get install -f -y
		if [[ -f "cache" ]]; then
			rm "ultimate-edition-repositories-0.2.5-apt-source_all.deb"
		fi
	fi
else
	Center "Ultimate Edition Repositories already installed."
fi
Encapsulate "Refreshing sources"
apt-get update 2>/dev/null & Spinner "Refreshing sources"
#HoldM "$@"
#Repostorm
INSTALLED=$((dpkg-query -l "ultimate-edition-repostorm" | grep "ii")2>/dev/null)
REPOSTORM="ultimate-edition-repostorm_2.0.7_all.deb"
if ! [[ "${INSTALLED}" ]]; then
	if ! [[ -f "${REPOSTORM}" ]]; then
		Encapsulate "Downloading ${REPOSTORM}:"
		Download "${REPOSTORM}"
	fi
	if [[ -s "${REPOSTORM}" ]]; then
		dpkg -i "${REPOSTORM}"
		apt-get install -f -y --no-install-recommends
		if [[ -f "cache" ]]; then
			rm "${REPOSTORM}"
		fi
	else
		Error "File not found: ${REPOSTORM}"
	fi
else
	Center "Ultimate Edition Repostorm previously installed."
fi
Encapsulate "Pulling dependancies, please wait."
apt-get install -f -y


#KeySnatcher
INSTALLED=$((dpkg-query -l "ultimate-edition-keysnatcher" | grep "ii")2>/dev/null)
KEYSNATCHER="ultimate-edition-keysnatcher-1.1.4_all.deb"
if ! [[ "${INSTALLED}" ]]; then
	# Future builds will be SPECIFIC via ${DISTREL} value
	# wget http://ultimateedition.info/Ultimate_Edition_${DISTREL}/ultimate-edition-keysnatcher-1.0.0_all.deb
	if ! [[ -f "${KEYSNATCHER}" ]]; then
		Encapsulate "Downloading ${KEYSNATCHER}:"
		Download "${KEYSNATCHER}"
	fi
	if [[ -s "${KEYSNATCHER}" ]]; then
		dpkg -i "${KEYSNATCHER}"
		if [[ -f "cache" ]]; then
			rm "${KEYSNATCHER}"
			Encapsulate "Refreshing sources, since sources have now most likely changed."
    		apt-get update 2>/dev/null & Spinner "Refreshing sources, since sources have now most likely changed."
		fi
	else
		Error "File not found: ${KEYSNATCHER}"
	fi
else
	Center "Ultimate Edition Keysnatcher previously installed."
	Encapsulate "Refreshing sources, since sources have now most likely changed."
    apt-get update 2>/dev/null & Spinner "Refreshing sources, since sources have now most likely changed."
fi
Encapsulate "Pulling dependancies, please wait."
apt-get install -f -y
if [[ -f "ubiquity-slideshow-ubuntu_999_all.deb" ]]; then
	Encapsulate "Installing: ubiquity-slideshow-ubuntu_999_all.deb"
	dpkg -i "ubiquity-slideshow-ubuntu_999_all.deb" 2>/dev/null
else
	Encapsulate "ubiquity-slideshow-ubuntu_999_all.deb not found, KDE?"
fi
if [[ -f "ubiquity-slideshow-kubuntu_999_all.deb" ]]; then
	Encapsulate "Installing: ubiquity-slideshow-kubuntu_999_all.deb"
	dpkg -i "ubiquity-slideshow-kubuntu_999_all.deb"
else
	Encapsulate "ubiquity-slideshow-kubuntu_999_all.deb not found, Gnome / Mate?"
fi
INSTALLED=$((dpkg-query -l "dbus" | grep "ii")2>/dev/null)
if ! [[ "${INSTALLED}" ]]; then
	Center "Installing dbus..."
	apt-get install -f -y dbus
else
	Center "Dbus previously installed."
fi
EXISTS=$(type -p keysnatcher)

if [[ -f "/etc/lsb-release" ]]; then
	Center "Distro release info:"
	FullBar
	lsb_release -a
	FullBar
	if [[ -f "/etc/lsb-release" ]]; then
    	LITE=$(grep -i "lite" /etc/lsb-release)
    	GAMERS=$(grep -i "gamers" /etc/lsb-release)
    	SERVER=$(grep -i "server" /etc/lsb-release)
		MSERVER=$(grep -i "minimal" /etc/lsb-release)
		DEVELOPER=$(grep -i "developer" /etc/lsb-release)
	fi
	if [[ "${MSERVER}" ]]; then
		SERVER=""
		DISTTYPE="minimal"
	fi
        ULTIMATEEDITION=$(grep -i "ultimate" /etc/lsb-release)
        #Center "DEBUGGING: ULTIMATEEDITION: ${ULTIMATEEDITION} GAMERS:${GAMERS} LITE:${LITE}"
else
	Error "ERROR: Massive failure, no dist-release info, exiting."
	EXIT
fi
Encapsulate "Rectifying initial dependancies"
FullBar
apt-get install -f -y --allow-unauthenticated
if ! [[ -f "${HOME}/.keysnatcher" ]]; then
	if [[ "${EXISTS}" ]]; then
		keysnatcher --snatch
		keysnatcher --fixerrors
	fi
fi
if [[ "${REPOSTORMDEFAULT}" ]]; then
	EXEC=$(repostorm --service on autofix 3)
	APTFILE=$(type -p apt-file)
	if [[ "${APTFILE}" ]]; then
	    apt-file update
	else
	    apt-get install apt-file -f -y
	    APTFILE=$(type -p apt-file)
	fi
fi
if [[ "${APTFILE}" ]]; then
    apt-file update
fi
#Center "Inserting diversion..."
#dbus-uuidgen > /var/lib/dbus/machine-id
#dpkg-divert --local --rename --add /sbin/initctl
#ln -s /bin/true /sbin/initctl
DisableIPV6
Encapsulate "Refreshing sources"
apt-get update 2>/dev/null & Spinner "Refreshing sources"
FullBar
Center "Distribution Upgrading..."
FullBar
#PUSH ALL UPGRADES
apt-get -f -y dist-upgrade

Ubiquity () {
	if [[ -z "${1}" ]]; then
     	Error "Internal Ubiquity function requires a parameter of gtk or kde"
		exit 1;
	fi
	DETYPE="${1}"
	if ! [[ "${DETYPE}" == "gtk" || "${DETYPE}" == "kde" ]]; then
		Error "Internal Ubiquity function requires a parameter of gtk or kde"
		exit 1;
	fi
	INSTALLED=$((dpkg-query -l "ubiquity-frontend-${DETYPE}" | grep "ii")2>/dev/null)
	if ! [[ "${INSTALLED}" ]]; then
		Center "Installing Ubiquity installer."
		FullBar
		if [[ "${RECOMMENDS^^}" == "NO" ]]; then
			apt-get install -f -y --allow-unauthenticated --no-install-recommends "ubiquity-frontend-${DETYPE}"
		else
			apt-get install -f -y --allow-unauthenticated "ubiquity-frontend-${DETYPE}"
		fi
	fi;
}

LightDM () {
	INSTALLED=$((dpkg-query -l "lightdm" | grep "ii")2>/dev/null)
	if ! [[ "${INSTALLED}" ]]; then
		Center "Installing LightDm display manager & Xorg."
		FullBar
		if [[ "${RECOMMENDS^^}" == "NO" ]]; then
			apt-get install -f -y --allow-unauthenticated --no-install-recommends lightdm xserver-xorg xorg xserver-xorg-core
		else
			apt-get install -f -y --allow-unauthenticated lightdm xserver-xorg xorg xserver-xorg-core
		fi
	fi
}

SDDM () {
    INSTALLED=$((dpkg-query -l "sddm" | grep "ii")2>/dev/null)
    if ! [[ "${INSTALLED}" ]]; then
		Center "Installing SDDM display manager & Xorg."
		FullBar
		if [[ "${RECOMMENDS^^}" == "NO" ]]; then
			apt-get install -f -y --allow-unauthenticated --no-install-recommends sddm xserver-xorg xorg xserver-xorg-core #sddm-kcm
		else
			apt-get install -f -y --allow-unauthenticated sddm xserver-xorg xorg xserver-xorg-core #sddm-kcm
		fi
	fi
}

BaseApplications () {
	INSTALLED=$((dpkg-query -l "xdg-user-dirs" | grep "ii")2>/dev/null)
	if ! [[ "${INSTALLED}" ]]; then
		Center "Installing Standard / base applications."
		BASEAPPLICATIONS=( "xdg-user-dirs" "xdg-utils" "command-not-found" "bash-completion" "fonts-liberation" "discover" "laptop-detect" "os-prober" "build-essential" "cups" "net-tools" "ifupdown" );
		FullBar
		TMP="${DISTTYPE}"
       	DISTTYPE="base"
        QuestForSpeed "@"
		DISTTYPE="extra"
        QuestForSpeed "@"
       	DISTTYPE="${TMP}"
	fi
}
#BARE-ESSENTIALS - Have to have a kernel and casperfs to read from:
Encapsulate "Refreshing sources"
apt-get update 2>/dev/null & Spinner "Refreshing sources"
#TODO: DIST SPECIFIC DATA ENTER HERE CASE THE JOINT
if ! [[ "${MSERVER}" ]]; then
	if [[ -f "DE" ]]; then
		for ZZ in $(cat DE)
		do
			ZZ=$(echo "${ZZ}" | tr /a-z/ /A-Z/)
			case "${ZZ}" in

				DEEPIN) INSTALLED=$((dpkg-query -l "ubuntudde-dde" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING DEEPIN DE";
					 	FullBar;
					 	apt-get install -f -y --allow-unauthenticated ubuntudde-*;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				BUDGIE) INSTALLED=$((dpkg-query -l "ubuntu-budgie-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING BUDGIE DE";
					 	FullBar;
					 	apt-get install -f -y --allow-unauthenticated ubuntu-budgie-desktop;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				MATE) INSTALLED=$((dpkg-query -l "ubuntu-mate-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING MATE DE";
						FullBar;
						CUSTOMPACKAGES=( "ubuntu-mate-desktop" "ubuntu-mate-core" );
                    	TMP="${DISTTYPE}"
                    	DISTTYPE="custom"
                    	QuestForSpeed "@"
                    	DISTTYPE="${TMP}"
						#apt-get install -f -y --allow-unauthenticated mate-core mate-desktop-environment;
						CUSTOMPACKAGES=( "caja-admin" "caja-eiciel" "caja-gtkhash" "caja-image-converter" "caja-open-terminal" "caja-rename" "caja-seahorse" "caja-sendto" "caja-wallpaper" "mate-control-center" "libcanberra-pulse" );
                    	TMP="${DISTTYPE}"
                    	DISTTYPE="custom"
                    	QuestForSpeed "@"
                    	DISTTYPE="${TMP}"
                        #apt-get install -f -y --allow-unauthenticated caja-dropbox caja-admin caja-eiciel caja-gtkhash caja-image-converter caja-open-terminal caja-rename caja-seahorse caja-sendto caja-wallpaper mate-control-center libcanberra-pulse;
					 fi;
                     BlueToothBug;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				KDE) INSTALLED=$((dpkg-query -l "kubuntu-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING KDE DE";
						FullBar;
						CUSTOMPACKAGES=( "kubuntu-desktop" ); # "kde-full" "kubuntu-desktop" "kubuntu-full"
						TMP="${DISTTYPE}"
                    	DISTTYPE="custom"
                    	QuestForSpeed "@"
                    	DISTTYPE="${TMP}"
					 fi;
					 #dpkg-reconfigure kdm;
					 KDESPLASH;
					 SDDM;
					 Ubiquity kde;
					 BaseApplications;;
				TRINITY) INSTALLED=$((dpkg-query -l "kubuntu-desktop-trinity" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING TRINITY DE";
						FullBar;
						CUSTOMPACKAGES=( "kubuntu-desktop-trinity" ); # "kde-full" "kubuntu-desktop" "kubuntu-full"
						TMP="${DISTTYPE}"
                    	DISTTYPE="custom"
                    	QuestForSpeed "@"
                    	DISTTYPE="${TMP}"
					 fi;
					 #dpkg-reconfigure kdm;
					 KDESPLASH;
					 #SDDM;
					 Ubiquity kde;
					 BaseApplications;;

				XFCE) INSTALLED=$((dpkg-query -l "xubuntu-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING XFCE DE";
					 	FullBar;
						if [[ "${RECOMMENDS^^}" == "NO" ]]; then
					 		apt-get install -f -y --allow-unauthenticated --no-install-recommends xubuntu-desktop;
						else
							apt-get install -f -y --allow-unauthenticated xubuntu-desktop;
						fi
                        Center "Initializing plugins for XFCE.";
                        apt-get install -f -y --allow-unauthenticated xfce*;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;
				PANTHEON) INSTALLED=$((dpkg-query -l "elementary-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING PANTHEON DE";
					 	FullBar;
					 	apt-get install -f -y --allow-unauthenticated --no-install-recommends elementary-desktop;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				GNOME) INSTALLED=$((dpkg-query -l "ubuntu-gnome-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING GNOME DE";
					 	FullBar;
					 	apt-get install -f -y --allow-unauthenticated --no-install-recommends ubuntu-gnome-desktop gnome-session-flashback gnome-tweak-tool;
					 fi
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				LXDE) INSTALLED=$((dpkg-query -l "lubuntu-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING LXDE DE";
						 FullBar;
						if [[ "${RECOMMENDS^^}" == "NO" ]]; then
							apt-get install -f -y --allow-unauthenticated --no-install-recommends lubuntu-desktop;
						else
							apt-get install -f -y --allow-unauthenticated lubuntu-desktop;
						fi
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				AWESOME) INSTALLED=$((dpkg-query -l "awesome" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING AWESOME DE";
						 FullBar;
						 apt-get install -f -y --allow-unauthenticated --no-install-recommends awesome;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				LXQT) INSTALLED=$((dpkg-query -l "lxqt" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING LXQT DE";
						 FullBar;
						 apt-get install -f -y --allow-unauthenticated lxqt;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				UNITY) INSTALLED=$((dpkg-query -l "ubuntu-desktop" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING UNITY DE";
						 FullBar;
						 apt-get install -f -y --allow-unauthenticated --no-install-recommends ubuntu-desktop;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				CINNAMON) INSTALLED=$((dpkg-query -l "cinnamon" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING CINNAMON DE";
						 FullBar;
						 apt-get install -f -y --allow-unauthenticated --no-install-recommends cinnamon cinnamon-desktop-environment cinnamon-desktop;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				TOUCH) INSTALLED=$((dpkg-query -l "ubuntu-touch-session" | grep "ii")2>/dev/null);
					 if ! [[ "${INSTALLED}" ]]; then Center "INSTALLING TOUCH DE";
						 FullBar;
						 apt-get install -f -y --allow-unauthenticated --no-install-recommends ubuntu-touch-session;
					 fi;
					 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;

				NONE) Center "Minimal server detected, no desktop environment will be installed";
					 FullBar;
					 BaseApplications;;

				*) 	 LightDM;
					 Ubiquity gtk;
					 BaseApplications;;
			esac
		done
	fi
fi

#UBIQUITY INSTALLED?  ADD MATE TO THE LIST...
if [[ -f "/usr/share/applications/ubiquity-gtkui.desktop" ]]; then
	Center "Ubiquity installation Detected adding Mate to list."
	sed -i 's/OnlyShowIn=GNOME;XFCE;Unity;/OnlyShowIn=MATE;GNOME;XFCE;Unity;/g' /usr/share/applications/ubiquity-gtkui.desktop
fi
Center "Ignore the above and below Error(s), we will fix them at stage 3 later."
Center "Entering Distro customization section..."
if ! [[ "${MSERVER}" ]]; then
	for i in "${INSTALLNAMES[@]}"
	do
		INSTALLED=$((dpkg-query -l "${i}" | grep "ii") 2>/dev/null)
		if ! [[ "${INSTALLED}" ]]; then
			Encapsulate "Checking installation of ${i}: Not Installed."
			if ! [[ -f "${i}" ]]; then
				Encapsulate "Checking cache for ${i}: Does not exist."
				Encapsulate "Downloading ${i}:"
				Download "${i}"
				if [[ -s "${i}" ]]; then
					INSTALL=$(dpkg -i "${i}" 2>/dev/null)
					if [[ "${INSTALL}" ]]; then
						Encapsulate "Installing ${i}: Installed."
					else
						Error "Installing ${i}: Failed."
					fi
				else
					Error "Failed to download ${i}."
				fi
			else
				Encapsulate "Checking cache for ${i}: Exists."
				Encapsulate "Installing ${i}:"
				INSTALL=$(dpkg -i "${i}" 2>/dev/null)
				if [[ "${INSTALL}" ]]; then
					Encapsulate "${i} has been installed successfully."
				else
					Error "Failed to install ${i}."
				fi
			fi

			#if [[ -f "cache" ]]; then
			#	rm "${FTG}"
			#fi
		else
			Encapsulate "${i} has already been Installed."
		fi
		array_counter=$((array_counter + 1))
	done
else
	Center "No GUI apps will be installed, this is minimal server."
fi

if ! [[ "${MSERVER}" ]]; then
	Center "Installing Ultimate Edition Theme(s)..."
	FullBar
	if [[ "${GAMERS}" ]]; then
		if [[ "${DISTREL}" ]]; then
			Encapsulate "Gamers Edition  only installing ${DISTREL} theme to save space for more games."
			UETHEMES=("${DISTREL}");
		fi
	fi
	if [[ "${SERVER}" ]]; then
		if [[ "${DISTREL}" ]]; then
			Encapsulate "Server Edition detected, only installing ${DISTREL} theme to save space."
			UETHEMES=("${DISTREL}");
		fi
	fi
	if [[ "${DEVELOPER}" ]]; then
		if [[ "${DISTREL}" ]]; then
			Encapsulate "Developer Edition detected, only installing ${DISTREL} theme to save space for more IDE's / dev tools."
			UETHEMES=("${DISTREL}");
		fi
	fi
	if [[ "${LITE}" ]]; then
		if [[ "${DISTREL}" ]]; then
			Encapsulate "Lite Edition detected, only installing ${DISTREL} theme to save space."
			UETHEMES=("${DISTREL}");
		fi
	fi
	for i in "${UETHEMES[@]}"
	do
		ZZ="ultimate-edition-theme-${i}"
		# ultimate-edition-theme-4.4_all.deb
		DEBFILE="ultimate-edition-theme-${i}_all.deb"
		Encapsulate "Checking installation of ${ZZ}:"
		INSTALLED=$((dpkg-query -l "${ZZ}" 2>/dev/null | grep "ii")2>/dev/null)
		if ! [[ "${INSTALLED}" ]]; then
			Encapsulate "Not installed."
			Encapsulate "Checking cache for: ${ZZ}"
			FTG="${DEBFILE}"
			if ! [[ -f "${FTG}" ]]; then
				Encapsulate "Does not exist. Downloading ${ZZ}:"
				Download "${THEMEFOLDER}" "${FTG}"
				if [[ -s "${FTG}" ]]; then
					Encapsulate "Installing ${ZZ}:"
					INSTALL=$(dpkg -i "${FTG}" 2>/dev/null)
					if [[ "${INSTALL}" ]]; then
						Encapsulate "Done."
					else
						Error "Failed."
					fi
				else
					Error "Failed to download ${ZZ}"
					Error "Please report issue to TheeMahn <theemahn@os-builder.com>."
				fi
			else

				INSTALL=$(dpkg -i "${FTG}" 2>/dev/null)
				if [[ "${INSTALL}" ]]; then
					Encapsulate "Installing ${i} from cache: Done"
				else
					Error "Installing ${i} from cache: Failed."
				fi
			fi

			#if [[ -f "cache" ]]; then
				#rm "${FTG}"
			#fi
		else
			Encapsulate "Ultimate edition ${i} theme has been installed."
		fi
		array_counter=$((array_counter + 1))
	done
else
	Center "No GTK themes will be installed this is minimal server."
fi

Center "Fixing any dependency issues, please wait..."
apt-get install -f -y 2>/dev/null
LONGVERSION="${DISTREL}"
LONGVERSION=$(echo "${DISTREL}" | grep -o "\\." | wc -l)
if [[ "${LONGVERSION}" -gt 1 ]]; then
	#echo "DETECTED A LTS THAT IS GREATER THEN 2 DIGITS"
	DISTREL="${DISTREL%.*}"
	LTS="YES"
fi
# prerequisites
INSTALLED=$((dpkg-query -l "plymouth-themes" | grep "ii")2>/dev/null)
if [[ "${INSTALLED}" ]]; then
    apt-get remove --purge -f -y plymouth-themes
fi
TESTEXIST=$(dpkg -l | grep -i "plymouth-theme-kubuntu*")
if [[ "$TESTEXIST" ]]; then
Encapsulate "Purging Kubuntu plymouth theme."
apt-get remove --purge --yes --assume-yes plymouth-theme-kubuntu*
#apt-get remove --purge plymouth-themes
fi
apt-get install -f -y --allow-unauthenticated plymouth-label
TESTEXIST=$(dpkg -l | grep -i "plymouth-theme-kubuntu*")
if [[ "$TESTEXIST" ]]; then
Encapsulate "Purging Kubuntu plymouth theme."
apt-get remove --purge --yes --assume-yes plymouth-theme-kubuntu*
#apt-get remove --purge plymouth-themes
fi
INSTALLED=$((dpkg-query -l "ultimate-edition-plymouth-${DISTREL}_all" | grep "ii")2>/dev/null)
if ! [[ "${INSTALLED}" ]]; then
	Encapsulate "Installing Ultimate Edition Theme Pack for ${DISTREL}"
	apt-get -f -y install ultimate-edition-${DISTREL}
fi
# ultimate-edition-4.4-plymouth_all.deb
INSTALLED=$((dpkg-query -l "ultimate-edition-plymouth-${DISTREL}_all" | grep "ii")2>/dev/null)
if ! [[ "${INSTALLED}" ]]; then
	if ! [[ -f "ultimate-edition-plymouth-${DISTREL}_all.deb" ]]; then
		Encapsulate "Retrieving plymouth splash for Ultimate Edition ${DISTREL}:"
		Download "${THEMEFOLDER}" "ultimate-edition-plymouth-${DISTREL}_all.deb"
		if [[ -f "ultimate-edition-plymouth-${DISTREL}_all.deb" ]]; then
			Encapsulate "Installing ultimate-edition-plymouth-${DISTREL}_all.deb:"
			INSTALL=$(dpkg -i "ultimate-edition-plymouth-${DISTREL}_all.deb" 2>/dev/null)
			if [[ "${INSTALL}" ]]; then
				Encapsulate "Installed."
			else
				Error "Failed."
			fi
		else
			Encapsulate "Installing ultimate-edition-plymouth-${DISTREL}_all.deb from cache:"
			INSTALL=$(dpkg -i "ultimate-edition-plymouth-${DISTREL}_all.deb" 2>/dev/null)
			if [[ "${INSTALL}" ]]; then
				Encapsulate "Installed."
			else
				Error "Failed."
			fi
		fi
		if [[ -f "ultimate-edition-plymouth-${DISTREL}_all.deb" ]]; then
			if [[ -f "cache" ]]; then
				rm "ultimate-edition-plymouth-${DISTREL}_all.deb"
			fi
		fi
	else
		Center "Ultimate Edition ${DISTREL} Plymouth already installed."
	fi
fi
#apt-get install -f -y --allow-unauthenticated
if ! [[ "${MSERVER}" ]]; then
	apt-get install -f -y --allow-unauthenticated libnotify-bin imagemagick
fi

#DE SPECIFIC STUFF
Center "Installed sessions:"
SESSIONS=(/usr/share/xsessions/*)
if ! [[ "${SESSIONS}" ]]; then
	Encapsulate "NONE, Minimal server"
else
	for EACH in "${SESSIONS[@]}"
	do
		Encapsulate "${EACH}"
	done
fi

CVERSION="${DISTREL}"
LONGVERSION=$(echo "${CVERSION}" | grep -o "\\." | wc -l)
if [[ "${LONGVERSION}" -gt 1 ]]; then
	#echo "DETECTED A LTS THAT IS GREATER THEN 2 DIGITS"
	CVERSION="${CVERSION%.*}"
	LONGVERSION="${1}"
	LTS="YES"
else
	LONGVERSION="${CVERSION}"
fi

#APPZ
if [[ "${LITE}" ]]; then
	DISTTYPE="lite"
fi
if [[ "${SERVER}" ]]; then
	DISTTYPE="server"
fi
if [[ "${GAMERS}" ]]; then
	DISTTYPE="gamers"
	Center "Initialising custom package installer for ${DISTTYPE}, please wait..."
	QuestForSpeed "@"
	WineUp
fi

if [[ "${MSERVER}" ]]; then
	DISTTYPE="minimal-server"
	SERVER=""
fi

if [[ "${DEVELOPER}" ]]; then
	DISTTYPE="developer"
	Center "Initialising custom package installer for ${DISTTYPE}, please wait..."
	QuestForSpeed "@"
fi

if ! [[ "${DISTTYPE}" ]]; then
	DISTTYPE="full"
	WineUp
	KDESPLASH
fi

if [[ "${ULTIMATEEDITION}" ]]; then
	Center "Initialising custom package installer for ${DISTTYPE}, please wait..."
	QuestForSpeed "@"
fi
FullBar
if [[ "${DEFAULTDE}" == "kde" ]]; then
	KDESPLASH
fi
Center "Installing applications specific to Ultimate Edition ${DISTREL} release."
FullBar
case "${DISTREL}" in
	6.7)	CUSTOMPACKAGES=( "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="full"
QuestForSpeed "@"
DISTTYPE="extra"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
	6.5)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="full"
QuestForSpeed "@"
DISTTYPE="extra"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
	6.3)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="full"
QuestForSpeed "@"
DISTTYPE="extra"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
	6.2)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
    6.1)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
    5.9)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
    5.8)	#Center "Fixing mtab issue..."
		#SUPPRESS=$(ln -sfn /proc/self/mounts /etc/mtab)
        CUSTOMPACKAGES=( "compiz" "compiz-plugin*" "compizconfig-settings-manager" "kodi" "compiz-*");
		#apt-get install -f -y compiz compiz-plugin* compizconfig-settings-manager kodi
		#apt-get install -f -y compiz-*
		echo '[Desktop Entry]' > /etc/xdg/autostart/compiz.desktop
		echo 'Name=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Name[en_GB]=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Type=Application' >> /etc/xdg/autostart/compiz.desktop
		echo 'Exec=/usr/bin/compiz --replace' >> /etc/xdg/autostart/compiz.desktop
		echo 'Terminal=false' >> /etc/xdg/autostart/compiz.desktop
		echo 'Icon=gnome-do' >> /etc/xdg/autostart/compiz.desktop
		echo 'Comment=Engages Compiz.' >> /etc/xdg/autostart/compiz.desktop
		echo 'Categories=System;' >> /etc/xdg/autostart/compiz.desktop
		TMP="${DISTTYPE}"
        DISTTYPE="custom"
        QuestForSpeed "@"
        DISTTYPE="${TMP}";;
	5.7)	CUSTOMPACKAGES=( "kodi" "compiz-*" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}";;

   	5.5)	CUSTOMPACKAGES=( "p7zip-full" "aisleriot" "alsa-oss" "anjuta" "arj" "aspell" "audacity" "b43-fwcutter" "bchunk" "binutils" "blender" "bogofilter" "bootchart" "build-essential" "bum" "bzip2" "bzr" "ccd2iso" "cdparanoia" "cdrdao" "checkgmail" "cheese" "clamav" "clamav-freshclam" "clamtk" "compiz" "compiz-plugins" "compizconfig-backend-gconf" "compizconfig-settings-manager" "conky-std" "cvs" "devede" "devhelp" "dragonplayer" "dvdauthor" "dvdbackup" "dvdisaster" "dvdrip" "dvdrip-utils" "dvdstyler" "dvgrab" "easytag" "elinks" "f-spot" "faac" "faad" "fakeroot" "fancontrol" "ffmpeg2theora" "file-roller" "flac" "ftp" "gdesklets" "gedit" "genisoimage" "gimp" "glade" "gnome-codec-install" "medit" "wavpack" "preload" "metacity-themes" "gtk-theme-switch" "pidgin-plugin-pack" "gstreamer-tools" "debootstrap" "kolourpaint4" "unrar" "mppenc" "gstreamer0.10-plugins-ugly" "swh-plugins" "kdenlive" "vorbis-tools" "ksnapshot" "pidgin-extprefs" "pidgin-themes" "gnome-icon-theme-suede" "xvid4conf" "lives" "gtkpod" "id3v2" "hardinfo" "patchutils" "gnome-icon-theme-gperfection2" "nrg2iso" "qemu" "krita" "kdemultimedia-kio-plugins" "python-chm" "python-lxml" "ttf-isabella" "ttf-xfree86-nonfree-syriac" "gstreamer0.10-plugins-bad-multiverse" "pidgin-sipe" "soundkonverter" "qt4-designer" "dh-buildinfo" "mp3gain" "vorbisgain" "frei0r-plugins" "squashfs-tools" "qt4-demos" "ttf-summersby" "xmltv-util" "isomaster" "qemu-launcher" "p7zip" "gnome-themes-extras" "industrialtango-theme" "k3b" "k3d" "phatch" "tidy" "speex" "gnupod-tools" "ttf-uralic" "kvirc" "pidgin-guifications" "qt4-dev-tools" "kdeartwork-emoticons" "oss-compat" "gpp" "qt4-qmake" "devscripts" "ttf-xfree86-nonfree" "dctrl-tools" "videotrans" "tvtime" "mdf2iso" "gtk-recordmydesktop" "dput" "hfsutils" "rar" "recordmydesktop" "phatch-cli" "cabextract"  "t1-xfree86-nonfree" "hydrogen" "exiftran" "outdoors-theme" "python-wxversion" "screenlets" "gstreamer0.10-fluendo-mp3" "peace-session-splashes" "qtcreator" "karbon" "xcftools" "wireshark" "murrine-themes" "python-pyexiv2" "pidgin" "gnumeric" "ubuntu-dev-tools" "wifi-radar" "mpg321" "kompare" "perl-tk" "bsd-mailx" "ttf-tuffy" "gnome-icon-theme-nuovo" "ndisgtk" "sbackup" "kopete" "sysinfo" "pbuilder" "tropic-wallpapers" "python-reportbug" "winbind" "mkvtoolnix" "xnest" "unace" "oxygen-cursor-theme-extra" "perlmagick" "htop" "lintian" "inkscape" "linux-firmware-nonfree" "python-reportlab" "youtube-dl" "gnome-icon-theme-yasis" "kino" "qemuctl" "qemubuilder" "hfsplus" "yakuake" "tesseract-ocr-eng" "wdiff" "ndiswrapper-utils-1.9" "broadcom-sta-common" "k3b-extrathemes" "libk3b6-extracodecs" "imagination" "terminator" "vlc" "cairo-clock" "exaile" "lynx" "sound-juicer" "ripoff" "gdebi" "samba" "shutter" "amarok" "calligra" "avidemux" "mediainfo" "synaptic" "xscreensaver" "xscreensaver-gl-extra" "xscreensaver-data-extra" "dconf-tools" "git" "subversion" "cmake" "udisks" "gnome-disk-utility" "qdbus-qt5" "qdbus" "gnome-themes-standard" "gtk3-engine*" "onboard" "plasma-widget-folderview" "kdeplasma-addons" "kodi" );
TMP="${DISTTYPE}"
DISTTYPE="custom"
QuestForSpeed "@"
DISTTYPE="${TMP}";;
	5.0)	#Center "Fixing mtab issue..."
		#SUPPRESS=$(ln -sfn /proc/self/mounts /etc/mtab)
		apt-get install -f -y compiz compiz-plugin* compizconfig-settings-manager kodi
		apt-get install -f -y compiz-*
		echo '[Desktop Entry]' > /etc/xdg/autostart/compiz.desktop
		echo 'Name=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Name[en_GB]=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Type=Application' >> /etc/xdg/autostart/compiz.desktop
		echo 'Exec=/usr/bin/compiz --replace' >> /etc/xdg/autostart/compiz.desktop
		echo 'Terminal=false' >> /etc/xdg/autostart/compiz.desktop
		echo 'Icon=gnome-do' >> /etc/xdg/autostart/compiz.desktop
		echo 'Comment=Engages Compiz.' >> /etc/xdg/autostart/compiz.desktop
		echo 'Categories=System;' >> /etc/xdg/autostart/compiz.desktop
		Encapsulate "Keeping Samba, will be fixed at tmgrub.";;
		#apt-get remove -y --purge samba winbind system-config-samba blueman;;
	4.9)	apt-get remove --purge -y gnome-session;;
	4.8)	apt-get install -f -y compiz-*
		echo '[Desktop Entry]' > /etc/xdg/autostart/compiz.desktop
		echo 'Name=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Name[en_GB]=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Type=Application' >> /etc/xdg/autostart/compiz.desktop
		echo 'Exec=/usr/bin/compiz --replace' >> /etc/xdg/autostart/compiz.desktop
		echo 'Terminal=false' >> /etc/xdg/autostart/compiz.desktop
		echo 'Icon=gnome-do' >> /etc/xdg/autostart/compiz.desktop
		echo 'Comment=Engages Compiz.' >> /etc/xdg/autostart/compiz.desktop
		echo 'Categories=System;' >> /etc/xdg/autostart/compiz.desktop
		apt-get remove -y --purge samba winbind system-config-samba;;
	4.7)	apt-get install -f -y compiz-*
		apt-get remove -y --purge samba winbind system-config-samba;;

	4.6)	apt-get install -f -y compiz-*
		apt-get remove -y --purge samba winbind system-config-samba
		apt-get -y autoremove
		echo '[Desktop Entry]' > /etc/xdg/autostart/compiz.desktop
		echo 'Name=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Name[en_GB]=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Type=Application' >> /etc/xdg/autostart/compiz.desktop
		echo 'Exec=/usr/bin/compiz --replace' >> /etc/xdg/autostart/compiz.desktop
		echo 'Terminal=false' >> /etc/xdg/autostart/compiz.desktop
		echo 'Icon=gnome-do' >> /etc/xdg/autostart/compiz.desktop
		echo 'Comment=Engages Compiz.' >> /etc/xdg/autostart/compiz.desktop
		echo 'Categories=System;' >> /etc/xdg/autostart/compiz.desktop;;

	4.5)	apt-get install -f -y --allow-unauthenticated p7zip-full aisleriot alsa-oss anjuta arj aspell audacity b43-fwcutter bchunk binutils blender bogofilter bootchart build-essential bum bzip2 bzr ccd2iso cdparanoia cdrdao checkgmail cheese clamav clamav-freshclam clamtk compiz compiz-plugins compizconfig-backend-gconf compizconfig-settings-manager conky-std cvs devede devhelp dragonplayer dvdauthor dvdbackup dvdisaster dvdrip dvdrip-utils dvdstyler dvgrab easytag elinks f-spot faac faad fakeroot fancontrol ffmpeg2theora file-roller flac ftp gdesklets gedit genisoimage gimp glade gnome-codec-install medit wavpack preload metacity-themes gtk-theme-switch pidgin-plugin-pack gstreamer-tools debootstrap kolourpaint4 unrar mppenc gstreamer0.10-plugins-ugly swh-plugins kdenlive vorbis-tools ksnapshot pidgin-extprefs pidgin-themes gnome-icon-theme-suede xvid4conf lives gtkpod id3v2 hardinfo patchutils gnome-icon-theme-gperfection2 nrg2iso qemu  krita  kdemultimedia-kio-plugins python-chm python-lxml ttf-isabella ttf-xfree86-nonfree-syriac gstreamer0.10-plugins-bad-multiverse pidgin-sipe soundkonverter qt4-designer dh-buildinfo mp3gain vorbisgain frei0r-plugins squashfs-tools qt4-demos ttf-summersby xmltv-util isomaster qemu-launcher p7zip gnome-themes-extras industrialtango-theme k3b k3d phatch tidy speex gnupod-tools ttf-uralic kvirc pidgin-guifications qt4-dev-tools kdeartwork-emoticons oss-compat gpp qt4-qmake devscripts ttf-xfree86-nonfree dctrl-tools videotrans tvtime mdf2iso gtk-recordmydesktop dput hfsutils rar recordmydesktop phatch-cli cabextract hydrogen exiftran outdoors-theme python-wxversion  peace-gdm-theme screenlets gstreamer0.10-fluendo-mp3 peace-session-splashes qtcreator karbon xcftools wireshark murrine-themes python-pyexiv2 pidgin gnumeric ubuntu-dev-tools wifi-radar mpg321 kompare perl-tk bsd-mailx ttf-tuffy gnome-icon-theme-nuovo ndisgtk sbackup kopete sysinfo  pbuilder tropic-wallpapers python-reportbug winbind mkvtoolnix xnest unace oxygen-cursor-theme-extra perlmagick htop lintian inkscape linux-firmware-nonfree python-reportlab youtube-dl gnome-icon-theme-yasis kino qemuctl qemubuilder hfsplus yakuake tesseract-ocr-eng wdiff ndiswrapper-utils-1.9   broadcom-sta-common k3b-extrathemes libk3b6-extracodecs imagination terminator vlc cairo-clock exaile lynx sound-juicer ripoff gdebi shutter amarok calligra avidemux mediainfo synaptic xscreensaver xscreensaver-gl-extra xscreensaver-data-extra dconf-tools git subversion cmake udisks gnome-disk-utility qdbus-qt5 qdbus gnome-themes-standard gtk3-engine* onboard;apt-get remove -y --purge samba winbind system-config-samba;;

	4.4)	apt-get remove -y --purge samba winbind system-config-samba;
		apt-get -y autoremove;;

	4.3)	apt-get install -f -y --allow-unauthenticated p7zip-full aisleriot alsa-oss anjuta arj aspell audacity b43-fwcutter bchunk binutils blender bogofilter bootchart build-essential bum bzip2 bzr ccd2iso cdparanoia cdrdao checkgmail cheese clamav clamav-freshclam clamtk compiz compiz-plugins compizconfig-backend-gconf compizconfig-settings-manager conky-std cvs devede devhelp dragonplayer dvdauthor dvdbackup dvdisaster dvdrip dvdrip-utils dvdstyler dvgrab easytag elinks f-spot faac faad fakeroot fancontrol ffmpeg2theora file-roller flac ftp gedit genisoimage gimp glade gnome-codec-install medit wavpack preload metacity-themes gtk-theme-switch pidgin-plugin-pack gstreamer-tools debootstrap kolourpaint4 unrar mppenc gstreamer0.10-plugins-ugly swh-plugins kdenlive vorbis-tools ksnapshot pidgin-extprefs pidgin-themes gnome-icon-theme-suede xvid4conf lives gtkpod id3v2 hardinfo patchutils gnome-icon-theme-gperfection2 nrg2iso qemu  krita  kdemultimedia-kio-plugins python-chm python-lxml ttf-isabella ttf-xfree86-nonfree-syriac gstreamer0.10-plugins-bad-multiverse pidgin-sipe soundkonverter qt4-designer dh-buildinfo mp3gain vorbisgain frei0r-plugins squashfs-tools qt4-demos ttf-summersby xmltv-util isomaster qemu-launcher p7zip gnome-themes-extras industrialtango-theme k3b k3d phatch tidy speex gnupod-tools kvirc pidgin-guifications qt4-dev-tools kdeartwork-emoticons oss-compat gpp qt4-qmake devscripts ttf-xfree86-nonfree dctrl-tools videotrans tvtime mdf2iso gtk-recordmydesktop dput hfsutils rar recordmydesktop phatch-cli cabextract hydrogen exiftran outdoors-theme python-wxversion  peace-gdm-theme screenlets gstreamer0.10-fluendo-mp3 peace-session-splashes qtcreator karbon xcftools wireshark murrine-themes python-pyexiv2 pidgin gnumeric ubuntu-dev-tools wifi-radar mpg321 kompare perl-tk bsd-mailx ttf-tuffy gnome-icon-theme-nuovo ndisgtk sbackup kopete sysinfo  pbuilder tropic-wallpapers python-reportbug winbind mkvtoolnix xnest unace oxygen-cursor-theme-extra perlmagick htop lintian inkscape linux-firmware-nonfree python-reportlab youtube-dl gnome-icon-theme-yasis kino qemuctl qemubuilder hfsplus yakuake tesseract-ocr-eng wdiff ndiswrapper-utils-1.9 broadcom-sta-common k3b-extrathemes libk3b6-extracodecs imagination terminator vlc cairo-clock exaile lynx sound-juicer ripoff gdebi samba shutter amarok calligra avidemux mediainfo synaptic xscreensaver xscreensaver-gl-extra xscreensaver-data-extra dconf-tools git subversion cmake udisks gnome-disk-utility qdbus-qt5 qdbus gnome-themes-standard gtk3-engine* onboard plasma-widget-folderview kdeplasma-addons kodi;;

	4.2)	apt-get install -f -y --allow-unauthenticated compiz-*
		apt-get -y autoremove
		echo '[Desktop Entry]' > /etc/xdg/autostart/compiz.desktop
		echo 'Name=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Name[en_GB]=Compiz' >> /etc/xdg/autostart/compiz.desktop
		echo 'Type=Application' >> /etc/xdg/autostart/compiz.desktop
		echo 'Exec=/usr/bin/compiz --replace' >> /etc/xdg/autostart/compiz.desktop
		echo 'Terminal=false' >> /etc/xdg/autostart/compiz.desktop
		echo 'Icon=gnome-do' >> /etc/xdg/autostart/compiz.desktop
		echo 'Comment=Engages Compiz.' >> /etc/xdg/autostart/compiz.desktop
		echo 'Categories=System;' >> /etc/xdg/autostart/compiz.desktop;;

	*) Encapsulate "Not programmed yet: ${DISTREL}";;
esac

if [[ "${MSERVER}" || "${SERVER}" ]]; then
	Center "Server / Minimal server build detected, adjusting accordingly."
	QuestForSpeed "@"
fi

if ! [[ "${MSERVER}" ]]; then
	E=$((dpkg-query -l "conky-all" | grep "ii")2>/dev/null)
	F=$((dpkg-query -l "conky-std" | grep "ii")2>/dev/null)
	if ! [[ "$E" || "$F" ]]; then
		apt-get install -f -y --allow-unauthenticated conky-all
	fi
	E=$((dpkg-query -l "conky-all" | grep "ii")2>/dev/null)
	F=$((dpkg-query -l "conky-std" | grep "ii")2>/dev/null)
	if ! [[ "$E" || "$F" ]]; then
		apt-get install -f -y --allow-unauthenticated conky-std
	fi
fi
#Templates = for synaptic etc.

if ! [[ "${MSERVER}" ]]; then
	INSTALLED=$((dpkg-query -l "software-properties-gtk" | grep "ii")2>/dev/null)
	if ! [[ "${INSTALLED}" ]]; then
		Center "Installing software properties & unhiding it for ${DISTREL}"
		FullBar
		apt-get install -f -y --allow-unauthenticated software-properties-gtk
		if [[ -f "/usr/share/applications/software-properties-gtk.desktop" ]]; then
			sed -i "s/NoDisplay=true/NoDisplay=false/" /usr/share/applications/software-properties-gtk.desktop
		fi
	fi
fi

if [[ -f "/etc/lsb-release" ]]; then
    DISTREL=$(cat /etc/lsb-release | sed -n 's/^DISTRIB_RELEASE=[ \t]*\(.*\)/\1/p')
fi

if [[ -f '/usr/share/icons/Ultimate Edition Dark Glass/scalable/logo.svg' ]]; then
	Encapsulate "Setting Default Start Icon"
	update-alternatives --install "/usr/share/icons/gnome/scalable/places/start-here.svg" start-here.svg '/usr/share/icons/Ultimate Edition Dark Glass/scalable/logo.svg' 15

#Fix for hosed broken services.
else
	Center "Minimal server, no startup applications will be installed."
fi
apt-get install -f -y
Center "Cleaning out old kernels."
dpkg -l linux-{image,headers,modules}-* | awk '/^ii/{print $2}' | egrep '[0-9]+\.[0-9]+\.[0-9]+' | grep -v $(uname -r | cut -d- -f-2) | xargs apt-get -y purge
INSTALLED=$((dpkg-query -l "xfsprogs" | grep "ii")2>/dev/null)
if ! [[ "${INSTALLED}" ]]; then
	Center "Installing additional filesystem support."
	FullBar
	CUSTOMPACKAGES=( "mtools" "e2fsprogs" "jfsutils" "reiserfsprogs" "xfsprogs" "mdadm" "btrfs-tools" "ntfs-3g" "mdadm" "exfat-fuse" "exfat-utils" "dosfstools" );
	TMP="${DISTTYPE}"
	DISTTYPE="custom"
	QuestForSpeed "@"
	DISTTYPE="${TMP}"
fi
if [[ -f "cache" ]]; then
	Center "Cleaning up..."
	#apt-get autoremove -f -y
	#apt-get clean
	#apt-get autoclean
else
	Center "Not cleaning up old packages, cache switched engaged"
	Encapsulate "We will move them out to keep the cache when we exit chroot."
	Encapsulate "Purging unused packages."
	#apt-get autoremove -f -y 2>/dev/null
fi

FullBar
EXIT
#if [[ -f /var/lib/dbus/machine-id ]]; then
#	Center "Removing diversion."
#	rm /sbin/initctl
#	dpkg-divert --rename --remove /sbin/initctl
#	rm /var/lib/dbus/machine-id
#fi
# ==============================================================================
# This code was automatically cleaned up using code-cleanup
# title			:code-cleanup
# description		:Bash code cleanup script
# Author		:root
# date			:10/23/2013
# version		:1.7.2-1
# http://ultimateedition.info/
# ==============================================================================
