From bc6aa7392c775200dcf842a1099b7c6037abc9cd Mon Sep 17 00:00:00 2001 From: Rod Myers <10093452+RodMyers@users.noreply.github.com> Date: Thu, 12 Sep 2019 15:35:45 -0400 Subject: [PATCH 1/3] Update void-install-zfs.sh created 2 scripts, to get to run from front to back --- src-sh/void-install-zfs.sh | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src-sh/void-install-zfs.sh b/src-sh/void-install-zfs.sh index e48329b..0708690 100755 --- a/src-sh/void-install-zfs.sh +++ b/src-sh/void-install-zfs.sh @@ -1,9 +1,9 @@ #!/bin/bash # This script was influenced by https://wiki.voidlinux.org/Manual_install_with_ZFS_root -SYSTEMDRIVE="/dev/sda2" -BOOTDRIVE="/dev/sda1" -BOOTDEVICE="/dev/sda" +SYSTEMDRIVE="/dev/sdb2" +BOOTDRIVE="/dev/sdb1" +BOOTDEVICE="/dev/sdb" ZPOOL="trident" REPO="http://alpha.de.repo.voidlinux.org/current/musl" PACKAGES="" @@ -20,7 +20,7 @@ if [ ! -e "/bin/zpool" ] ; then fi echo "Create the pool" -echo "zpool create -f /dev/sda2" +echo "zpool create -f /dev/sdb2" zpool create -f ${ZPOOL} $SYSTEMDRIVE echo echo "Create a fs for the root file systems:" @@ -59,7 +59,7 @@ do mkdir -p /mnt/${dir} done echo -echo " mount drive {/dev/sda} to /boot/grub" +echo " mount drive {/dev/sdb} to /boot/grub" mount $BOOTDRIVE /mnt/boot/grub echo echo "mounting necessary directories" @@ -68,7 +68,7 @@ mount --rbind /proc /mnt/proc mount --rbind /run /mnt/run mount --rbind /sys /mnt/sys echo -echo " mount drive {/dev/sda} to /boot/grub" +echo " mount drive {/dev/sdb} to /boot/grub" mount $BOOTDRIVE /mnt/boot/grub echo echo "creating /home to snapshot" @@ -88,14 +88,36 @@ echo "copying a valid resolv.conf into directory, before chroot to get to the ne if [ -e "/etc/resolv.conf" ] ; then #Copy the current host resolv.conf (assume it is working) cp /etc/resolv.conf /mnt/etc/resolv.conf + cp /etc/resolv.conf /mnt/root/resolv.conf fi #Now inject a couple always-working DNS nameservers into the end of resolv.conf echo "8.8.8.8" >> /mnt/etc/resolv.conf echo "8.8.4.4" >> /mnt/etc/resolv.conf +echo "copying void_install_zfs_02.sh into directory, before chroot to get to the new install" +cp void_install_zfs_02.sh /mnt/ + +echo "CHROOT into mount and finish setting up" + + +chroot /mnt/ /bin/bash -x <<'EOF' +./void_install_zfs_02.sh +EOF +#!/bin/bash + +# This script was influenced by https://wiki.voidlinux.org/Manual_install_with_ZFS_root +SYSTEMDRIVE="/dev/sdb2" +BOOTDRIVE="/dev/sdb1" +BOOTDEVICE="/dev/sdb" +ZPOOL="trident" +REPO="http://alpha.de.repo.voidlinux.org/current/musl" +PACKAGES="" +PACKAGES_CHROOT="iwd wpa_supplicant dhcpcd bluez linux-firmware foomatic-db-nonfree vlc phototonic trojita telegram-desktop falkon lynx qterminal openvpn git pianobar w3m ntfs-3g fuse-exfat simple-mtpfs fish-shell zsh x264 libdvdcss gutenprint foomatic-db hplip tor nano xorg lumina dhclient" +SERVICES_ENABLED="dbus sshd dhcpcd dhclient cupsd wpa_supplicant" + + echo "CHROOT into mount and finish setting up" -chroot /mnt/ /bin/bash echo "setting up /" chown root:root / chmod 755 / @@ -114,7 +136,7 @@ echo echo echo "Check if grub-probe / outputs zfs, else hack /usr/sbin/grub-mkconfig and insert values of" -echo "GRUB_DEVICE=/dev/sda2 and GRUB_DEVICE_BOOT=/dev/sda2 directly." +echo "GRUB_DEVICE=/dev/sdb2 and GRUB_DEVICE_BOOT=/dev/sdb2 directly." echo if [ "zfs" != $(grub-probe /) ] ; then echo "ERROR: Could not verify ZFS nature of /" From f806bb0b6615c5dad93d08b27a7fe8a8a4b2e642 Mon Sep 17 00:00:00 2001 From: Rod Myers <10093452+RodMyers@users.noreply.github.com> Date: Wed, 2 Oct 2019 08:11:46 -0400 Subject: [PATCH 2/3] Delete void-install-zfs.sh --- src-sh/void-install-zfs.sh | 174 ------------------------------------- 1 file changed, 174 deletions(-) delete mode 100755 src-sh/void-install-zfs.sh diff --git a/src-sh/void-install-zfs.sh b/src-sh/void-install-zfs.sh deleted file mode 100755 index 0708690..0000000 --- a/src-sh/void-install-zfs.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash - -# This script was influenced by https://wiki.voidlinux.org/Manual_install_with_ZFS_root -SYSTEMDRIVE="/dev/sdb2" -BOOTDRIVE="/dev/sdb1" -BOOTDEVICE="/dev/sdb" -ZPOOL="trident" -REPO="http://alpha.de.repo.voidlinux.org/current/musl" -PACKAGES="" -PACKAGES_CHROOT="iwd wpa_supplicant dhcpcd bluez linux-firmware foomatic-db-nonfree vlc phototonic trojita telegram-desktop falkon lynx qterminal openvpn git pianobar w3m ntfs-3g fuse-exfat simple-mtpfs fish-shell zsh x264 libdvdcss gutenprint foomatic-db hplip tor nano xorg lumina dhclient" -SERVICES_ENABLED="dbus sshd dhcpcd dhclient cupsd wpa_supplicant" - -## Some important packages -## nano xorg lumina iwd wpa_supplicant dhcpcd bluez linux-firmware-network - -if [ ! -e "/bin/zpool" ] ; then - #Need to install the zfs package first - xbps-install -S - xbps-install -y zfs -fi - -echo "Create the pool" -echo "zpool create -f /dev/sdb2" -zpool create -f ${ZPOOL} $SYSTEMDRIVE -echo -echo "Create a fs for the root file systems:" -echo "zfs create /ROOT" -zfs create ${ZPOOL}/ROOT -echo -echo "Create a fs for the Void file system" -echo "zfs create /ROOT/" -zfs create ${ZPOOL}/ROOT/$HOSTNAME -echo -echo "Unmount all ZFS filesystems:" -echo "zfs umount -a" -zfs umount -a -echo -echo "set mount point" -echo "zfs set mountpoint=/ >pool_name>/ROOT/" -zfs set mountpoint=/ ${ZPOOL}/ROOT/$HOSTNAME -echo -echo "set bootfs" -echo "zpool set bootfs=rpool/ROOT/voidlinux_1 " -zpool set bootfs=${ZPOOL}/ROOT/$HOSTNAME ${ZPOOL} -echo -echo "Export the pool" -echo "zpool set bootfs=rpool/ROOT/voidlinux_1 " -zpool export ${ZPOOL} -echo -echo "Import the pool below /mnt:" -echo "zpool import -R /mnt ${ZPOOL}" -zpool import -R /mnt ${ZPOOL} -echo -echo "making neccesary directories" -echo "mkdir -p /mnt/{boot/grub,dev,proc,run,sys}" -dirs="boot/grub dev etc proc run sys" -for dir in ${dirs} -do - mkdir -p /mnt/${dir} -done -echo -echo " mount drive {/dev/sdb} to /boot/grub" -mount $BOOTDRIVE /mnt/boot/grub -echo -echo "mounting necessary directories" -mount --rbind /dev /mnt/dev -mount --rbind /proc /mnt/proc -mount --rbind /run /mnt/run -mount --rbind /sys /mnt/sys -echo -echo " mount drive {/dev/sdb} to /boot/grub" -mount $BOOTDRIVE /mnt/boot/grub -echo -echo "creating /home to snapshot" -zfs create -o compression=lz4 ${ZPOOL}/home -echo -#echo "for things that we probably don't need to clone" -zfs create -o compression=lz4 ${ZPOOL}/var -zfs create -o compression=lz4 ${ZPOOL}/var/logs -zfs create -o compression=lz4 ${ZPOOL}/var/tmp -zfs create -o compression=lz4 ${ZPOOL}/var/mail -echo -echo "Installing MUSL voidlinux, before chroot into it" -xbps-install -S -XBPS_ARCH=x86_64-musl xbps-install -S -y --repository=${REPO} -r /mnt base-system grub ${PACKAGES} -echo -echo "copying a valid resolv.conf into directory, before chroot to get to the new install" -if [ -e "/etc/resolv.conf" ] ; then - #Copy the current host resolv.conf (assume it is working) - cp /etc/resolv.conf /mnt/etc/resolv.conf - cp /etc/resolv.conf /mnt/root/resolv.conf -fi -#Now inject a couple always-working DNS nameservers into the end of resolv.conf -echo "8.8.8.8" >> /mnt/etc/resolv.conf -echo "8.8.4.4" >> /mnt/etc/resolv.conf - -echo "copying void_install_zfs_02.sh into directory, before chroot to get to the new install" -cp void_install_zfs_02.sh /mnt/ - -echo "CHROOT into mount and finish setting up" - - -chroot /mnt/ /bin/bash -x <<'EOF' -./void_install_zfs_02.sh -EOF -#!/bin/bash - -# This script was influenced by https://wiki.voidlinux.org/Manual_install_with_ZFS_root -SYSTEMDRIVE="/dev/sdb2" -BOOTDRIVE="/dev/sdb1" -BOOTDEVICE="/dev/sdb" -ZPOOL="trident" -REPO="http://alpha.de.repo.voidlinux.org/current/musl" -PACKAGES="" -PACKAGES_CHROOT="iwd wpa_supplicant dhcpcd bluez linux-firmware foomatic-db-nonfree vlc phototonic trojita telegram-desktop falkon lynx qterminal openvpn git pianobar w3m ntfs-3g fuse-exfat simple-mtpfs fish-shell zsh x264 libdvdcss gutenprint foomatic-db hplip tor nano xorg lumina dhclient" -SERVICES_ENABLED="dbus sshd dhcpcd dhclient cupsd wpa_supplicant" - - -echo "CHROOT into mount and finish setting up" - -echo "setting up /" -chown root:root / -chmod 755 / -passwd root -echo - -echo "sync repo, add additional repo, and then re-sync" -xbps-install -S -xbps-install -y void-repo-nonfree -xbps-install -S - -echo -echo "NOW install zfs and other packages which make config changes on install" -xbps-install zfs -y ${PACKAGES_CHROOT} -echo - -echo -echo "Check if grub-probe / outputs zfs, else hack /usr/sbin/grub-mkconfig and insert values of" -echo "GRUB_DEVICE=/dev/sdb2 and GRUB_DEVICE_BOOT=/dev/sdb2 directly." -echo -if [ "zfs" != $(grub-probe /) ] ; then - echo "ERROR: Could not verify ZFS nature of /" - exit 1 -fi -grub-install ${BOOTDEVICE} - -echo -echo "making sure we have this file /etc/zfs/zpool.cache" -zpool set cachefile=/etc/zfs/zpool.cache ${ZPOOL} - -echo -echo "Auto-enabling services" -for service in ${SERVICES_ENABLED} -do - echo " -> ${service}" - ln -s /etc/sv/${service} /var/service/${service} -done - -echo -echo "Fix dracut and kernel config, then update grub" -echo hostonly=yes >> /etc/dracut.conf -xbps-reconfigure -f linux5.2 -#Now reinstall grub on the boot device after the reconfiguration -if [ "zfs" != $(grub-probe /) ] ; then - echo "ERROR: Could not verify ZFS nature of /" - exit 1 -fi -grub-install ${BOOTDEVICE} - -echo "==============" -echo "FINAL STEP: edit /etc/rc.conf to uncomment info as necessary" -echo "1. nano /etc/rc.conf" -echo "2. reboot when ready" -echo "==============" From 0bb1f59cdf925c4225c4c28a646c22592d4a0e20 Mon Sep 17 00:00:00 2001 From: Rod Myers <10093452+RodMyers@users.noreply.github.com> Date: Wed, 2 Oct 2019 08:20:44 -0400 Subject: [PATCH 3/3] Delete void-build-iso.sh --- src-sh/void-build-iso.sh | 46 ---------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src-sh/void-build-iso.sh diff --git a/src-sh/void-build-iso.sh b/src-sh/void-build-iso.sh deleted file mode 100644 index 36db79b..0000000 --- a/src-sh/void-build-iso.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -#Verify that needed packages are installed -packages="git qemu-user-static liblz4 make" -for pkg in ${packages} -do - xbps-query -l | grep -q "ii ${pkg}-" - if [ $? != 0 ] ; then - echo "Installing Package: ${pkg}" - xbps-install -y ${pkg} - fi -done - -#Fetch the void linux ISO build repository -repodir="~/.voidbuild" -if [ ! -d "${repodir}" ] ; then - git clone https://github.com/void-linux/void-mklive ${repodir} -else - cd ${repodir} && git pull -fi - -outdir="~/void-build-iso" -if [ ! -d "${outdir}" ] ; then - mkdir -p ${outdir} -fi - -readonly ARCH="x86_64-musl" -readonly DATE=$(date +%Y%m%d) -readonly IMGNAME="trident-${ARCH}-${DATE}.iso" - -readonly GRUB_PKGS="grub-i386-efi grub-x86_64-efi" -readonly BASE_PKGS="dialog mdadm ${GRUB_PKGS}" -readonly TRIDENT_PKGS="${BASE_PKGS} zfs wget" - -# Make sure the output ISO file does not already exist (repeated builds) -if [ -e "${outdir}/${IMGNAME}" ] ; then - echo "Removing stale image: ${outdir}/${IMGNAME}" - rm "${outdir}/${IMGNAME}" -fi - -cd ${repodir} && ./mklive.sh.in -a ${ARCH} -o "${outdir}/${IMGNAME}" -p "${TRIDENT_PKGS}" $@ -if [ $? -eq 0 ] ; then - echo "ISO Generated: ${outdir}/${IMGNAME}" -else - echo "Unable to create ISO" -fi