Commit 492efbe4 authored by Benjamin Slade's avatar Benjamin Slade

ask user about setting up auto-trim on solid state device

- added SSD detection in 01-cryptsetup.sh
- added export of SSD feature in 05-set-up-and-chroot.sh
- added dialogue inquiring if user wants auto-trim set on zpool device
parent fcf08586
......@@ -9,6 +9,9 @@ echo "Here and throughout, hitting the <return> key accepts the default value sh
read -p "Enter the device you want to install to [/dev/sda]: " DEVICE
DEVICE=${DEVICE:-/dev/sda}
# determine if device is SSD or not
ROTATIONAL=`cat /sys/block/"${DEVICE#/dev/}"/queue/rotational`
read -p "Enter the name to assign to the LUKS partition [cryptz]: " LUKSNAME
LUKSNAME=${LUKSNAME:-cryptz}
......
......@@ -19,6 +19,7 @@ echo "export CRYPTUUID=${CRYPTUUID}" >> ${TARGET}/importvars.sh
echo "export LUKSNAME=${LUKSNAME}" >> ${TARGET}/importvars.sh
echo "export ZPOOLNAME=${ZPOOLNAME}" >> ${TARGET}/importvars.sh
echo "export USERNAME=${USERNAME}" >> ${TARGET}/importvars.sh
echo "export ROTATIONAL=${ROTATIONAL}" >> ${TARGET}/importvars.sh
cp 06-config-inside-chroot.sh ${TARGET}
cp 08-post-installation-setup.sh ${TARGET}
......
......@@ -71,7 +71,6 @@ echo "omit_dracutmodules+=\" resume \"" > /etc/dracut.conf.d/omit-resume-for-zvo
# 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
......@@ -106,10 +105,24 @@ echo "/dev/zvol/${ZPOOLNAME}/swap none swap sw 0 0" >> /etc/fstab
echo "Setting zpool cachefile for ${ZPOOLNAME}."
zpool set cachefile=/etc/zfs/zpool.cache ${ZPOOLNAME} # IMPORTANT
# setting up user
useradd -m -s /bin/bash -U -G wheel,users,audio,video,cdrom,input ${USERNAME}
echo "Set password for user ${USERNAME}: "
until passwd ${USERNAME}; do echo "Confirmation didn't match. Please try again. " ; done
# setting autotrim feature
if [[ ${ROTATIONAL} == 0 ]]
then
read -p "You appear to be running an SSD. You can set up automatic TRIM for better wear-levelling performance. (You can always turn this feature on/off later, or handle TRIM manually.)
Note that minimal data leakage in the form of freed block information, perhaps sufficient to determine the filesystem in use, may occur on LUKS-encrypted devices with TRIM enabled (see https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard/TRIM_support_for_solid_state_drives_(SSD) for more information).
Would you like to set up automatic TRIM? [Y/n]: " TRIM
TRIM=${TRIM:-Y}
if [ ${TRIM} == "Y" ] || [ ${TRIM} == "y" ]
then
zpool upgrade ${ZPOOLNAME}
sudo zpool set autotrim=on ${ZPOOLNAME}
echo "Autotrim feature enabled on ${ZPOOLNAME}."
else
echo "Autotrim NOT enabled."
fi
fi
# setting ARC
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
......@@ -137,6 +150,10 @@ then
grub-mkconfig -o /boot/grub/grub.cfg
fi
# setting up regular user
useradd -m -s /bin/bash -U -G wheel,users,audio,video,cdrom,input ${USERNAME}
echo "Set password for user ${USERNAME}: "
until passwd ${USERNAME}; do echo "Confirmation didn't match. Please try again. " ; done
# additional configuration
read -p "Do you want to install NetworkManager? [Y/n]: " NETWORKMAN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment