Compare commits
No commits in common. "e89138b2b71c2984e0e3c7ef9bcf41b1578affd8" and "a94eea39fc17c316c24193787709b3ef553f60e4" have entirely different histories.
e89138b2b7
...
a94eea39fc
|
|
@ -162,8 +162,6 @@ shopt -s checkwinsize
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cp /etc/skel/.bashrc /root/.bashrc
|
|
||||||
|
|
||||||
cat > /etc/skel/.bashrc_aliases << EOF
|
cat > /etc/skel/.bashrc_aliases << EOF
|
||||||
alias ls="ls --color=auto"
|
alias ls="ls --color=auto"
|
||||||
alias la="ls -aF"
|
alias la="ls -aF"
|
||||||
|
|
@ -172,12 +170,6 @@ alias x11vnc="x11vnc -repeat -nomodtweak"
|
||||||
alias blank="sleep 1 && xset dpms force off"
|
alias blank="sleep 1 && xset dpms force off"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > /root/.bashrc_aliases << EOF
|
|
||||||
alias ls="ls --color=auto"
|
|
||||||
alias la="ls -aF"
|
|
||||||
alias grep="grep --color=auto"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat > /usr/local/bin/conky_generate_config.sh << BIG_EOF
|
cat > /usr/local/bin/conky_generate_config.sh << BIG_EOF
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
PART_UUID="\$(blkid --match-tag PARTUUID --output value \$(blkid --output value --match-tag PARTUUID "$(grep "/run/void-usb/container" /proc/mounts | sed 's| /run/void-usb/.*||')"))"
|
PART_UUID="\$(blkid --match-tag PARTUUID --output value \$(blkid --output value --match-tag PARTUUID "$(grep "/run/void-usb/container" /proc/mounts | sed 's| /run/void-usb/.*||')"))"
|
||||||
|
|
|
||||||
|
|
@ -131,166 +131,72 @@ if grep "$TARGET_DISK" /proc/mounts >> $LOGFILE 2>&1; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "
|
echo -n "Wiping and partitioning storage... "
|
||||||
Do you want to encrypt your files?
|
# new GPT
|
||||||
|
# 2M BIOS GRUB
|
||||||
With the exception of the files essential for booting, the system will be encrypted.
|
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings)
|
||||||
This will use an additional 1Gib of storage space.
|
# everything else one big partition
|
||||||
|
echo "g
|
||||||
If you enable encryption, you will be prompted for a passphrase. This passphrase will be
|
n
|
||||||
asked separately during bootup and may be different from the user login.
|
|
||||||
"
|
|
||||||
|
|
||||||
if yesno; then
|
|
||||||
ADD_CRYPTSETUP="cryptsetup"
|
|
||||||
echo -n "Wiping and partitioning storage... "
|
|
||||||
# new GPT
|
|
||||||
# 2M BIOS GRUB
|
|
||||||
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings)
|
|
||||||
# everything else one big partition
|
|
||||||
echo "g
|
|
||||||
n
|
|
||||||
|
|
||||||
|
|
||||||
+2M
|
+2M
|
||||||
n
|
n
|
||||||
|
|
||||||
|
|
||||||
+66591
|
+66591
|
||||||
n
|
n
|
||||||
|
|
||||||
|
|
||||||
+1G
|
|
||||||
n
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
t
|
t
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
t
|
t
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
t
|
t
|
||||||
3
|
3
|
||||||
142
|
20
|
||||||
t
|
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
|
||||||
4
|
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
|
||||||
20
|
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
|
||||||
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
|
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
|
||||||
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
|
echo "done"
|
||||||
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
|
|
||||||
TARGET_PART_BOOT="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
|
|
||||||
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '5p')"
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Formatting partitions... "
|
echo -n "Formatting partitions... "
|
||||||
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1
|
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1
|
||||||
mkfs.f2fs -f -l "container" "$TARGET_PART_BOOT" >> $LOGFILE 2>&1
|
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG" >> $LOGFILE 2>&1
|
||||||
echo "Setting up encryption. You will be asked for the same password twice."
|
echo "done"
|
||||||
cryptsetup luksFormat --batch-mode --type luks2 --force-password "$TARGET_PART_BIG"
|
|
||||||
cryptsetup luksOpen --batch-mode --type luks2 "$TARGET_PART_BIG" voidusb-container
|
|
||||||
if [ "$?" -gt 0 ]; then
|
|
||||||
echo "Failed to open encrypted container. The entered passwords probably didn't match."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "Mounting partitions and virtual file systems... "
|
echo -n "Mounting partitions and virtual file systems... "
|
||||||
mkdir -p /mnt/target >> $LOGFILE 2>&1
|
mkdir -p /mnt/target >> $LOGFILE 2>&1
|
||||||
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1
|
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 >> $LOGFILE 2>&1
|
||||||
mount -t tmpfs none /mnt/target/run >> $LOGFILE 2>&1
|
mount -t tmpfs none /mnt/target/run >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/proc >> $LOGFILE 2>&1
|
mkdir /mnt/target/proc >> $LOGFILE 2>&1
|
||||||
mount -t proc proc /mnt/target/proc >> $LOGFILE 2>&1
|
mount -t proc proc /mnt/target/proc >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/sys >> $LOGFILE 2>&1
|
mkdir /mnt/target/sys >> $LOGFILE 2>&1
|
||||||
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
|
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
|
||||||
mount --make-rslave /mnt/target/sys >> $LOGFILE 2>&1
|
mount --make-rslave /mnt/target/sys >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/dev >> $LOGFILE 2>&1
|
mkdir /mnt/target/dev >> $LOGFILE 2>&1
|
||||||
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
|
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
|
||||||
mount --make-rslave /mnt/target/dev >> $LOGFILE 2>&1
|
mount --make-rslave /mnt/target/dev >> $LOGFILE 2>&1
|
||||||
|
|
||||||
# actual storage
|
# actual storage
|
||||||
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
||||||
mount /dev/mapper/voidusb-container /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/boot >> $LOGFILE 2>&1
|
mkdir /mnt/target/boot >> $LOGFILE 2>&1
|
||||||
mount "$TARGET_PART_BOOT" /mnt/target/boot
|
mkdir /mnt/target/run/void-usb/container/boot >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
|
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot >> $LOGFILE 2>&1
|
||||||
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
|
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/home >> $LOGFILE 2>&1
|
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
|
||||||
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
|
mkdir /mnt/target/home >> $LOGFILE 2>&1
|
||||||
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
|
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
|
||||||
echo "done"
|
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
|
||||||
else
|
echo "done"
|
||||||
echo -n "Wiping and partitioning storage... "
|
|
||||||
# new GPT
|
|
||||||
# 2M BIOS GRUB
|
|
||||||
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings)
|
|
||||||
# everything else one big partition
|
|
||||||
echo "g
|
|
||||||
n
|
|
||||||
|
|
||||||
|
|
||||||
+2M
|
|
||||||
n
|
|
||||||
|
|
||||||
|
|
||||||
+66591
|
|
||||||
n
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
t
|
|
||||||
1
|
|
||||||
4
|
|
||||||
t
|
|
||||||
2
|
|
||||||
1
|
|
||||||
t
|
|
||||||
3
|
|
||||||
20
|
|
||||||
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
|
|
||||||
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_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" >> $LOGFILE 2>&1
|
|
||||||
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 >> $LOGFILE 2>&1
|
|
||||||
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1
|
|
||||||
|
|
||||||
# used for chroot later
|
|
||||||
mkdir /mnt/target/run >> $LOGFILE 2>&1
|
|
||||||
mount -t tmpfs none /mnt/target/run >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/proc >> $LOGFILE 2>&1
|
|
||||||
mount -t proc proc /mnt/target/proc >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/sys >> $LOGFILE 2>&1
|
|
||||||
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
|
|
||||||
mount --make-rslave /mnt/target/sys >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/dev >> $LOGFILE 2>&1
|
|
||||||
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
|
|
||||||
mount --make-rslave /mnt/target/dev >> $LOGFILE 2>&1
|
|
||||||
|
|
||||||
# actual storage
|
|
||||||
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
|
||||||
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/boot >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/run/void-usb/container/boot >> $LOGFILE 2>&1
|
|
||||||
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
|
|
||||||
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/home >> $LOGFILE 2>&1
|
|
||||||
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
|
|
||||||
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Storage is now prepared and ready for installation.
|
echo "Storage is now prepared and ready for installation.
|
||||||
|
|
@ -346,7 +252,7 @@ XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repos
|
||||||
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 $ADD_CRYPTSETUP 2>&1 | tee --append $LOGFILE
|
squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut xz 2>&1 | tee --append $LOGFILE
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "An error occurred while trying to install the base system."
|
echo "An error occurred while trying to install the base system."
|
||||||
|
|
@ -394,27 +300,15 @@ echo "
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "Adding fstab."
|
echo "Adding fstab."
|
||||||
if [ -n "$TARGET_PART_BOOT" ]; then
|
echo "# See fstab(5).
|
||||||
echo "# See fstab(5).
|
# <device> <mount point> <fstype> <options> <dump> <pass>
|
||||||
# <device> <mount point> <fstype> <options> <dump> <pass>
|
|
||||||
|
|
||||||
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
|
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
|
||||||
|
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot f2fs nodev,nosuid,noexec 0 2
|
/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
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat nodev,nosuid,noexec,umask=133,dmask=022 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
|
||||||
else
|
|
||||||
echo "# See fstab(5).
|
|
||||||
# <device> <mount point> <fstype> <options> <dump> <pass>
|
|
||||||
|
|
||||||
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
|
|
||||||
|
|
||||||
/run/void-usb/container/boot /boot none bind 0 0
|
|
||||||
/run/void-usb/container/home /home none bind 0 0
|
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat nodev,nosuid,noexec,umask=133,dmask=022 0 2
|
|
||||||
" > /mnt/target/etc/fstab
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Configuring keyboard layout."
|
echo "Configuring keyboard layout."
|
||||||
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,23 @@ VERSION="$2"
|
||||||
|
|
||||||
echo "Updating default kernel and initramfs symlinks..."
|
echo "Updating default kernel and initramfs symlinks..."
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# Delete old symlinks
|
||||||
|
#####################
|
||||||
|
OLD_LINUX=/boot/vmlinu?
|
||||||
|
if [ ! -f "$OLD_LINUX" ]; then
|
||||||
|
# in cases where it’s a .gz or .xz or whatever
|
||||||
|
OLD_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
|
||||||
|
fi
|
||||||
|
[ -f "$OLD_LINUX" ] && rm "$OLD_LINUX"
|
||||||
|
|
||||||
|
OLD_INITRAMFS=/boot/initramfs.img
|
||||||
|
if [ ! -f "$OLD_INITRAMFS" ]; then
|
||||||
|
# hope to find anything named initramfs or initrd
|
||||||
|
OLD_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
|
||||||
|
fi
|
||||||
|
[ -f "$OLD_INITRAMFS" ] && rm "$OLD_INITRAMFS"
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Create new symlinks
|
# Create new symlinks
|
||||||
#####################
|
#####################
|
||||||
|
|
@ -22,7 +39,7 @@ fi
|
||||||
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_LINUX_FILE"; then
|
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_LINUX_FILE"; then
|
||||||
NEW_LINUX_SYMLINK="$NEW_LINUX_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_LINUX_FILE")"
|
NEW_LINUX_SYMLINK="$NEW_LINUX_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_LINUX_FILE")"
|
||||||
fi
|
fi
|
||||||
ln -s -f "$NEW_LINUX_FILE" "/boot/$NEW_LINUX_SYMLINK"
|
ln -s "$NEW_LINUX_FILE" "/boot/$NEW_LINUX_SYMLINK"
|
||||||
|
|
||||||
NEW_INITRAMFS_FILE="$(find /boot -name "init*$VERSION*" 2>/dev/null | sed 's|^/boot/||')"
|
NEW_INITRAMFS_FILE="$(find /boot -name "init*$VERSION*" 2>/dev/null | sed 's|^/boot/||')"
|
||||||
NEW_INITRAMFS_SYMLINK="initramfs"
|
NEW_INITRAMFS_SYMLINK="initramfs"
|
||||||
|
|
@ -32,7 +49,7 @@ fi
|
||||||
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_INITRAMFS_FILE"; then
|
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_INITRAMFS_FILE"; then
|
||||||
NEW_INITRAMFS_SYMLINK="$NEW_INITRAMFS_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_INITRAMFS_FILE")"
|
NEW_INITRAMFS_SYMLINK="$NEW_INITRAMFS_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_INITRAMFS_FILE")"
|
||||||
fi
|
fi
|
||||||
ln -s -f "$NEW_INITRAMFS_FILE" "/boot/$NEW_INITRAMFS_SYMLINK"
|
ln -s "$NEW_INITRAMFS_FILE" "/boot/$NEW_INITRAMFS_SYMLINK"
|
||||||
|
|
||||||
echo "Default kernel and initramfs are now: $NEW_LINUX_FILE, $NEW_INITRAMFS_FILE"
|
echo "Default kernel and initramfs are now: $NEW_LINUX_FILE, $NEW_INITRAMFS_FILE"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,5 @@ while [ "$(vkpurge list | wc -l)" -gt "$KEEP_OLD_KERNELS" ]; do
|
||||||
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
|
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
|
||||||
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
|
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
|
||||||
vkpurge rm "$OLDEST_KERNEL"
|
vkpurge rm "$OLDEST_KERNEL"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -4,27 +4,22 @@ OS_NAME="Void Linux USB"
|
||||||
GRUB_PREFIX="/boot/efi/LOADER/grub"
|
GRUB_PREFIX="/boot/efi/LOADER/grub"
|
||||||
CFG_CUSTOM_BEFORE="custom_before.cfg"
|
CFG_CUSTOM_BEFORE="custom_before.cfg"
|
||||||
CFG_CUSTOM_AFTER="custom_after.cfg"
|
CFG_CUSTOM_AFTER="custom_after.cfg"
|
||||||
|
CONTAINER_UUID="$(blkid --output value --match-tag UUID "$(grep " /run/void-usb/container " /proc/mounts | sed -e 's/ .*//')")"
|
||||||
if [ "$(findmnt --noheadings --nofsroot --output SOURCE /boot)" = "$(findmnt --noheadings --nofsroot --output SOURCE /run/void-usb/container)" ]; then
|
|
||||||
GRUB_BOOT_PATH="/boot"
|
|
||||||
else
|
|
||||||
# assuming separate /boot partition
|
|
||||||
GRUB_BOOT_PATH=""
|
|
||||||
fi
|
|
||||||
VOIDUSB_CONTAINER="$(findmnt --noheadings --output SOURCE /run/void-usb/container)"
|
|
||||||
if grep "/dev/mapper" <<< "$VOIDUSB_CONTAINER" > /dev/null; then
|
|
||||||
LUKS_SETTINGS="rd.luks.uuid=$(blkid --output value --match-tag UUID "$(ls /sys/block/"$(basename "$(realpath "$VOIDUSB_CONTAINER")")"/slaves | head -n1)")"
|
|
||||||
else
|
|
||||||
VOIDUSB_CONTAINER="UUID=$(blkid --output value --match-tag UUID "$VOIDUSB_CONTAINER")"
|
|
||||||
fi
|
|
||||||
# TODO: rd.vconsole.keymap
|
# TODO: rd.vconsole.keymap
|
||||||
LINUX_CMDLINE="quiet root=/dev/loop0 ro $LUKS_SETTINGS void-usb-container=$VOIDUSB_CONTAINER rd.vconsole.keymap=de-latin1"
|
LINUX_CMDLINE="quiet root=/dev/loop0 ro void-usb-container=UUID=$CONTAINER_UUID rd.vconsole.keymap=de-latin1"
|
||||||
|
|
||||||
DEFAULT_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
|
DEFAULT_LINUX=/boot/vmlinu?
|
||||||
|
if [ ! -f "$DEFAULT_LINUX" ]; then
|
||||||
|
# in cases where it’s a .gz or .xz or whatever
|
||||||
|
DEFAULT_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
|
||||||
|
fi
|
||||||
DEFAULT_LINUX="$(sed 's|^/boot/||' <<< "$DEFAULT_LINUX")"
|
DEFAULT_LINUX="$(sed 's|^/boot/||' <<< "$DEFAULT_LINUX")"
|
||||||
|
|
||||||
# hope to find anything named initramfs or initrd
|
DEFAULT_INITRAMFS=/boot/initramfs.img
|
||||||
DEFAULT_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
|
if [ ! -f "$DEFAULT_INITRAMFS" ]; then
|
||||||
|
# hope to find anything named initramfs or initrd
|
||||||
|
DEFAULT_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
|
||||||
|
fi
|
||||||
DEFAULT_INITRAMFS="$(sed 's|^/boot/||' <<< "$DEFAULT_INITRAMFS")"
|
DEFAULT_INITRAMFS="$(sed 's|^/boot/||' <<< "$DEFAULT_INITRAMFS")"
|
||||||
|
|
||||||
function make_menuentry {
|
function make_menuentry {
|
||||||
|
|
@ -55,9 +50,9 @@ function make_menuentry {
|
||||||
echo "
|
echo "
|
||||||
menuentry 'Linux $LINUX_VERSION' {
|
menuentry 'Linux $LINUX_VERSION' {
|
||||||
echo 'Loading $LINUX...'
|
echo 'Loading $LINUX...'
|
||||||
linux $GRUB_BOOT_PATH/$LINUX $LINUX_CMDLINE
|
linux /boot/$LINUX $LINUX_CMDLINE
|
||||||
echo 'Loading initial ramdisk...'
|
echo 'Loading initial ramdisk...'
|
||||||
initrd $GRUB_BOOT_PATH/$INITRAMFS
|
initrd /boot/$INITRAMFS
|
||||||
}" >> "$GRUB_PREFIX/grub.cfg"
|
}" >> "$GRUB_PREFIX/grub.cfg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +66,7 @@ echo "# This file is auto-generated by $0.
|
||||||
# $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or
|
# $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or
|
||||||
# $GRUB_PREFIX/$CFG_CUSTOM_AFTER
|
# $GRUB_PREFIX/$CFG_CUSTOM_AFTER
|
||||||
|
|
||||||
search --fs-uuid --set=root $(blkid --output value --match-tag UUID "$(findmnt --noheadings --nofsroot --output SOURCE /boot)")
|
search --fs-uuid --set=root $CONTAINER_UUID
|
||||||
|
|
||||||
set menu_color_normal=white/black
|
set menu_color_normal=white/black
|
||||||
set menu_color_highlight=black/light-gray
|
set menu_color_highlight=black/light-gray
|
||||||
|
|
@ -86,9 +81,9 @@ fi
|
||||||
|
|
||||||
menuentry '$OS_NAME' {
|
menuentry '$OS_NAME' {
|
||||||
echo 'Loading Linux...'
|
echo 'Loading Linux...'
|
||||||
linux $GRUB_BOOT_PATH/$DEFAULT_LINUX $LINUX_CMDLINE
|
linux /boot/$DEFAULT_LINUX $LINUX_CMDLINE
|
||||||
echo 'Loading initial ramdisk...'
|
echo 'Loading initial ramdisk...'
|
||||||
initrd $GRUB_BOOT_PATH/$DEFAULT_INITRAMFS
|
initrd /boot/$DEFAULT_INITRAMFS
|
||||||
}
|
}
|
||||||
|
|
||||||
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"
|
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue