Compare commits
No commits in common. "4beb8cfa4df1f7c64a5f629e956cb4a0077008ab" and "c6004dad6cef506852d453a0a31a01d8c93f5945" have entirely different histories.
4beb8cfa4d
...
c6004dad6c
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
LOGFILE=/tmp/void-usb-install-log
|
|
||||||
|
|
||||||
function press_any_key {
|
function press_any_key {
|
||||||
echo "Press any key to continue or Ctrl+c to abort..."
|
echo "Press any key to continue or Ctrl+c to abort..."
|
||||||
read -n1 DISCARD_ME
|
read -n1 DISCARD_ME
|
||||||
|
@ -41,12 +39,6 @@ function run_in_target {
|
||||||
}
|
}
|
||||||
|
|
||||||
clear
|
clear
|
||||||
touch $LOGFILE
|
|
||||||
|
|
||||||
#TODO: check that we are root
|
|
||||||
#TODO: check that we are online
|
|
||||||
# -> could be done by pinging repo-default.voidlinux.org
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
This script will now download and install Void Linux on your USB stick.
|
This script will now download and install Void Linux on your USB stick.
|
||||||
Any data that is currently on the stick will be lost and it won’t be
|
Any data that is currently on the stick will be lost and it won’t be
|
||||||
|
@ -56,17 +48,15 @@ Before we begin, the following packages need to be installed (if not installed a
|
||||||
- xmirror
|
- xmirror
|
||||||
- squashfs-tools
|
- squashfs-tools
|
||||||
- wget
|
- wget
|
||||||
"
|
- xtools-minimal"
|
||||||
press_any_key
|
press_any_key
|
||||||
|
|
||||||
echo -n "Ensuring that XBPS is up-to-date... "
|
xbps-install --sync
|
||||||
xbps-install --yes --sync --update xbps >> $LOGFILE 2>&1
|
xbps-install --yes --update xbps
|
||||||
echo "done"
|
xbps-install --yes xmirror squashfs-tools wget xtools-minimal
|
||||||
echo -n "Installing xmirror, squashfs-tools, wget... "
|
|
||||||
xbps-install --yes xmirror squashfs-tools wget >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
#TODO: If going down the path of extracting routines from void-installer, that should be done here
|
#TODO: If going down the path of extracting routines from void-installer and
|
||||||
|
# xmirror, that should be done here.
|
||||||
|
|
||||||
#TODO: Select keyboard layout
|
#TODO: Select keyboard layout
|
||||||
KBD_LAYOUT="de-latin1"
|
KBD_LAYOUT="de-latin1"
|
||||||
|
@ -100,7 +90,6 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Wiping and partitioning storage... "
|
|
||||||
# new GPT
|
# new GPT
|
||||||
# 2M BIOS GRUB
|
# 2M BIOS GRUB
|
||||||
# 268M ESP
|
# 268M ESP
|
||||||
|
@ -127,43 +116,38 @@ t
|
||||||
t
|
t
|
||||||
3
|
3
|
||||||
20
|
20
|
||||||
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
|
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK"
|
||||||
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
|
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
|
||||||
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
|
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
|
||||||
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
|
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Formatting partitions... "
|
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI"
|
||||||
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1
|
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG"
|
||||||
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG" >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Mounting partitions and virtual file systems... "
|
mkdir -p /mnt/target
|
||||||
mkdir -p /mnt/target >> $LOGFILE 2>&1
|
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target
|
||||||
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1
|
|
||||||
|
|
||||||
# used for chroot later
|
# used for chroot later
|
||||||
mkdir /mnt/target/run >> $LOGFILE 2>&1
|
mkdir /mnt/target/run
|
||||||
mount --rbind /run /mnt/target/run >> $LOGFILE 2>&1
|
mount --rbind /run /mnt/target/run
|
||||||
mkdir /mnt/target/proc >> $LOGFILE 2>&1
|
mkdir /mnt/target/proc
|
||||||
mount --rbind /proc /mnt/target/proc >> $LOGFILE 2>&1
|
mount --rbind /proc /mnt/target/proc
|
||||||
mkdir /mnt/target/sys >> $LOGFILE 2>&1
|
mkdir /mnt/target/sys
|
||||||
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
|
mount --rbind /sys /mnt/target/sys
|
||||||
mkdir /mnt/target/dev >> $LOGFILE 2>&1
|
mkdir /mnt/target/dev
|
||||||
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
|
mount --rbind /dev /mnt/target/dev
|
||||||
|
|
||||||
# actual storage
|
# actual storage
|
||||||
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
mkdir -p /mnt/target/run/void-usb/container
|
||||||
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container
|
||||||
mkdir /mnt/target/boot >> $LOGFILE 2>&1
|
mkdir /mnt/target/boot
|
||||||
mkdir /mnt/target/run/void-usb/container/boot >> $LOGFILE 2>&1
|
mkdir /mnt/target/run/void-usb/container/boot
|
||||||
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot >> $LOGFILE 2>&1
|
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot
|
||||||
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
|
mkdir /mnt/target/boot/efi
|
||||||
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
|
mount "$TARGET_PART_EFI" /mnt/target/boot/efi
|
||||||
mkdir /mnt/target/home >> $LOGFILE 2>&1
|
mkdir /mnt/target/home
|
||||||
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
|
mkdir /mnt/target/run/void-usb/container/home
|
||||||
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
|
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home
|
||||||
echo "done"
|
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Storage is now prepared and ready for installation.
|
echo "Storage is now prepared and ready for installation.
|
||||||
|
@ -173,6 +157,7 @@ The script will launch xmirror on the host/live system and determine
|
||||||
the chosen mirror from the config file it generates.
|
the chosen mirror from the config file it generates.
|
||||||
"
|
"
|
||||||
press_any_key
|
press_any_key
|
||||||
|
|
||||||
xmirror
|
xmirror
|
||||||
#TODO: also remove CPU architecture
|
#TODO: also remove CPU architecture
|
||||||
TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)"
|
TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)"
|
||||||
|
@ -185,34 +170,26 @@ if grep "musl" <<< "$TARGET_TYPE"; then
|
||||||
TARGET_MIRROR="$TARGET_MIRROR/musl"
|
TARGET_MIRROR="$TARGET_MIRROR/musl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Copying repository keys... "
|
mkdir -p /mnt/target/var/db/xbps/keys
|
||||||
mkdir -p /mnt/target/var/db/xbps/keys >> $LOGFILE 2>&1
|
cp /var/db/xbps/keys/* /mnt/target/var/db/xbps/keys/
|
||||||
cp /var/db/xbps/keys/* /mnt/target/var/db/xbps/keys/ >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo "The next step is installing packages for base system components.
|
|
||||||
Depending on your internet connection, your USB stick, and the phase of the moon, this may take a while.
|
|
||||||
The XBPS log will be displayed for this step.
|
|
||||||
"
|
|
||||||
press_any_key
|
|
||||||
XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repository "$TARGET_MIRROR" \
|
XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repository "$TARGET_MIRROR" \
|
||||||
linux bash shadow f2fs-tools dosfstools dbus NetworkManager iana-etc \
|
linux bash shadow f2fs-tools dosfstools dbus NetworkManager iana-etc \
|
||||||
iw wpa_supplicant util-linux which tar man-pages iproute2 iputils \
|
iw wpa_supplicant util-linux which tar man-pages iproute2 iputils \
|
||||||
wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils \
|
wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils \
|
||||||
diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng \
|
diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng \
|
||||||
kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid \
|
kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid \
|
||||||
squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut xz 2>&1 | tee --append $LOGFILE
|
squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut xz
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "Adding mirror configuration."
|
|
||||||
echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.conf
|
echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.conf
|
||||||
|
|
||||||
echo "Adding sudo configuration."
|
|
||||||
echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.conf
|
echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.conf
|
||||||
echo "Disabling root password."
|
|
||||||
run_in_target passwd --lock root
|
|
||||||
|
|
||||||
echo "Adding dracut configuration."
|
|
||||||
|
|
||||||
|
mkdir -p /mnt/target/opt/void-usb
|
||||||
|
chmod 755 /mnt/target/opt/void-usb
|
||||||
|
|
||||||
echo '# Void USB dracut configuration
|
echo '# Void USB dracut configuration
|
||||||
|
|
||||||
hostonly="no"
|
hostonly="no"
|
||||||
|
@ -221,29 +198,22 @@ compress="xz"
|
||||||
add_dracutmodules+=" void-usb "
|
add_dracutmodules+=" void-usb "
|
||||||
omit_dracutmodules+=" nvdimm resume "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
|
omit_dracutmodules+=" nvdimm resume "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
|
||||||
|
|
||||||
echo -n "Adding dracut module void-usb... "
|
mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb
|
||||||
mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb >> $LOGFILE 2>&1
|
chmod 755 /mnt/target/lib/dracut/modules.d/90void-usb
|
||||||
chmod 755 /mnt/target/lib/dracut/modules.d/90void-usb >> $LOGFILE 2>&1
|
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/module-setup.sh
|
||||||
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/module-setup.sh >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh
|
||||||
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh >> $LOGFILE 2>&1
|
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/create-loop0.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/create-loop0.sh
|
||||||
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/create-loop0.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/create-loop0.sh >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/create-loop0.sh
|
||||||
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/create-loop0.sh >> $LOGFILE 2>&1
|
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/squashfs-img.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/squashfs-img.sh
|
||||||
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/squashfs-img.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/squashfs-img.sh >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/squashfs-img.sh
|
||||||
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/squashfs-img.sh >> $LOGFILE 2>&1
|
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/overlay.sh
|
||||||
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/overlay.sh >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh
|
||||||
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Adding file system helper... "
|
wget --output-document=/mnt/target/opt/void-usb/backup-fs https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/backup-fs
|
||||||
mkdir -p /mnt/target/opt/void-usb >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/opt/void-usb/backup-fs
|
||||||
chmod 755 /mnt/target/opt/void-usb >> $LOGFILE 2>&1
|
|
||||||
wget --output-document=/mnt/target/opt/void-usb/backup-fs https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/backup-fs >> $LOGFILE 2>&1
|
|
||||||
chmod 744 /mnt/target/opt/void-usb/backup-fs >> $LOGFILE 2>&1
|
|
||||||
echo "
|
echo "
|
||||||
/opt/void-usb/backup-fs" >> /mnt/target/etc/rc.shutdown
|
/opt/void-usb/backup-fs" >> /mnt/target/etc/rc.shutdown
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo "Adding fstab."
|
|
||||||
echo "# See fstab(5).
|
echo "# See fstab(5).
|
||||||
# <device> <mount point> <fstype> <options> <dump> <pass>
|
# <device> <mount point> <fstype> <options> <dump> <pass>
|
||||||
|
|
||||||
|
@ -251,16 +221,16 @@ echo "# See fstab(5).
|
||||||
|
|
||||||
/run/void-usb/container/boot /boot none bind 0 0
|
/run/void-usb/container/boot /boot none bind 0 0
|
||||||
/run/void-usb/container/home /home none bind 0 0
|
/run/void-usb/container/home /home none bind 0 0
|
||||||
|
tmpfs /tmp tmpfs size=512m 0 0
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
|
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
|
||||||
" > /mnt/target/etc/fstab
|
" > /mnt/target/etc/fstab
|
||||||
|
|
||||||
echo "Configuring keyboard layout."
|
|
||||||
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
||||||
sed -i -e 's/#KEYMAP=.*/KEYMAP="'"$KBD_LAYOUT"'"/' /mnt/target/etc/rc.conf
|
sed -i -e 's/#KEYMAP=.*/KEYMAP="'"$KBD_LAYOUT"'"/' /mnt/target/etc/rc.conf
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
echo "WARNING: Could not locate the keymap setting in rc.conf." | tee --append $LOGFILE
|
echo "WARNING: Could not locate the keymap setting in rc.conf."
|
||||||
echo "The script will attempt to add one." | tee --append $LOGFILE
|
echo "The script will attempt to add one."
|
||||||
echo ""
|
echo ""
|
||||||
press_any_key
|
press_any_key
|
||||||
echo "" >> /mnt/target/etc/rc.conf
|
echo "" >> /mnt/target/etc/rc.conf
|
||||||
|
@ -268,25 +238,21 @@ else
|
||||||
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
|
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO: Figure out how to configure keyboard for Xorg
|
|
||||||
|
|
||||||
#TODO timezone
|
#TODO timezone
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Assume that the hardware clock is UTC?
|
echo "Is the hardware clock set to UTC?
|
||||||
|
|
||||||
Most Unix-like systems set the clock in your computer to UTC and add the time zone
|
Most Unix/Linux systems set the clock in your computer to UTC and add
|
||||||
on-the-fly. Windows on the other hand usually sets the hardware clock to local time.
|
the time zone on-the-fly. If you use Windows, you will want to answer no here.
|
||||||
|
|
||||||
If you want to use this stick on Windows computers, you will most likely want to answer no here.
|
|
||||||
"
|
"
|
||||||
if yesno; then
|
if yesno; then
|
||||||
if grep "#HARDWARECLOCK=" /mnt/target/etc/rc.conf; then
|
if grep "#HARDWARECLOCK=" /mnt/target/etc/rc.conf; then
|
||||||
sed -i -e 's/#HARDWARECLOCK=.*/HARDWARECLOCK="UTC"/' /mnt/target/etc/rc.conf
|
sed -i -e 's/#HARDWARECLOCK=.*/HARDWARECLOCK="UTC"/' /mnt/target/etc/rc.conf
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
echo "WARNING: Could not locate the hardwareclock setting in rc.conf." | tee --append $LOGFILE
|
echo "WARNING: Could not locate the hardwareclock setting in rc.conf."
|
||||||
echo "The script will attempt to add one." | tee --append $LOGFILE
|
echo "The script will attempt to add one."
|
||||||
echo ""
|
echo ""
|
||||||
press_any_key
|
press_any_key
|
||||||
echo "" >> /mnt/target/etc/rc.conf
|
echo "" >> /mnt/target/etc/rc.conf
|
||||||
|
@ -298,8 +264,8 @@ else
|
||||||
sed -i -e 's/#HARDWARECLOCK=.*/HARDWARECLOCK="localtime"/' /mnt/target/etc/rc.conf
|
sed -i -e 's/#HARDWARECLOCK=.*/HARDWARECLOCK="localtime"/' /mnt/target/etc/rc.conf
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
echo "WARNING: Could not locate the hardwareclock setting in rc.conf." | tee --append $LOGFILE
|
echo "WARNING: Could not locate the hardwareclock setting in rc.conf."
|
||||||
echo "The script will attempt to add one." | tee --append $LOGFILE
|
echo "The script will attempt to add one."
|
||||||
echo ""
|
echo ""
|
||||||
press_any_key
|
press_any_key
|
||||||
echo "" >> /mnt/target/etc/rc.conf
|
echo "" >> /mnt/target/etc/rc.conf
|
||||||
|
@ -311,7 +277,8 @@ fi
|
||||||
clear
|
clear
|
||||||
echo "Do you want to set a hostname?
|
echo "Do you want to set a hostname?
|
||||||
|
|
||||||
This is equivalent to giving a name to your computer - except it's a system on a USB drive.
|
This is equivalent to giving a name to your computer - except it's a system
|
||||||
|
on a USB drive.
|
||||||
|
|
||||||
If you leave this empty, it will be set to void-usb.
|
If you leave this empty, it will be set to void-usb.
|
||||||
Allowed characters are a-zA-Z0-9 (and - in the middle).
|
Allowed characters are a-zA-Z0-9 (and - in the middle).
|
||||||
|
@ -332,58 +299,30 @@ done
|
||||||
|
|
||||||
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
|
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
|
||||||
|
|
||||||
clear
|
mkdir /mnt/target/boot/efi/LOADER
|
||||||
echo -n "Installing bootloader... "
|
|
||||||
mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1
|
|
||||||
echo "GRUB has been deliberately installed to a non-standard location.
|
echo "GRUB has been deliberately installed to a non-standard location.
|
||||||
This avoids default kernel hooks breaking the custom config." > /mnt/target/boot/efi/LOADER/README.TXT
|
This avoids default kernel hooks breaking the custom config." > /mnt/target/boot/efi/LOADER/README.TXT
|
||||||
|
|
||||||
# no idea if any of these are even necessary/relevant but it can’t hurt...
|
# no idea if any of these are even necessary/relevant but it can’t hurt...
|
||||||
TARGET_PRELOAD_GRUB_MODULES="usb usbms uhci ehci ohci part_gpt f2fs ahci ata pata"
|
TARGET_PRELOAD_GRUB_MODULES="usb usbms uhci ehci ohci part_gpt f2fs ahci ata pata"
|
||||||
run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --disk-module=native --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
|
run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --disk-module=native --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'"
|
||||||
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
|
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'"
|
||||||
run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
|
run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'"
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Adding grub-config helper... "
|
wget --output-document=/mnt/target/opt/void-usb/grub-config https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/grub-config
|
||||||
wget --output-document=/mnt/target/opt/void-usb/grub-config https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/grub-config >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/opt/void-usb/grub-config
|
||||||
chmod 744 /mnt/target/opt/void-usb/grub-config >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Adding kernel hooks... "
|
#TODO: ensure that this is being run by xbps-reconfigure -fa, if not add it here
|
||||||
wget --output-document=/mnt/target/etc/kernel.d/pre-install/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/pre-install/99-void-usb >> $LOGFILE 2>&1
|
# run_in_target /opt/void-usb/grub-config
|
||||||
chmod 744 /mnt/target/etc/kernel.d/pre-install/99-void-usb >> $LOGFILE 2>&1
|
|
||||||
wget --output-document=/mnt/target/etc/kernel.d/post-install/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/post-install/99-void-usb >> $LOGFILE 2>&1
|
|
||||||
chmod 744 /mnt/target/etc/kernel.d/post-install/99-void-usb >> $LOGFILE 2>&1
|
|
||||||
wget --output-document=/mnt/target/etc/kernel.d/post-remove/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/post-remove/99-void-usb >> $LOGFILE 2>&1
|
|
||||||
chmod 744 /mnt/target/etc/kernel.d/post-remove/99-void-usb >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Reconfiguring all installed packages... "
|
wget --output-document=/mnt/target/etc/kernel.d/pre-install/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/pre-install/99-void-usb
|
||||||
run_in_target xbps-reconfigure -fa >> $LOGFILE 2>&1
|
chmod 744 /mnt/target/etc/kernel.d/pre-install/99-void-usb
|
||||||
echo "done"
|
wget --output-document=/mnt/target/etc/kernel.d/post-install/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/post-install/99-void-usb
|
||||||
|
chmod 744 /mnt/target/etc/kernel.d/post-install/99-void-usb
|
||||||
|
wget --output-document=/mnt/target/etc/kernel.d/post-remove/99-void-usb https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/kernel.d/post-remove/99-void-usb
|
||||||
|
chmod 744 /mnt/target/etc/kernel.d/post-remove/99-void-usb
|
||||||
|
|
||||||
echo -n "Adding stage 2 installer... "
|
run_in_target xbps-reconfigure -fa
|
||||||
wget --output-document=/mnt/target/install-stage2.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/install-stage2.sh >> $LOGFILE 2>&1
|
|
||||||
chmod 744 /mnt/target/install-stage2.sh >> $LOGFILE 2>&1
|
|
||||||
echo "menuentry 'Continue Void-USB Installation' {
|
|
||||||
echo 'Loading Linux...'
|
|
||||||
linux $(run_in_target find /boot -type l -name "vmlinu*") quiet root=/dev/loop0 ro void-usb-container=UUID=$(lsblk --raw --noheadings --output UUID "$TARGET_PART_BIG") init=/install-stage2.sh
|
|
||||||
echo 'Loading initial ramdisk...'
|
|
||||||
initrd $(run_in_target find /boot -type l -name "init*")
|
|
||||||
}" >> /mnt/target/boot/efi/LOADER/grub/custom_before.cfg
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo "Creating system image..."
|
|
||||||
#TODO: make this work without user interaction
|
|
||||||
run_in_target /opt/void-usb/backup-fs
|
run_in_target /opt/void-usb/backup-fs
|
||||||
|
|
||||||
clear
|
|
||||||
echo "Stage 1 installation is now complete.
|
|
||||||
|
|
||||||
The freshly installed system needs to be booted to continue with stage 2 of the installation process.
|
|
||||||
The installer will now reboot the computer.
|
|
||||||
"
|
|
||||||
press_any_key
|
|
||||||
reboot
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
exec bash
|
|
Loading…
Reference in New Issue