If nobody has such a script yet, I'm going to have to write it myself

Code: Select all
#!/bin/sh
# Creates a 64-bit system bootable on UEFI & non-UEFI machines.
## https://forum.porteus.org/viewtopic.php?f=81&t=4632&p=33638#p33604
## https://forum.porteus.org/viewtopic.php?f=81&t=2700#p29085
# Change variables to fit the situation
PORTEUS='/mnt/nvme0n1p7/porteus5.0'
#ISO='/mnt/sda6/ISOs/Porteus-CINNAMON-v4.0-x86_64.iso'
ISO='mnt/nvme0n1p7/ISOs/Porteus/Porteus-CINNAMON-v5.01-x86_64-240306.iso'
USB='/mnt/sda1'
DEV='/dev/sda1'
## Run GParted to partition & format the USB drive with a msdos Partition table. ##
## Use GParted's View > Device Information to check Partition Table type. ##
## Use GParted's Device > Create Partition Table if Partition Table shows as GPT.##
## Or under Windows use: ##
## > diskpart * Run Command Prompt with Admin Rights. ##
## > list disk ##
## >.... ##
## > select disk 1 * Note: disk nbr is the nbr of the USB disk ##
## > clean ##
## > create partition primary ##
## > exit ##
function Title() {
echo -en "\033]0;$1\a";
}
Title "Porteus USB Update"
# Color definitions
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
txtgreen=$(tput setaf 2)${txtbld} # Green
rst=$(tput sgr0) # Reset
function green() {
echo -e $txtgreen"$1" $rst;
}
function redpswd() {
echo -e "$1" $txtred
}
if [ `whoami` != "root" ]; then
echo
green "USB=$USB" && echo
green "PORTEUS=$PORTEUS" && echo
green "ISO=$ISO" && echo
read -p "Press Enter to continue, Ctrl+C to cancel" && echo
fi
if [ `whoami` != "root" ]; then
redpswd "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
#cat /etc/fstab | grep "/dev/sd"
blkid $USB
if [ $? != 2 ]; then
mount $USB
fi
#echo ls -lghtUS --color=never $USB
#ls -lghtUS --color=never $USB
DIR () {
echo "$1"
ls -lghUS --time-style long-iso $1 | awk '{print $5,$6,$4,$7}'
# http://forum.porteus.org/viewtopic.php?f=81&t=3965#p29205
}
DIR "$USB"
echo
#set -x # debug
read -p "This the USB drive? " && echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit
fi
if [ -f $USB/USB_INSTALLATION.txt ]; then
read -p "Remove existing Porteus system files on $USB? [y/n] " && echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -r $USB/porteus/base/*
rm -r $USB/boot/syslinux/*
rm -r $USB/EFI/boot/*
echo ls $USB/porteus/base
ls $USB/porteus/base
echo
read -p "Press Enter to continue,,. "
fi
fi
read -p "Write porteus ISO files to the $USB drive? [y/n] " && echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
#if [ -f $USB/USB_INSTALLATION.txt ]; then
if [ -f /mnt/isoloop/USB_INSTALLATION.txt ]; then
LOOP=isoloop
else
echo Mounting $ISO
mloop $ISO
LOOP=loop
fi
echo "** Copying porteus ISO files to the USB drive. **"
echo
green "Please wait!! This can take a minute or two. "
green "And if it doesn't something is wrong!! Abort "
echo
mv $USB/boot/syslinux/porteus.cfg $USB/boot/syslinux/porteusEd.cfg
cp /mnt/$LOOP/boot/syslinux/* $USB/boot/syslinux/
cp /mnt/$LOOP/EFI/boot/* $USB/EFI/boot/
cp /mnt/$LOOP/porteus/base/* $USB/porteus/base/
sync
if [ -f $USB/boot/syslinux/porteusbkup.cfg ]; then
rm $USB/boot/syslinux/porteusbkup.cfg
mv $USB/boot/syslinux/porteus.cfg $USB/boot/syslinux/porteusbkup.cfg
cp $USB/boot/syslinux/porteusEd.cfg $USB/boot/syslinux/porteus.cfg
fi
echo ls $USB/porteus/base
ls $USB/porteus/base
if [ "$LOOP" = "loop" ]; then uloop; fi
fi
echo
green "Porteus 5.0 system update complete. Set to begin my file Restores. "
echo
read -p "Press Ctrl+C to exit & reboot, press Enter to continue..." && echo
#exit
read -p "Update /Modules, /Optional and /changes? [y/n] "
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo
green "Done"
wait
exit
fi
if [ ! -f $USB/porteussave.dat ]; then
green "Wait!! Copying $PORTEUS files to $USB/ "
mkdir $USB/changes
mkdir $USB/Modules
mkdir $USB/Optional
mkdir $USB/Guest
cp $PORTEUS/changes/*save.dat $USB/changes/
cp $PORTEUS/Modules/*.xzm $USB/Modules/
# cp $PORTEUS/rc3Modules/07-*.xzm $USB/Modules/
# cp $PORTEUS/rc3ISOModules/0*.xzm $USB/Optional/
cp $PORTEUS/Optional/gtk+2.2.24*.xzm $USB/Optional/
cp $PORTEUS/Optional/keepassx*.xzm $USB/Optional/
cp $PORTEUS/Optional/peek*.xzm $USB/Optional/
cp $PORTEUS/Optional/pysolfc-2.12.0-*.xzm $USB/Optional/
cp $PORTEUS/Optional/Tightvnc*.xzm $USB/Optional/
cp $PORTEUS/Optional/tree*.xzm $USB/Optional/
cp $PORTEUS/Optional/xmahjongg*.xzm $USB/Optional/
cp $PORTEUS/Optional/*zip*.xzm $USB/Optional/
# cp -r /home/guest/* $USB/Guest/
sync
fi
echo
echo "But first, need to find the UUID and tweak lines in "
echo "the $USB/boot/syslinux/porteus.cfg file "
echo
UUID=`blkid $DEV -o value -s UUID|cut -d\" -f 2`
echo "UUID=$UUID"
echo
echo " (line 2) TIMEOUT 300 "
echo " (line 4) DEFAULT safe "
echo " (line 43) APPEND changes=EXIT:UUID:$UUID/changes/50rc3save.dat extramod=UUID:$UUID/Modules "
echo " (line 49) copy lines 38-49 after it "
echo " (line 51) LABEL safe "
echo " (line 52) MENU LABEL Graphics mode (Safe) "
echo " (line 55) APPEND extramod=UUID:$UUID/Modules noload=save.dat "
echo " (line 60) allowed resolution and with "
echo " (add 61) NO changes saved. "
xed $USB/boot/syslinux/porteus.cfg > /dev/null
echo
echo "Adding Backup folders to $USB"
if [ ! -f $USB/My_Files/My_Webpages/* ]; then
mkdir $USB/My_Files
USB=$USB/My_Files
mkdir $USB/My_Webpages
cp -r /mnt/nvme0n1p7/Users/Ed/"My Webpages"/* $USB/My_Webpages/
fi
if [ ! -f $USB/My_Bkups/* ]; then
mkdir $USB/My_Bkups
USB=$USB/My_Bkups
mkdir $USB/Firefox
cp $PORTEUS/Guest/Backups/FireFox/book*.json $USB/Firefox/
fi
# Windows Internet files backups
#mkdir $USB/Links
mkdir $USB/Edge
mkdir $USB/Icons
mkdir $USB/grub2
#cp /mnt/nvme0n1p7/Users/Ed/Favorites/Links/* $USB/Links
cp /mnt/nvme0n1p7/Users/Ed/My?Backups/Edge_Favorites/*24.html $USB/Edge
cp /mnt/nvme0n1p7/Ed/Favorites/Icons/* $USB/Icons
cp /mnt/nvme0n1p3/grub2/* $USB/grub2
cp /mnt/nvme0n1p7/grub2/* $USB/grub2/Eds
echo "Done"
sync
read
exit
This script below does not answer your question, directly:
Code: Select all
https://github.com/robang74/porteus-usb-installer