brokenman wrote:So you gonna share or just tell us it is possible?
Well, I don't know. You didn't say please.
Yes, of course I'm going to share. But I needed to do some real life things first. Good grief.
I started by nuking the flash drive using your instructions previously. I tried using a script:
Code: Select all
#!/bin/sh
# https://forum.porteus.org/viewtopic.php?f=81&t=3227&start=15#p25341
if [ `whoami` != "root" ]; then
ktsuss "$0"
exit
fi
umount /mnt/sdb1
parted -s /dev/sdb mklabel msdos
but usually ended up doing it manually.
I then partitioned and formatted the drive using GParted. A script to do the nuking and partitioning automatically would be nice and I may use your latest posting to do that in the future.
Flash Drive with Ext4 and Windows-compatible filesystem
The next part was a different script.
Code: Select all
#!/bin/sh
## https://forum.porteus.org/viewtopic.php?f=81&t=3227#p25266
## https://forum.porteus.org/viewtopic.php?f=81&t=3227&p=25308#p25308
if [ `whoami` != "root" ]; then
ktsuss "$0"
exit
fi
## Run GParted to partition and format the USB drive.
if [ ! -f /mnt/sdb1/USB_INSTALLATION.txt ]; then
echo
echo Copying porteus ISO files and folders to the USB drive
echo
mkdir /mnt/sdb1/boot
mkdir /mnt/sdb1/porteus
cp -r /mnt/sda5/porteus/i486files/boot/* /mnt/sdb1/boot/
cp -r /mnt/sda5/porteus/i486files/porteussave.dat /mnt/sdb1/
cp -r /mnt/sda5/porteus/i486files/porteus/* /mnt/sdb1/porteus/
cp -r /mnt/sda5/porteus/i486files/USB_INSTALLATION.txt /mnt/sdb1/
read -n1 -r -p "Press space to continue..." key
fi
## Run the Porteus installer
echo Installing Porteus to the USB drive
cd /mnt/sdb1/boot
sh Porteus-installer-for-Linux.com
## Unmount the USB drive
if [ -d /mnt/sdb1 ]; then
umount /dev/sdb1
echo
fi
read -n1 -r -p "Press space to continue..." key
## Run the modified UEFI Porteus installer
echo Running the modified UEFI Porteus installer
#curl -L https://www.dropbox.com/s/w1i7b2p4viinnq8/porteus-uefi-usb-installer-v3.0.sh -o porteus-uefi-usb-installer-v3.0.sh
cd /home/guest/
sh porteus-uefi-usb-installer-v3.X.sh
echo
echo Need to tweak the UUID and changes=EXIT codes in
echo the porteus.cfg file in /mnt/sdb1/boot/syslinux/ and
echo the porteus.conf file in /mnt/sdb1/EFI/BOOT/.
echo
This took a while to develop due to my lack of bash knowledge and wasn't exactly what I had planned originally. I knew I needed a piece of your uefi-usb-installer for the rEFInd code but I ended up using it for the gdisk part also, again due to my inexperience.
After initializing the flash drive I copy the Porteus ISO files from a i486 install to the empty flash drive and run the Porteus Linux installer. This creates the MBR, boot menu and Porteus install on the flash drive. I then execute a modified version of your uefi-usb installer which creates the GUID Partition Table (GPT), the rEFInd boot menu for the installed system.
I then manually tweak the two boot menus to add the flash drive's UUID and the changes=EXIT cheatcode which points to the same save.dat file in both boot menus. If I was smarter I would have the script do that.
The modifications to your Porteus-uefi-usb-installer-v3.0.sh are:
Code: Select all
-rep 282
pink "THIS SCRIPT MAY DESTROY ALL DATA ON THE TARGET DEVICE!!"
-rep 287
read -p "`gettext " Would you like to continue? [Yes/No]"`" -n 1 -r -s && echo
-ins 310
if [ ! -f /mnt/sdb1/USB_INSTALLATION.txt ]; then
EDSWAY=N
-rep 313,314
echo "`gettext "Your removable device may be formatted into 2 partitions"`"
echo "`gettext "This is used by some UEFI systems. The first partition"`"
-ins 413
fi
-ins 516
## ==========
## Load MBR and build GPT from it
## ----------
OPT_LOADMBR="f"
build_gpt_fm_mbr() {
$GDISK_BIN $TARG_DISK << EOF
r
$OPT_LOADMBR
Y
m
t
ef00
i
w
Y
EOF
}
-ins 517
echo Wipe
set -x
if [ -f /mnt/sdb1/USB_INSTALLATION.txt ]; then
EDSWAY=Y
echo
echo "'gettext "Creating GPT partition table on:"'"|tee -a $LOG
echo "/dev/$BLOCK" | tee -a $LOG
build_gpt_fm_mbr 2>/dev/null 1>&2
fi
if [ ! -f /mnt/sdb1/USB_INSTALLATION.txt ]; then
EDSWAY=N
-ins 553
fi
set +x
-ins 1792
if [ $EDSWAY != 'Y' ]; then
-ins 1798
fi
It's the best I could do without a goto command. The questions for partition sizes and etc are all still there though not used.
Does the process work, yup. Is it perfect, nope. It's taken me about a week to get this far and it's the 1st development I've done on this small screen. It takes me about 2 hrs before my eyes can see distance clearly after working long on it.
Remember you need to start from a blank USB, nothing on it including any MBR or GPT.
Yes, I know.
The F option needs an existing MBR to load.
Yes, I know.
And Yes I know the purpose of the gdisk's f option and it's limitations. I wouldn't recommend this approach on a multi-partitioned hard drive but for a single partitioned flash drive it's perfect. And in that the whole "March 2014 (version 0.8.10),
gdisk should be considered beta software" statement the fact that it works at all is wonderful.
Why are you posting useless generalized statements in the development section? I will remove this thread tomorrow if there is nothing valid to offer.
Whatever floats your boat.
= edit =
The /boot/syslinux/porteus.cfg change:
Code: Select all
LABEL razor
MENU LABEL Graphics mode (Razor)
KERNEL vmlinuz
APPEND initrd=initrd.xz changes=EXIT:UUID:AFA2-C646/porteussave.dat
The /EFI/BOOT/porteus.conf changes:
Code: Select all
menuentry "Porteus-v3.0" {
icon EFI/BOOT/myicons/os_porteus.icns
loader /EFI/Porteus-v3.0/vmlinuz
initrd /EFI/Porteus-v3.0/initrd.xz
options "from=UUID:AFA2-C646 changes=EXIT:UUID:AFA2-C646/porteussave.dat"
submenuentry "Boot to text mode" {
add_options "3"
}
submenuentry "Boot always fresh mode" {
loader /EFI/Porteus-v3.0/vmlinuz
initrd /EFI/Porteus-v3.0/initrd.xz
options "from=UUID:AFA2-C646 nomagic base_only norootcopy"
}
submenuentry "Boot to copy2ram mode" {
add_options "copy2ram"
}
submenuentry "Boot to PXE mode" {
loader /EFI/Porteus-v3.0/vmlinuz
initrd /EFI/Porteus-v3.0/initrd.xz
options "from=UUID:AFA2-C646 pxe"
}
}