...
 
Commits (5)
......@@ -32,12 +32,14 @@ ZFSROOTDATASET=${ZFSROOTBASENAME}/system
-O relatime=on \
-O xattr=sa \
-O compression=on \
-o ashift=12 \
-O normalization=formD \
-o ashift=12 \
${ZPOOLNAME} /dev/mapper/${LUKSNAME}
# adjust below datasets as desired - could be more elaborate, cp. https://github.com/zfsonlinux/zfs/wiki/Debian-Buster-Root-on-ZFS
# also this subvolume'd sort of system won't work for Bedrock Linux [ https://bedrocklinux.org/ ] , the entire rootfs (and probably /boot ) will need to be part of the same dataset
# root for essential system bits, perhaps to be snapshotted/cloned
/sbin/zfs create -o canmount=off ${ZFSROOTBASENAME}
/sbin/zfs create -o mountpoint=/ ${ZFSROOTDATASET}
......@@ -60,8 +62,9 @@ ZFSROOTDATASET=${ZFSROOTBASENAME}/system
# show the user what has been done:
/sbin/zpool status -v # print zpool info
/sbin/zpool list # print zpool list
/sbin/zfs list # show zfs filesystems
# message to user
echo "You have successfully created a ZFS pool ${ZPOOLNAME} and various ZFS datasets. You may now proceed to the next step; execute the following in the terminal:"
echo "You have successfully created a ZFS pool ${ZPOOLNAME} and various ZFS datasets (see details immediately above). You may now proceed to the next step; execute the following in the terminal:"
echo ". 03-fetch-void-rootfs.sh"
......@@ -31,7 +31,7 @@ else
if [ ${badcheck} == "YES" ]
then
tar xfv ./${VOIDROOTFS} -C ${TARGET}
echo "You have successfully installed the Void Linux base system from ${VOIDROOTFS}. You may proceed to the next step; execute the following in the terminal:"
echo "You have installed the Void Linux base system from ${VOIDROOTFS}, though there was apparently a checksum mismatch. You may proceed with caution to the next step; execute the following in the terminal:"
echo ". 04-create-luks-keyfile.sh"
else
echo "Cancelled."
......
......@@ -65,6 +65,13 @@ read -p "The following will take some time - you may want to go and put the kett
# install crucial packages, including zfs, which will trigger DKMS ZFS module creation for each kernel
xbps-install -S linux cryptsetup grub zfs
# disable resume functionality from dracut
echo "omit_dracutmodules+=\" resume \"" > /etc/dracut.conf.d/omit-resume-for-zvol-swap.conf
# inform user about resume
echo "[Resume functionality has been disabled from dracut. Otherwise future kernels which are installed will take 2-3 minutes to boot while dracut searches for the swap partition to initialise resume. This issue will be investigated, but disabling resume from dracut prevents the delayed boot.]"
# dracut
sed -i 's/--force/--force --hostonly --include \/boot\/rootkey.bin \/rootkey.bin/' /etc/kernel.d/post-install/20-dracut
......@@ -95,12 +102,6 @@ mkswap -f /dev/zvol/${ZPOOLNAME}/swap
echo "# zol swap vol" >> /etc/fstab
echo "/dev/zvol/${ZPOOLNAME}/swap none swap sw 0 0" >> /etc/fstab
# disable resume functionality from dracut
echo "omit_dracutmodules+=\" resume \"" > /etc/dracut.conf.d/omit-resume-for-zvol-swap.conf
# inform user about resume
echo "[Resume functionality has been disabled from dracut. Otherwise future kernels which are installed will take 2-3 minutes to boot while dracut searches for the swap partition to initialise resume. This issue will be investigated, but disabling resume from dracut prevents the delayed boot.]"
# Setting zfs cache
echo "Setting zpool cachefile for ${ZPOOLNAME}."
zpool set cachefile=/etc/zfs/zpool.cache ${ZPOOLNAME} # IMPORTANT
......@@ -114,26 +115,23 @@ until passwd ${USERNAME}; do echo "Confirmation didn't match. Please try again.
read -p "Would you like to set limit ARC size? (By default it will default to half available memory; if you're running a desktop/laptop, you may want to set it lower; if you're running a file-server, you may want to set it higher.) [Y/n]: " ARCSET
ARCSET=${ARCSET:-Y}
if [ ${ARCSET} == "Y" ]
if [ ${ARCSET} == "Y" ] || [ ${ARCSET} == "y" ]
then
echo "Installing bc for calculations..."
xbps-install -S bc
RAWMEM=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
MEMAVAIL=`echo "${RAWMEM}*1.025/1024/1024" | bc`
# MEMAVAIL=`echo $(((${RAWMEM}*1.025)/1024)/1024)`
MEMAVAIL=`awk -v RAWMEM=$RAWMEM 'BEGIN {printf "%.0f\n", (((RAWMEM * 1.025)/1024) / 1024) }'`
echo "You have ${MEMAVAIL}Gb available. How much memory would you like to reserve for ARC? "
until [[ "${ARCREZ}" =~ ^[0-9.]+$ ]] && [[ `echo "${ARCREZ} > 0" | bc` == 1 ]] && [[ `echo "${ARCREZ} < ${RAWMEM}" | bc` == 1 ]]
do read -p "Enter a number in Gb (e.g. \"4\", \"1.7125\" &c.): " ARCREZ
until [[ "${ARCREZ}" =~ ^[0-9]+(\.[0-9]+)?$ ]] && [[ $largerthanzero == 1 ]] && [[ $biggerthanram == 1 ]]
do read -p "Enter a number in Gb that is larger than 0 and less than ${MEMAVAIL}, (e.g. \"4\", \"1.76\"): " ARCREZ
largerthanzero=`awk -v ARCREZ="$ARCREZ" 'BEGIN { print (ARCREZ > 0) }'`
biggerthanram=`awk -v ARCREZ="$ARCREZ" -v MEMAVAIL="$MEMAVAIL" 'BEGIN { print (ARCREZ<MEMAVAIL) }'`
done
MEMINBYTES=`echo "${ARCREZ}*1024*1024*1024" | bc | awk '{printf("%d\n",$1 + 0.5)}'`
ARCREZINT=${ARCREZ%.*}
MEMINBYTES=`echo "$((ARCREZINT*1024*1024*1024))"`
echo "
# Limit ZFS ARC to ${ARCREZ}Gb
echo ${MEMINBYTES} >> /sys/module/zfs/parameters/zfs_arc_max" >> /etc/rc.local
echo "ARC size specified in /etc/rc.local"
echo "Removing bc package"
xbps-remove -R bc
fi
......@@ -142,7 +140,7 @@ read -p "Do you want to install NetworkManager? [Y/n]: " NETWORKMAN
NETWORKMAN=${NETWORKMAN:-Y}
# networkmanager configuration
if [ ${NETWORKMAN} == "Y" ]
if [ ${NETWORKMAN} == "Y" ] || [ ${NETWORKMAN} == "y" ]
then
echo "polkit.addRule(function(action, subject) {
if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
......@@ -163,7 +161,7 @@ echo "export NETWORKMAN=${NETWORKMAN}" >> /root/importvars.sh
mv 08-post-installation-setup.sh /root/08-post-installation-setup.sh
# message to user
echo "You have successfully configured Void Linux. The next step is leaving the chroot, unmounting bind mounts and exporting the ZFS pool. After exiting the chroot, please execute the following in the terminal:"
echo "You have successfully configured Void Linux. The next step is leaving the chroot, unmounting bind mounts and exporting the ZFS pool. These actions will be performed by the next script. After exiting the chroot, please execute the following in the terminal:"
echo ". 07-umount-reboot.sh"
read -p "Press <return> to exit chroot." exitchroot
......
......@@ -8,11 +8,16 @@ then
rm -fr /var/service/wpa_supplicant
ln -s /etc/sv/NetworkManager /var/service
ln -s /etc/sv/dbus /var/service
# inform user how to enable network
echo "Once this script finishes, you can connect to a WiFi network immediately (without going through a full GUI/desktop environment), by running `nmtui` (NetworkManager's text user interface) and activating/signing into the appropriate network."
fi
echo "You will want to continue post-installation configuration of Void, perhaps particularly including network configuration and enablig of sudo access for wheel group via 'visudo'. Please refer to the Void Wiki, particularly:"
# messages to user
echo "You will want to continue post-installation configuration of Void, perhaps particularly including network configuration and enabling of sudo access for wheel group via 'visudo'."
echo "Please refer to the Void Wiki, particularly:"
echo "https://wiki.voidlinux.org/Network_Configuration"
echo "https://wiki.voidlinux.org/Post_Installation"
echo "(Some things are being migrated to https://docs.voidlinux.org , which you might also refer to.)"
echo ""
read -p "Press <return> to clean-up files and exit from root." exiting
rm importvars.sh
......