24 Commits

Author SHA1 Message Date
2ebb72620b Put 'wifiName' variable used by 'nmcli' command inside double quotes 2026-01-11 19:06:34 -05:00
25afed7541 Fixed mismatched variable names 2026-01-11 19:04:57 -05:00
b8b5918feb Add 'sudo' to list of packages to install via mmdebstrap 2026-01-11 19:01:07 -05:00
fd177fa071 Have 'zpool export' export only the newly created pool instead of all pools 2026-01-02 10:49:35 -05:00
aaa209a056 Use 'umount -nR' regardless of OS 2026-01-02 10:48:39 -05:00
38dc3ab73a Added missing mount of efivars 2026-01-02 10:43:28 -05:00
3c8719450d Added spacing between mount commands 2026-01-02 10:42:58 -05:00
e8c745a307 Removed '-R' flag from umount command 2026-01-02 10:16:04 -05:00
00324dfb5d Changed mounting script from 'rbind.sh' to 'mount.sh' 2026-01-02 10:13:31 -05:00
e03ff714a7 Added new 'mount.sh' script to align with ZFSBootMenu documentation 2026-01-02 10:12:54 -05:00
6e1670ac6a Adjust newlines 2026-01-02 10:07:51 -05:00
3e233de780 Changed maximum SWAP size from 32GiB to 16GiB 2026-01-02 08:45:01 -05:00
b57734ddbb Added 'ca-certificates' to the list of packages mmdebstrap installes for Debian 2026-01-02 08:40:07 -05:00
e78d63fee7 Removed options that are no longer relevant due to script flow and moved 'WiFi Setup' to bottom 2026-01-01 13:16:09 -05:00
ee2967c522 Changed unneeded 'elif' statements to simple individual 'if' statements 2026-01-01 13:13:07 -05:00
023c12cb8e Removed options that are no longer relevant due to script flow and moved 'WiFi Setup' to bottom 2026-01-01 13:09:23 -05:00
d1bbf9889b Added check to see if '/usr/bin/os-prober' exists before trying to purge it 2026-01-01 13:08:31 -05:00
e3428baed2 Corrected how 'baseDir' is to be determined 2026-01-01 12:44:28 -05:00
1e378f8fe1 Updated checklist to reflect current progress 2026-01-01 12:43:52 -05:00
56b4fbd596 Removed unneeded bits that served no function 2026-01-01 12:43:28 -05:00
7e9c59750b Updated how 'baseDir' variable is determined 2026-01-01 12:43:06 -05:00
f7cdd0c419 Moved last bit of Fedora specific stuff into 'fedora.sh' 2026-01-01 12:41:59 -05:00
8b892d207d Changed unneeded 'elif' statements to simple individual 'if' statements 2026-01-01 12:40:03 -05:00
8d3c013539 Updated checklist to reflect current progress 2026-01-01 00:06:29 -05:00
11 changed files with 205 additions and 123 deletions

View File

@@ -6,13 +6,13 @@ The purpose of this branch is to modularize as many functions of the scripts as
## Checklist
[X] Rename all `base-` scripts to remove `base-`
[ ] Move (at least almost) all Debian related commands and tasks to `debian.sh`
[ ] Move (at least almost) all Fedora related commands and tasks to `fedora.sh`
[ ] Move (at least almost) all elementary OS related commands and tasks to `elementary.sh`
[ ] Rename flags in all distro specific scripts from numbered (i.e. `-1`, `-2`) to descriptive (i.e. `--mmdebstrap`, `--network-interfaces`)
[X] Move (at least almost) all Debian related commands and tasks to `debian.sh`
[X] Move (at least almost) all Fedora related commands and tasks to `fedora.sh`
[X] Move (at least almost) all elementary OS related commands and tasks to `elementary.sh`
[X] Rename flags in all distro specific scripts from numbered (i.e. `-1`, `-2`) to descriptive (i.e. `--mmdebstrap`, `--network-interfaces`)
[X] Move all EFI related commands and tasks to a new `efi.sh` script
[X] Rename `mkfs.zfs.sh` to `zfs.sh`
[ ] Point any distro-specific commands/tasks that are shared with Debian to use `debian.sh` to avoid any unnecessary duplication
[X] Point any distro-specific commands/tasks that are shared with Debian to use `debian.sh` to avoid any unnecessary duplication
[ ] Rewrite `README.md`
[ ] Rename all script-specific variables to lowercase with singular capital letters to seperate words in variable name
[ ] Update how `baseDir` is set using `realpath $(basedir "${0}")`
[X] Rename all script-specific variables to lowercase with singular capital letters to seperate words in variable name
[X] Update how `baseDir` is set using `realpath $(dirname "${0}")`

View File

@@ -31,8 +31,11 @@ EOF
systemd-timesyncd \
whois \
zfsutils-linux
elif [[ "${1}" == '--mmdebstrap' ]]; then
fi
if [[ "${1}" == '--mmdebstrap' ]]; then
packages=(\
ca-certificates \
console-setup \
cryptsetup \
curl \
@@ -51,6 +54,7 @@ openssh-{client,server} \
popularity-contest \
printer-driver-all \
rsync \
sudo \
systemd-timesyncd \
tasksel \
zfs-initramfs \
@@ -71,7 +75,9 @@ zstd\
${include} \
"${VERSION_CODENAME}" \
/mnt
elif [[ "${1}" == '--network-interfaces' ]]; then
fi
if [[ "${1}" == '--network-interfaces' ]]; then
networkInterface=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
shopt -s extglob
@@ -81,7 +87,9 @@ allow-hotplug ${networkInterface[$i]}
iface ${networkInterface[$i]} inet dhcp
EOF
done
elif [[ "${1}" == '--sources' ]]; then
fi
if [[ "${1}" == '--sources' ]]; then
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
# ${VERSION_CODENAME^}
Enabled: yes
@@ -109,7 +117,9 @@ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
rm /mnt/etc/apt/sources.list
elif [[ "${1}" == '--dpkg-reconfigure' ]]; then
fi
if [[ "${1}" == '--dpkg-reconfigure' ]]; then
cat << EOF
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
@@ -123,12 +133,16 @@ EOF
tzdata \
keyboard-configuration \
console-setup
elif [[ "${1}" == '--purge-os-prober' ]]; then
fi
if [[ "${1}" == '--purge-os-prober' ]]; then
apt \
purge \
--yes \
os-prober
elif [[ "${1}" == '--network-manager' ]]; then
fi
if [[ "${1}" == '--network-manager' ]]; then
cp \
/etc/NetworkManager/NetworkManager.conf \
/etc/NetworkManager/NetworkManager.conf.orig
@@ -137,7 +151,9 @@ elif [[ "${1}" == '--network-manager' ]]; then
/etc/NetworkManager/NetworkManager.conf.orig | \
sed 's|managed=false|managed=true|' | \
tee /etc/NetworkManager/NetworkManager.conf &> /dev/null
elif [[ "${1}" == '--contrib' ]]; then
fi
if [[ "${1}" == '--contrib' ]]; then
cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
# ${VERSION_CODENAME^} Backports
@@ -167,7 +183,9 @@ Pin: release n=${VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
fi
elif [[ "${1}" == '--tasksel' ]]; then
fi
if [[ "${1}" == '--tasksel' ]]; then
if [[ ! -f /usr/bin/tasksel ]]; then
apt \
--update \
@@ -178,7 +196,9 @@ elif [[ "${1}" == '--tasksel' ]]; then
tasksel \
--new-install
elif [[ "${1}" == '--initramfs' ]]; then
fi
if [[ "${1}" == '--initramfs' ]]; then
printf \
"UMASK=0077\n" | \
tee /etc/initramfs-tools/conf.d/umask.conf &> /dev/null
@@ -186,13 +206,17 @@ elif [[ "${1}" == '--initramfs' ]]; then
update-initramfs \
-c \
-k all
elif [[ "${1}" == '--logrotate' ]]; then
fi
if [[ "${1}" == '--logrotate' ]]; then
for file in /etc/logrotate.d/* ; do
if grep -Eq "(^|[^#y])compress" "$file" ; then
sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
fi
done
elif [[ "${1}" == '--systemctl-enable' ]]; then
fi
if [[ "${1}" == '--systemctl-enable' ]]; then
systemctl \
enable \
zfs.target

View File

@@ -45,7 +45,9 @@ zstd\
${include} \
"${UBUNTU_VERSION_CODENAME}" \
/mnt
elif [[ "${1}" == '--sources' ]]; then
fi
if [[ "${1}" == '--sources' ]]; then
cat <<EOF >/mnt/etc/apt/sources.list.d/${UBUNTU_VERSION_CODENAME}.sources
# ${UBUNTU_VERSION_CODENAME^}
Enabled: yes
@@ -91,11 +93,15 @@ Signed-By: /etc/apt/trusted.gpg.d/patches.key.asc
EOF
rm /mnt/etc/apt/sources.list
elif [[ "${1}" == '--skel' ]]; then
fi
if [[ "${1}" == '--skel' ]]; then
rsync -pogAXtlHrDx \
/etc/skel \
/mnt/etc
elif [[ "${1}" == '--elementary' ]]; then
fi
if [[ "${1}" == '--elementary' ]]; then
cp \
/etc/os-release \
/mnt/etc
@@ -103,7 +109,9 @@ elif [[ "${1}" == '--elementary' ]]; then
cp \
/etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \
/mnt/etc/apt/trusted.gpg.d/
elif [[ "${1}" == '--network' ]]; then
fi
if [[ "${1}" == '--network' ]]; then
mkdir \
-p \
/mnt/run/systemd/resolve/
@@ -115,7 +123,9 @@ elif [[ "${1}" == '--network' ]]; then
touch \
/mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
elif [[ "${1}" == '--apps' ]]; then
fi
if [[ "${1}" == '--apps' ]]; then
app=(\
io.elementary.calculator \
io.elementary.camera \
@@ -141,19 +151,25 @@ org.gnome.font-viewer\
appcenter \
-y \
${apps}
elif [[ "${1}" == '--purge' ]]; then
fi
if [[ "${1}" == '--purge' ]]; then
apt \
purge \
--yes \
--autoremove \
gnome-software \
snapd
elif [[ "${1}" == '--desktop' ]]; then
fi
if [[ "${1}" == '--desktop' ]]; then
apt \
install \
--yes \
elementary-desktop
elif [[ "${1}" == '--namarupa' ]]; then
fi
if [[ "${1}" == '--namarupa' ]]; then
curl \
--progress \
--location \

View File

@@ -35,7 +35,9 @@ if [[ "${1}" == '--live' ]]; then
modprobe \
zfs
elif [[ "${1}" == '--rsync' ]]; then
fi
if [[ "${1}" == '--rsync' ]]; then
mkdir -p /run/install
if [[ "${VERSION_ID}" -lt '41' ]]; then
@@ -50,15 +52,77 @@ elif [[ "${1}" == '--rsync' ]]; then
--exclude=/etc/machine-id \
--info=progress2 \
/run/install/ /mnt
elif [[ "${1}" == '--resolv-conf' ]]; then
fi
if [[ "${1}" == '--resolv-conf' ]]; then
mv /mnt/etc/resolv.conf \
/mnt/etc/resolv.conf.orig
cp -L \
/etc/resolv.conf \
/mnt/etc
elif [[ "${1}" == '--dracut' ]]; then
fi
if [[ "${1}" == '--dracut' ]]; then
dracut \
--force \
--regenerate-all
fi
if [[ "${1}" == '--zfs-install' ]]; then
if [[ "${encryption}" == 'yes' ]]; then
cat << EOF | tee /etc/dracut.conf.d/zol.conf &> /dev/null
nofsck="yes"
add_dracutmodules+=" zfs "
omit_dracutmodules+=" btrfs "
install_items+=" /etc/zfs/keys/${hostname,,}.key "
EOF
else
cat <<EOF >/etc/dracut.conf.d/zol.conf
nofsck="yes"
add_dracutmodules+=" zfs "
omit_dracutmodules+=" btrfs "
EOF
fi
if [[ "${VERSION_ID}" -lt '41' ]]; then
dnf \
config-manager \
--disable \
updates
else
dnf \
config-manager \
setopt \
updates.enabled=0
fi
dnf \
install \
-y \
https://dl.fedoraproject.org/pub/fedora/linux/releases/${VERSION_ID}/Everything/x86_64/os/Packages/k/kernel-devel-$(uname -r).rpm
dnf \
--releasever=${VERSION_ID} \
install \
-y \
https://zfsonlinux.org/fedora/zfs-release-${ZOL_FEDORA_VER}$(rpm --eval "%{dist}").noarch.rpm
dnf \
install \
-y \
zfs \
zfs-dracut
if [[ "${VERSION_ID}" -lt '41' ]]; then
dnf \
config-manager \
--enable \
updates
else
dnf \
config-manager \
setopt \
updates.enabled=1
fi
fi

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
baseDir="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
baseDir="$(realpath "$(dirname "${0}")")"
printf \
'\033[?47l\012'
@@ -35,61 +35,7 @@ if [[ ! -f "/etc/mtab" ]]; then
fi
if [[ "${ID}" == 'fedora' ]]; then
if [[ "${encryption}" == 'yes' ]]; then
cat << EOF | tee /etc/dracut.conf.d/zol.conf &> /dev/null
nofsck="yes"
add_dracutmodules+=" zfs "
omit_dracutmodules+=" btrfs "
install_items+=" /etc/zfs/keys/${hostname,,}.key "
EOF
else
cat <<EOF >/etc/dracut.conf.d/zol.conf
nofsck="yes"
add_dracutmodules+=" zfs "
omit_dracutmodules+=" btrfs "
EOF
fi
if [[ "${VERSION_ID}" -lt '41' ]]; then
dnf \
config-manager \
--disable \
updates
else
dnf \
config-manager \
setopt \
updates.enabled=0
fi
dnf \
install \
-y \
https://dl.fedoraproject.org/pub/fedora/linux/releases/${VERSION_ID}/Everything/x86_64/os/Packages/k/kernel-devel-$(uname -r).rpm
dnf \
--releasever=${VERSION_ID} \
install \
-y \
https://zfsonlinux.org/fedora/zfs-release-${ZOL_FEDORA_VER}$(rpm --eval "%{dist}").noarch.rpm
dnf \
install \
-y \
zfs \
zfs-dracut
if [[ "${VERSION_ID}" -lt '41' ]]; then
dnf \
config-manager \
--enable \
updates
else
dnf \
config-manager \
setopt \
updates.enabled=1
fi
"${baseDir}/fedora.sh" --zfs-install
fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
@@ -99,7 +45,9 @@ fi
"${baseDir}/partition.sh" --efi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/debian.sh" --purge-os-prober
if [[ -e '/usr/bin/os-prober' ]]; then
"${baseDir}/debian.sh" --purge-os-prober
fi
fi
if [[ "${ID}" == 'elementary' ]]; then

14
menu.sh
View File

@@ -26,10 +26,10 @@ while [[ ! "${option}" == 'Exit' ]]; do
#################
EOF
select option in 'List' 'Configure' 'Pre Install' 'Install' 'WiFi Setup' 'Post Install' 'Finalize' 'Exit'
select option in 'List' 'Configure' 'Install' 'Finalize' 'WiFi Setup' 'Exit'
do
case "${option}" in
'List'|'Configure'|'Pre Install'|'Install'|'WiFi Setup'|'Post Install'|'Finalize'|'Exit')
'List'|'Configure'|'Install'|'Finalize'|'WiFi Setup'|'Exit')
break
;;
*)
@@ -44,16 +44,12 @@ EOF
"${baseDir}/list.sh"
elif [[ "${option}" == 'Configure' ]]; then
"${baseDir}/configure.sh"
elif [[ "${option}" == 'Pre Install' ]]; then
"${baseDir}/pre-inst.sh"
elif [[ "${option}" == 'Install' ]]; then
"${baseDir}/install.sh"
elif [[ "${option}" == 'WiFi Setup' ]]; then
"${baseDir}/wifi.sh"
elif [[ "${option}" == 'Post Install' ]]; then
"${baseDir}/post-inst.sh"
"${baseDir}/pre-inst.sh"
elif [[ "${option}" == 'Finalize' ]]; then
"${baseDir}/finalize.sh"
elif [[ "${option}" == 'WiFi Setup' ]]; then
"${baseDir}/wifi.sh"
fi
printf '\033[?47h\033[2J\033[H'

28
mount.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -euo pipefail
mount \
--types proc \
proc \
/mnt/proc
mount \
--types sysfs \
sys \
/mnt/sys
mount \
--bind \
/dev \
/mnt/dev
mount \
--types devpts \
pts \
/mnt/dev/pts
mount \
--types efivarfs \
efivarfs \
/mnt/sys/firmware/efi/efivars

View File

@@ -46,8 +46,8 @@ if [[ "${1}" == '--disk' ]]; then
if [[ "${enableSwap}" == "yes" ]]; then
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
if [[ "${swapSize#}" -gt '32' ]]; then
swapSize='32'
if [[ "${swapSize#}" -gt '16' ]]; then
swapSize='16'
fi
sgdisk \
@@ -62,7 +62,9 @@ if [[ "${1}" == '--disk' ]]; then
-t3:BF00 \
-c3:${ID} \
${disk}
elif [[ "${1}" == '--efi' ]]; then
fi
if [[ "${1}" == '--efi' ]]; then
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part1='p1'

View File

@@ -84,7 +84,7 @@ elif [[ "${ID}" == 'debian' ]]; then
"${baseDir}/debian.sh" --sources
fi
"${baseDir}/rbind.sh"
"${baseDir}/mount.sh"
"${baseDir}/host-id.sh"
@@ -98,11 +98,9 @@ if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --skel
fi
# if [[ ! "${*}" = *--no-part* ]]; then
if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then
"${baseDir}/zfs.sh" --key
fi
# fi
if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then
"${baseDir}/zfs.sh" --key
fi
if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --elementary

View File

@@ -35,9 +35,9 @@ nmcli radio wifi on
nmcli device wifi list
printf "Enter the SSID of the WiFi network you wish to connect to:\n"
read -r WIFI_NAME
read -r wifiName
nmcli --ask device wifi connect ${wifiName}
nmcli --ask device wifi connect "${wifiName}"
cat << EOF

40
zfs.sh
View File

@@ -30,14 +30,14 @@ if [[ "${1}" == '--format' ]]; then
while [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]] || [[ -z "${zpoolPassword}" ]] || [[ "${#zpoolPassword}" -lt '8' ]]; do
printf \
"\nEnter a password to encrypt your root pool (minimum 8 characters):\n"
"Enter a password to encrypt your root pool (minimum 8 characters):\n"
read \
-r \
-s \
zpoolPassword
printf \
"\nVerify the password to encrypt your root pool:\n"
"Verify the password to encrypt your root pool:\n"
read \
-r \
-s \
@@ -45,13 +45,13 @@ if [[ "${1}" == '--format' ]]; then
if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
printf \
"ERROR:\tPasswords do not match!\n"
"ERROR:\tPasswords do not match!\n\n"
elif [[ -z "${zpoolPassword}" ]]; then
printf \
"ERROR:\tPassword is empty!\n"
"ERROR:\tPassword is empty!\n\n"
elif [[ "${#zpoolPassword}" -lt '8' ]]; then
printf \
"ERROR:\tPassword is too short!\n"
"ERROR:\tPassword is too short!\n\n"
fi
done
@@ -219,23 +219,25 @@ if [[ "${1}" == '--key' ]]; then
cp \
/etc/zfs/keys/${hostname,,}.key \
/mnt/etc/zfs/keys/
elif [[ "${1}" == '--unmount' ]]; then
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -I {} umount -Rlf {}
fi
if [[ "${ID}" == 'fedora' ]]; then
umount \
-nR \
/mnt
fi
if [[ "${1}" == '--unmount' ]]; then
umount \
-nR \
/mnt
zpool \
export \
-a
elif [[ "${1}" == '--host-id' ]]; then
${hostname,,}
fi
if [[ "${1}" == '--host-id' ]]; then
zgenhostid \
-f \
0x00bab10c
elif [[ "${1}" == '--home' ]]; then
fi
if [[ "${1}" == '--home' ]]; then
zfs create\
${hostname,,}/home/${username}
@@ -259,12 +261,16 @@ elif [[ "${1}" == '--home' ]]; then
zfs create\
${hostname,,}/home/${username}/.local/share/flatpak
elif [[ "${1}" == '--keystore' ]]; then
fi
if [[ "${1}" == '--keystore' ]]; then
zfs \
set \
org.zfsbootmenu:keysource=${hostname,,}/keystore \
${hostname,,}
elif [[ "${1}" == '--splash' ]]; then
fi
if [[ "${1}" == '--splash' ]]; then
zfs \
set \
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \