├── README.md ├── demon-installer-workflow.sh ├── demon-installer.sh ├── desktop └── demon-installer.desktop ├── icons ├── demon-64-padded-white.png ├── demon-64-white.png └── demon-install-icon.png └── images └── screenshot.png /README.md: -------------------------------------------------------------------------------- 1 | # Demon-Linux-Installer 2 | 3 | https://www.demonlinux.com 4 | 5 | ![Screenshot](images/screenshot.png) 6 | 7 | The Demon Linux (VM) Installer Program - This repository is ONLY for the installer and please submit any bugs to this repository if you have installation problems with The Demo. The Demon is a port of Debian Linux shares some of the same package managers developed by the team at Debian. 8 | 9 | Some things to know, 10 | * The Demon should be installed in VMWare/Virtualization environments only. 11 | * If you find any missing drivers or applications, please let me know via email. 12 | 13 | OS System Requirements, 14 | * 4 GB RAM 15 | * 30GB+ of HDD space 16 | * 2 cores/processors for CPU 17 | -------------------------------------------------------------------------------- /demon-installer-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Douglas Berdeaux, 2021 3 | # RackunSec 4 | # Version 3.4.17 - for Demon LINUX 5 | 6 | # Check UID: 7 | if [ "$(whoami)" != "root" ]; then 8 | printf "[!] You need to run the installer as root, as we will be performing disk operations.\n[!] Exiting."; 9 | exit 1 10 | fi 11 | 12 | # move the installer app out of the menu temporarily: 13 | mv /usr/share/applications/demon-installer.desktop /tmp 14 | 15 | ### CONSTANTS: 16 | # OS Specific: 17 | #export KERNEL=linux-image-amd64 # update this. Do not put the "linux-image-" part. 18 | #export KERNEL=linux-image-4.19.0-5-amd64 19 | export KERNELVERSION=4.19.0-16-amd64 20 | export OS="Demon Linux 3.4" 21 | export WORKINGDIR=/mnt/demon 22 | export LOCALICONS=/usr/share/demon/images/icons/ 23 | export TITLETEXT="Demon Linux - Advanced Live Installer" 24 | export WINDOWICON="${LOCALICONS}demon-64-white.png" 25 | export WINDOWIMAGE="${LOCALICONS}demon-install-icon.png" 26 | export SECICON="${LOCALICONS}sec-installer.png" 27 | export GEARICON="${LOCALICONS}demon-config-small.png" 28 | 29 | # App specific: 30 | export TITLE="--title " 31 | export ENTRY="--inputbox " 32 | export MENU="--menu" 33 | export YESNO="--yesno " 34 | export MSGBOX="--msgbox " 35 | export PASSWORD="--passwordbox " 36 | export DIALOGMENU="$(which yad) --window-icon=$WINDOWICON --width=500 --height=200 --center" 37 | export DIALOG="$(which yad) --window-icon=$WINDOWICON --center" 38 | export SECDIALOG="$(which yad) --window-icon=$SECICON --center" 39 | export TITLE="--always-print-result --dialog-sep --image=$WINDOWIMAGE --title=" 40 | export SECTITLE="--always-print-result --dialog-sep --image=$SECICON --title=" 41 | export GEARTITLE="--always-print-result --dialog-sep --image=$GEARICON --title=" 42 | export TEXT="--text=" 43 | export ENTRY="--entry " 44 | export ENTRYTEXT="--entry-text " 45 | export MENU="--list --column=Pick --column=Info" 46 | export YESNO=" --button=Yes:0 --button=No:1 " 47 | export MSGBOX=" --button=Ok:0 " 48 | export PASSWORD="--entry --hide-text " 49 | export TITLETEXT='"Demon Linux - HDD Installation Tool"' 50 | export PARTITIONPROG="gparted" 51 | export SPANFONT="" # Damn, this is a sexy font. 52 | export INSTALLDISK="" 53 | export ROOTPASS="" 54 | 55 | ### This function forks the loading bar message box using "tail": 56 | progressBar () { 57 | tail -f /etc/issue |yad --progress --pulsate --no-buttons --auto-close \ 58 | --text="\n$SPANFONT $1 " --width=350 --height=17 --center --title=$TITLETEXT \ 59 | --window-icon=$WINDOWICON --percentage=13 --progress-text=" Grinding things up. Please Wait... " --image=$GEARICON 60 | } 61 | 62 | getRootPasswd () { 63 | PASSWD1=1 64 | PASSWD2=2 65 | while [[ "$PASSWD1" != "$PASSWD2" ]] 66 | do 67 | PASSWD1=$($DIALOG $SECTITLE"$TITLETEXT" $MSGBOX --text="\nPlease enter a STRONG root user password: " --entry --hide-text) 68 | PASSWD2=$($DIALOG $SECTITLE"$TITLETEXT" $MSGBOX --text="\nPlease re-enter the root user password: " --entry --hide-text) 69 | if [[ "$PASSWD1" != "$PASSWD2" ]] 70 | then 71 | $DIALOG $TITLE"$TITLETEXT" $MSGBOX --text="\nThe passwords entered do not match.\nPlease try again." 72 | else 73 | # Check password complexity: 74 | numcheck=$(echo $PASSWD1|egrep -E '[0-9]'|wc -l) 75 | lengthcheck=$(echo $PASSWD1|wc -c) 76 | specialcharcheck=$(echo $PASSWD1|egrep -E '[^0-9A-Za-z]'|wc -l) 77 | upcasecheck=$(echo $PASSWD1|egrep '[A-Z]'|wc -l) 78 | lcasecheck=$(echo $PASSWD1|egrep '[a-z]'|wc -l) 79 | 80 | numcheck=$(echo $numcheck|sed -r 's/1/True/g') 81 | numcheck=$(echo $numcheck|sed -r 's/0/False/g') 82 | specialcharcheck=$(echo $specialcharcheck|sed -r 's/1/True/g') 83 | specialcharcheck=$(echo $specialcharcheck|sed -r 's/0/False/g') 84 | upcasecheck=$(echo $upcasecheck|sed -r 's/1/True/g') 85 | upcasecheck=$(echo $upcasecheck|sed -r 's/0/False/g') 86 | lcasecheck=$(echo $lcasecheck|sed -r 's/1/True/g') 87 | lcasecheck=$(echo $lcasecheck|sed -r 's/0/False/g') 88 | 89 | $DIALOG $TITLE"$TITLETEXT" --text="\nAre you 100% sure that you want this as your root password?\t\n\nLength:\t${lengthcheck}\nSpecial Character:\t$specialcharcheck\nUpper Case:\t$upcasecheck\nLower case:\t$lcasecheck\nNumber:\t${numcheck}" --button=Yes:0 --button=No:1 90 | passwdans=$? 91 | if [[ "$passwdans" -eq 1 ]] 92 | then 93 | printf "[log] passwdans: ${passwdans}\n" 94 | getRootPasswd 95 | else 96 | ROOTPASS=$PASSWD1 97 | printf "[log] passwdans: ${passwdans}\n" 98 | fi 99 | fi 100 | done 101 | } 102 | 103 | 104 | ### This function stops the loading bar message box by killing tail: 105 | killBar () { # tail was a really good idea here, Tony :) 106 | killall -KILL tail 2>/dev/null 107 | } 108 | 109 | ### This function quits the installer: 110 | quit (){ 111 | $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"$SPANFONT \nQuitting the installer now. " 112 | exit 1 113 | } 114 | 115 | ### Ensure insternet connection 116 | progressBar "Creating an active internet connection.\n" & 117 | #/etc/init.d/network-manager start 118 | dhclient -v # this should be fine. 119 | HTTPTEST=$(curl -sIL https://demonlinux.com/index.php | head -n 1 | awk '{print $2}') 120 | if [ "$HTTPTEST" != "200" ]; 121 | then 122 | yad --text="You do not have an active internet connection.\nThis means we cannot install a new kernel or proceed.\n\nExiting." --center --window-icon=$GEARICON --title=$TITLETEXT 123 | exit; 124 | fi 125 | killBar 126 | 127 | ### Update YAD 128 | progressBar "Updating software respositories\n and installing dependencies \n" & 129 | apt update 130 | apt install cryptsetup yad lvm2 -y 131 | killBar; 132 | 133 | ### Run the workflow: 134 | $DIALOG $TITLE"$TITLETEXT" --button=Yes:0 --button=No:1 --button=Help:2 \ 135 | --text="${SPANFONT}\nThis is the $OS Disk Installation Utility.\nIt is HIGHLY RECOMMENDED that $OS\n\ 136 | is installed in a virtualized environment to ensure the best,\nuniform experience for all users.\n\nRackünSec cannot \ 137 | support every piece of hardware\nas he is has a day job :( \n\nDo you want to continue? \n" --height=35 --fixed 138 | 139 | ans=$? 140 | if [ $ans = 1 ]; then 141 | exit 0 142 | elif [ $ans = 2 ];then # Awe, snacks! 143 | $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"$SPANFONT Firefox is now going to start and direct you to the video tutorial. \nPlease wait." 144 | firefox-esr 'https://demonlinux.com/tutorials.php' & 145 | fi 146 | 147 | getRootPasswd; 148 | 149 | ## Disk Encryption? 150 | $SECDIALOG $SECTITLE"$TITLETEXT" --button=Yes:1 --button=No:0 --button=Quit:2\ 151 | --text="${SPANFONT}\nWould you like to enable full disk encryption? \n" --height=35 --fixed 152 | ans=$? 153 | if [ $ans = 1 ]; then 154 | export DISKENC=1 155 | printf "[log] Enabling full disk encryption.\n" 156 | elif [ $ans = 0 ];then # Awe, snacks! 157 | export DISKENC=0 158 | printf "[log] Full disk encryption declined.\n" 159 | else 160 | quit 161 | fi 162 | 163 | ### Create time adjustment file: 164 | echo "0.0 0 0.0" > /etc/adjtime 165 | echo "0" >> /etc/adjtime 166 | echo "LOCAL" >> /etc/adjtime 167 | 168 | ### Fix for gparted being inhibited by udisks-daemon: 169 | killall -KILL udisks-daemon 2>/dev/null 170 | 171 | ### Choose the drive to install to: 172 | yad --text="$SPANFONT \nLet's select a disk to install $OS to and start up \ 173 | $PARTITIONPROG.\nIn $PARTITIONPROG create one root partition labeled \ 174 | / with the \nFS format of your choice. \nPay attention to \ 175 | the drive names in the \"Partition\" column,\n\n E.g.:sda1, \ 176 | sda2.\n\nWhen done with $PARTITIONPROG, hit the X button \ 177 | and this installation will continue. \n " \ 178 | --center --window-icon=$WINDOWICON --no-wrap --title="$OS Installer" --image=$WINDOWIMAGE --fixed 179 | # This is important to chnage back, so, OFS is the original. 180 | OFS=$IFS # Field Separator for loops. 181 | IFS=$"\n" # change to newline from \s and we will revert later. 182 | # ONLY SHOW PARTITIONS: 183 | #DRIVES=$(cat /proc/partitions | grep sd | egrep -v 'sd[a-z][0-9]') 184 | DRIVES=$(cat /proc/partitions | egrep -E 'sd.$') 185 | # E.g.: 186 | # 8 0 20971520 sda 187 | # 8 1 19456000 sda1 188 | # 8 2 1514496 sda2 189 | for i in $DRIVES; do 190 | partdrive=$(echo $i|awk '{print $4}'); 191 | partdrivesize=$(echo $i|awk '{print $3}'); 192 | partdrivemenu="$partdrive $partdrivesize" 193 | printf "PARTDRIVE: $partdrive, PARTDRIVESIZE: $partdrivesize, PARTDRIVEMENU: $partdrivemenu\n"; 194 | done 195 | 196 | # return the field separator. If not, this could cause undefinied behavior or crashes: 197 | IFS=$OFS 198 | PARTDRIVE=$($DIALOGMENU $TITLE"$TITLETEXT" $MENU $TEXT"\nPlease select a drive to partition. Before partitioning, ensure that you create an MSDOS partition table. \n" $partdrivemenu) 199 | PARTDRIVE=$(echo $PARTDRIVE |sed -re 's/\|.*//') 200 | if [ "$PARTDRIVE" = "Exit" ]; then 201 | quit; 202 | fi 203 | printf "[log] Part: $PARTITIONPROG /dev/$PARTDRIVE\n" 204 | $PARTITIONPROG /dev/$PARTDRIVE 205 | 206 | 207 | ### Choosing the Install (/) Partition: 208 | OFS=$IFS # Field Separator for loops. 209 | IFS="\n" # change to newline from \s and we will revert later. 210 | PARTINST=$(cat /proc/partitions | egrep "${partdrive}[0-9]+"); 211 | 212 | for i in $PARTINST; do 213 | tempsize=$(echo $PARTINST | awk '{print $3}') 214 | if [ "$tempsize" = "1" ]; then 215 | PARTINST=$(echo $PARTINST | sed -r "s/$i//") 216 | fi 217 | done 218 | for i in $PARTINST; do 219 | part=$(echo $i | awk '{print $4}') 220 | partsize=$(echo $i| awk '{print $3}') 221 | partmenu="$partmenu $part $partsize" 222 | done 223 | TARGETPART="" 224 | IFS=$OFS # revert field separator 225 | while [ "$TARGETPART" = "" ] 226 | do 227 | TARGETPART=$($DIALOGMENU $TITLE"$TITLETEXT" $MENU $TEXT"\n Please select a partition to install the root system to. " $partmenu) 228 | done 229 | TARGETPART=`echo $TARGETPART | cut -d "|" -f 1` 230 | 231 | if [ "$TARGETPART" = "Exit" ]; then 232 | quit; 233 | fi 234 | 235 | ## ENCRYPT THE DRIVE: 236 | if [ "$DISKENC" == "1" ]; then 237 | umount $TARGETPART # bring it offline. 238 | $SECDIALOG $SECTITLE"$TITLETEXT" --button="I Promise!":1 \ 239 | --text="${SPANFONT}\nPlease choose a strong passphrase to encrypt your disk in the following window. \n" --height=35 --fixed 240 | ## Step one: encrypt the partition: 241 | tilix -e "/bin/bash -c \"while ! cryptsetup luksFormat --type luks1 /dev/$TARGETPART;do echo 'LUKS Setup failed, try again ... ';done\"" 242 | pid=$(ps aux | egrep -Ei 'while.*[c]ryptsetup' | awk '{print $2}') 243 | while [ "$(ps aux | egrep 'while...cryptsetup.luks[F]'|wc -l)" == "1" ] 244 | do # sleep until this prcess is done: 245 | sleep 1 246 | done 247 | ## Step 2: unlock and mount the encrypted partition: 248 | tilix -e "/bin/bash -c \"while ! cryptsetup luksOpen /dev/$TARGETPART demonluks;do echo 'Bad passphrase or disk not found ... '; done\"" 249 | while [ "$(ps aux | egrep 'while...cryptsetup.luks[O]'|wc -l)" == "1" ] 250 | do # sleep until this process is done: 251 | sleep 1 252 | done 253 | printf "[log] Creating mapper objects ... " 254 | pvcreate /dev/mapper/demonluks 255 | vgcreate cryptvg /dev/mapper/demonluks 256 | lvcreate -n lvroot -l 100%FREE cryptvg 257 | printf "[log] Done completing mapper objects." 258 | ## mount the encrypted drive: 259 | if [[ "$DISKENC" == "1" ]] 260 | then 261 | sleep 1 262 | mkfs.ext4 /dev/mapper/cryptvg-lvroot 263 | sleep 1 264 | mkdir /mnt/demon 2>/dev/null 265 | mount /dev/mapper/cryptvg-lvroot /mnt/demon 266 | fi 267 | else 268 | # Simply mount /dev/$PARTINST to /mnt/demon 269 | printf "[log] Mounting /dev/$TARGETPART to /mnt/demon" 270 | mkdir /mnt/demon 2>/dev/null 271 | mount /dev/$TARGETPART /mnt/demon 272 | fi 273 | 274 | export FSTYPE=$(mount | grep /dev/$TARGETPART|awk '{print $5}') 275 | printf "[log] FSTYPE of /dev/$TARGETPART is $FSTYPE\n" 276 | 277 | HOMEINST=`echo $PARTINST | sed -r "s/$TARGETPART//"` 278 | for i in $HOMEINST; do 279 | homepart="$i" 280 | homepartsize=`grep -m 1 "$i" /proc/partitions | awk '{print $3}'` 281 | homepartmenu="$homepartmenu $homepart $homepartsize" 282 | done 283 | HOMEPART="root" # install the /home into the / 284 | 285 | ### Get the chosen hostname of the new system: 286 | TARGETHOSTNAME=$($DIALOG $TITLE"$TITLETEXT" $ENTRY $TEXT"$SPANFONT Please enter the hostname for this newly installed system.\n You can ONLY use the following characters: [a-z] [A-Z] [0-9].\n ") 287 | 288 | ### Get the kernel from the user: 289 | for kernel in $(apt-cache search linux-image|egrep -E '^linux-image.+[0-9]\..+64'|grep -v dbg|sort -u|awk '{print $1}'); do KERNELS="$KERNELS $kernel"; done 290 | KERNEL=$(yad --list --column="New Kernel" $KERNELS \ 291 | --width=500 --height=300 --window-icon=64-icon.png\ 292 | --text="\nPlease choose a kernel to use on your installed Demon.\n"\ 293 | --image=${WINDOWIMAGE}) 294 | KERNEL=$(echo $KERNEL|sed -r 's/\|//g'); # drop the pipe made from yad 295 | printf "[log] KERNEL: $KERNEL" 296 | 297 | ### Timezone Setting 298 | $DIALOG $TITLE"$TITLETEXT" $YESNO $TEXT"$SPANFONT Is your system clock set to your current local time? \n\nAnswering no will indicate it is set to UTC" 299 | if [ $? = 0 ]; then 300 | if [ "$(grep "UTC" /etc/adjtime)" != "" ]; then 301 | sed -i -e "s|UTC|LOCALTIME|g" /etc/adjtime 302 | fi 303 | else 304 | if [ "$(grep "LOCALTIME" /etc/adjtime)" != "" ]; then 305 | sed -i -e "s|LOCALTIME|UTC|g" /etc/adjtime 306 | fi 307 | fi 308 | cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sort > /tmp/demon-installer-script.zoneinfo 309 | for i in `cat /tmp/demon-installer-script.zoneinfo`; do 310 | ZONES="$ZONES $i Timezone" 311 | done 312 | rm /tmp/demon-installer-script.zoneinfo 313 | ZONESINFO="" 314 | while [ "$ZONESINFO" = "" ] 315 | do 316 | ZONESINFO=`$DIALOGMENU $TITLE"$TITLETEXT" $MENU $TEXT"Please select a timezone for your system" "America/New_York" "America/New_York" $ZONES` 317 | done 318 | ZONESINFO=`echo $ZONESINFO | cut -d "|" -f 1` 319 | if [ "$ZONESINFO" = "Exit" ]; then 320 | quit; 321 | fi 322 | echo "$ZONESINFO" > /etc/timezone 323 | cp /usr/share/zoneinfo/$ZONESINFO /etc/localtime 324 | 325 | ### Final Confirmation: 326 | if [[ "$DISKENC" == "1" ]] 327 | then 328 | export diskenc="True" 329 | else 330 | export diskenc="False" 331 | fi 332 | $DIALOG $TITLE"$TITLETEXT" $YESNO $TEXT"$SPANFONT \nPlease verify that the information below is correct.\ 333 | \n\nOperating System: $OS\nTimezone: $ZONESINFO\nFilesystem: $FSTYPE\nPartition: $TARGETPART\nDisk Encryption: $diskenc\nKernel: $KERNEL\nHostname: $TARGETHOSTNAME\n\nDo you want to continue?" --width=600 --fixed 334 | if [ $? != 0 ]; then 335 | quit; 336 | fi 337 | 338 | ### RSYNC the OS/Live files to HDD: 339 | killBar; 340 | progressBar "Copying the files to /dev/$TARGETPART. \nThis will take a long time - ($(df -h 2>/dev/null | awk '$1 ~ /overlay|sr0|loop/ {gsub(/[.,]/,"",$2); gsub(/G/,"00",$2); gsub(/M/,"",$2); size+=$2}END{print size}')MB). " & 341 | # First update the root password to what the user typed : 342 | printf "[log] Updating root password locally before syncing disks.\n" 343 | echo "root:${ROOTPASS}" | chpasswd 344 | printf "[log] Starting RSYNC ... \n" 345 | printf "[log] Installing LightDM before running RSYNC ...\n" 346 | apt install lightdm -y 347 | rsync -a / $WORKINGDIR --ignore-existing --exclude=/{lib/live,usr/lib/live,live,cdrom,mnt,proc,run,sys,media,appdev,demon-dev,tmp} 348 | # Remove the auto start of startx from boot up (force login with new password) 349 | printf "[log] Removing startx from rc.local ... \n" 350 | sed -ir 's/^su.*startx.*//' $WORKINGDIR/etc/rc.local 351 | # install lightdm: 352 | printf "[log] Installing LightDM ... \n" 353 | printf "[log] copying LightDM config into new installation ...\n" 354 | cp /usr/share/demon/files/lightdm-gtk-greeter.conf $WORKINGDIR/etc/lightdm/ # copy the config file over to new installation 355 | if [[ "$DISKENC" == "1" ]] 356 | then 357 | # get UUID of disk 358 | export DISKUUID=$(blkid | grep crypto_LUKS|awk -F\" '{print $2}') 359 | echo "demonluks UUID=$DISKUUID none luks" >> ${WORKINGDIR}/etc/crypttab 360 | export EXT4UUID=$(blkid | grep -i ext4 | awk -F\" '{print $2}') 361 | echo "UUID=$EXT4UUID / ext4 errors=remount-rw 0 1" >> ${WORKINGDIR}/etc/fstab 362 | chroot $WORKINGDIR apt install cryptsetup-initramfs -y 363 | cp ${WORKINGDIR}/sbin/e2fsck ${WORKINGDIR}/mnt/demon/sbin/fsck.luks 364 | chroot $WORKINGDIR update-initramfs -u -k all 365 | fi 366 | printf "[log] RSYNC Complete, making new directories ... \n" 367 | mkdir -p $WORKINGDIR/{proc,mnt,run,sys,media/cdrom,tmp} 368 | chmod a+rxw $WORKINGDIR/tmp # This is required for APT later ... 369 | # Remove live hooks: 370 | printf "[log] Removing initRAMFS from live ... \n" 371 | rm $WORKINGDIR/usr/share/initramfs-tools/hooks/live 372 | printf "[log] Removing /etc/live ... \n" 373 | rm -rf $WORKINGDIR/etc/live 374 | killBar; 375 | 376 | progressBar "Performing post-install steps now. " & 377 | printf "[log] Mounting /proc, /dev/, /sys, /run\n" 378 | printf "[log] WORKINGDIR currently mounted as: $(mount | grep $WORKINGDIR)\n" 379 | #prepare the chroot environment for some post install changes 380 | mount -o bind /proc $WORKINGDIR/proc 381 | mount -o bind /dev $WORKINGDIR/dev 382 | mount -o bind /dev/pts $WORKINGDIR/dev/pts 383 | mount -o bind /sys $WORKINGDIR/sys 384 | mount -o bind /run $WORKINGDIR/run 385 | if [[ "$DISKENC" == 0 ]] 386 | then 387 | rm -f $WORKINGDIR/etc/fstab 388 | fi 389 | rm -f $WORKINGDIR/etc/profile.d/zz-live.sh 390 | 391 | #create the new fstab for the chrooted env: 392 | if [[ "$DISKENC" == "0" ]] 393 | then 394 | printf "[log] Making encrypted disk FSTAB entries on the new FS ... \n" 395 | cat > $WORKINGDIR/etc/fstab < 399 | 400 | proc /proc proc defaults 0 0 401 | # /dev/$TARGETPART 402 | /dev/$TARGETPART / $FSTYPE relatime,errors=remount-ro 0 1 403 | FOO 404 | fi 405 | killBar; 406 | 407 | ### Clean up Fresh Install: 408 | printf "[log] Fixing initRAMFS tools ... \n" 409 | progressBar "Fixing initram-fs tools. " & 410 | # get rid of the "live" initramfs: 411 | rm $WORKINGDIR/usr/sbin/update-initramfs 412 | cp $WORKINGDIR/usr/sbin/update-initramfs.orig.initramfs-tools $WORKINGDIR/usr/sbin/update-initramfs 413 | killBar; 414 | 415 | printf "[log] Removing some live-OS diversions. \n" 416 | progressBar "Removing some live-OS diversions. " & 417 | rm -rf $WORKINGDIR/usr/lib/update-notifier/apt-check 418 | rm -rf $WORKINGDIR/usr/sbin/anacron 419 | killBar; 420 | # Run the GRUB2 installer in a new Terminal window: 421 | progressBar "Installing GRUB2 and the kernel on your new system." & 422 | # This is done this way because of the captive Grub2 apt-get installation 423 | printf "[log] Updating APT in the chrooted $WORKINGDIR ... \n" 424 | chroot $WORKINGDIR apt update 425 | printf "[log] Installing GRUB in the chroot, $WORKINGDIR\n" 426 | mkdir $WORKINGDIR/tmp 2>/dev/null 427 | chmod a+rxw $WORKINGDIR/tmp 428 | cat > $WORKINGDIR/tmp/grub-install.sh << GRUB 429 | #!/bin/bash 430 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install grub2 grub-pc grub-common; 431 | GRUB 432 | chroot $WORKINGDIR chmod +x /tmp/grub-install.sh 433 | chroot $WORKINGDIR /tmp/grub-install.sh 434 | if [[ "$DISKENC" == "1" ]] 435 | then # add a line into GRUB for decryption of drive: 436 | echo "GRUB_ENABLE_CRYPTODISK=y" >> $WORKINGDIR/etc/default/grub 437 | #printf "[log] catting \"$WORKINGDIR/etc/default/grub\"\n" 438 | #cat $WORKINGDIR/etc/default/grub 439 | fi 440 | printf "[log] Installing Grub to /dev/$PARTDRIVE\n"; 441 | chroot $WORKINGDIR grub-install --root-directory=/ --no-floppy /dev/$PARTDRIVE; 442 | # I know that this is very specific as to what OS/kernel to install, but I am still working this aht: 443 | printf "[log] Re-installing kernel $KERNEL \n" 444 | chroot $WORKINGDIR apt -y -V install $KERNEL --reinstall # this will generate a new /boot/vmlinuz, hopefully. 445 | 446 | printf "[log] update-initramfs: -c -k all \n" 447 | if [[ "$DISKENC" == "0" ]] 448 | then 449 | #chroot $WORKINGDIR update-initramfs -c -k $KERNELVERSION # create a new symlink for /initrd 450 | #chroot $WORKINGDIR update-initramfs -c -k all # create a new symlink for /initrd 451 | chroot $WORKINGDIR update-initramfs -c -k $KERNEL # create a new symlink for /initrd 452 | fi 453 | printf "[log] update-grub: \n" # Set up GRUB for pretty: 454 | echo "GRUB_GFXMODE=1024x768" >> $WORKINGDIR/etc/default/grub 455 | echo "GRUB_BACKGROUND=\"/usr/share/demon/images/splash.png\"" >> $WORKINGDIR/etc/default/grub 456 | printf "[log] copying GRUB splash.png image to $WORKINGDIR/boot/grub\n" 457 | chroot $WORKINGDIR update-grub # required to make grub.cfg! 458 | killBar; 459 | printf "[log] Setting up hostname in the chrooted environment ... \n" 460 | progressBar "Setting up $TARGETHOSTNAME. " & 461 | echo $TARGETHOSTNAME > $WORKINGDIR/etc/hostname 462 | echo "127.0.0.1 localhost" >> $WORKINGDIR/etc/hosts 463 | echo "127.0.0.1 $TARGETHOSTNAME" >> $WORKINGDIR/hosts 464 | touch $WORKINGDIR/etc/resolv.conf 465 | killBar; 466 | # Clean up system: 467 | progressBar "Cleaning your fresh, new environment. " & 468 | sleep 1 469 | printf "[log] Clearing our Xsession-errors ... \n" 470 | chroot $WORKINGDIR echo "" > /root/.xsession-errors 471 | printf "[log] Doing APT-Clean in the chroot ... \n" 472 | chroot $WORKINGDIR apt clean # These will not remove directories: 473 | chroot $WORKINGDIR rm /var/lib/apt/lists/ftp* 2>/dev/null 474 | chroot $WORKINGDIR rm /var/lib/apt/lists/http* 2>/dev/null 475 | chroot $WORKINGDIR rm /root/.bash_history 2>/dev/null 476 | chroot $WORKINGDIR rm /root/.ssh/known_hosts 2>/dev/null 477 | chroot $WORKINGDIR rm -rf /root/Downloads/* 2>/dev/null 478 | chroot $WORKINGDIR rm -rf /root/Desktop/* 2>/dev/null 479 | chroot $WORKINGDIR rm -rf /root/Videos/* 2>/dev/null 480 | killBar; 481 | progressBar "Unmounting system. Preparing for landing." & 482 | printf "[log] Unountinf FS ... \n" 483 | umount $WORKINGDIR/proc 484 | sleep 1 485 | umount $WORKINGDIR/dev/pts 486 | sleep 1 487 | umount $WORKINGDIR/dev 488 | sleep 1 489 | umount $WORKINGDIR/sys 490 | sleep 1 491 | umount $WORKINGDIR/run 492 | sleep 1 493 | umount $WORKINGDIR 494 | sleep 1 495 | killBar; 496 | # TODO Make sure by checking files/dirs before saying it was a success! 497 | $DIALOG $TITLE"$TITLETEXT" --button=Yes:0 --button=No:1 --button=Help:2 --text="$SPANFONT $OS has been\nsuccessfully installed on your system, $TARGETHOSTNAME. \n\nWould you like to reboot now and test it out? " --image=$WINDOWIMAGE --window-image=$WINDOWIMAGE; 498 | ans=$? 499 | if [ $ans = 0 ]; then 500 | $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"$SPANFONT Thank you for choosing Demon Linux. \n\n~Douglas Berdeaux\nWeakNetLabs@Gmail.com" --image=$WINDOWIMAGE --window-image=$WINDOWIMAGE; 501 | sleep 5; # so that you can see. 502 | reboot; 503 | exit 0 504 | elif [ $ans = 1 ];then # Awe, snacks! 505 | $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"$SPANFONT Thank you for choosing Demon Linux. \n\n~Douglas Berdeaux\nWeakNetLabs@Gmail.com" --image=$WINDOWIMAGE --window-image=$WINDOWIMAGE; 506 | fi 507 | 508 | # move the installer app back into the menu: 509 | mv /tmp/demon-installer.desktop /usr/share/applications/ 510 | exit 0; 511 | -------------------------------------------------------------------------------- /demon-installer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ### Updated for new staging area /var/demon/ ::muscle emoji goes here:: 3 | ### Douglas Berdeaux, Demon Linux, WeakNet Laboratories, 2019 4 | ### Update the installer EACH TIME RAN 5 | DLI_ROOT=/var/demon/installer 6 | GITNAME=Demon-Linux-Installer 7 | GITURL=https://github.com/weaknetlabs/${GITNAME} 8 | 9 | if [ ! -d $DLI_ROOT ] 10 | then 11 | mkdir -p $DLI_ROOT 12 | fi 13 | 14 | # Self updating: 15 | updateMe () { 16 | if [ ! -d ${DLI_ROOT}/${GITNAME} ] # it exists, pull latest 17 | then # create a local repo: 18 | mkdir ${DLI_ROOT}/${GITNAME} 19 | git clone ${GITURL} ${DLI_ROOT}/${GITNAME} 20 | else # cd into the repo and pull latest: 21 | printf "[DEBUG] Moving into repository: ${DLI_ROOT}/${GITNAME}\n" 22 | cd ${DLI_ROOT}/${GITNAME} && git pull ${GITURL} 23 | fi 24 | 25 | if [ ! -d /usr/share/demon/images/icons ] 26 | then 27 | mkdir -p /usr/share/demon/images/icons 28 | fi 29 | 30 | # copy the new init file: 31 | cp ${DLI_ROOT}/${GITNAME}/demon-installer.sh /usr/local/sbin/demon-installer.sh 32 | chmod +x /usr/local/sbin/demon-installer.sh 33 | 34 | # copy the new workflow file: 35 | cp ${DLI_ROOT}/${GITNAME}/demon-installer-workflow.sh /usr/local/sbin/demon-installer-workflow.sh 36 | chmod +x /usr/local/sbin/demon-installer-workflow.sh 37 | 38 | # copy the icon images: 39 | cp ${DLI_ROOT}/${GITNAME}/icons/* /usr/share/demon/images/icons/ 40 | 41 | # copy the desktop files: 42 | cp ${DLI_ROOT}/${GITNAME}/desktop/* /usr/share/applications/ 43 | 44 | # complete. 45 | printf "[!] Updated to the latest version. \n" 46 | } 47 | 48 | # Step 1: UPDATE 49 | updateMe 50 | # Step 2: Run the Workflow portion 51 | /usr/local/sbin/demon-installer-workflow.sh 52 | -------------------------------------------------------------------------------- /desktop/demon-installer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=Demon Linux Installer 5 | Comment=Install the Demon to a Hard Disk 6 | Exec=demon-installer.sh 7 | Icon=/usr/share/demon/images/icons/demon-install-icon.png 8 | StartupNotify=false 9 | Categories=demonlinux 10 | -------------------------------------------------------------------------------- /icons/demon-64-padded-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackunSec/Demon-Linux-Installer/0bdd94a1ac4adf6c527d8b3c9530e703d9f0fd19/icons/demon-64-padded-white.png -------------------------------------------------------------------------------- /icons/demon-64-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackunSec/Demon-Linux-Installer/0bdd94a1ac4adf6c527d8b3c9530e703d9f0fd19/icons/demon-64-white.png -------------------------------------------------------------------------------- /icons/demon-install-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackunSec/Demon-Linux-Installer/0bdd94a1ac4adf6c527d8b3c9530e703d9f0fd19/icons/demon-install-icon.png -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackunSec/Demon-Linux-Installer/0bdd94a1ac4adf6c527d8b3c9530e703d9f0fd19/images/screenshot.png --------------------------------------------------------------------------------