73 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
a6abd9e365 Removed unneeded bits that served no function 2025-12-31 23:41:09 -05:00
a09f66e4a7 Moved more ZFS things into 'zfs.sh' 2025-12-31 23:40:06 -05:00
f41eb46966 Moved dracut stuff into 'fedora.sh' 2025-12-31 23:39:14 -05:00
df9a67caea Broke swap related stuff into seperate script 2025-12-31 23:36:02 -05:00
2b1a2f29ee Moved automatic ZFS snapshot triggered by apt into seperate script. Moved 'logrotate' and 'initramfs' functions into 'debian.sh' 2025-12-31 23:32:29 -05:00
3e7a7a5788 Moved installing 'wingpanel-indicator-namarupa' into 'elementary.sh' 2025-12-31 23:25:45 -05:00
9a32510698 Split off new user creation into seperate script 2025-12-31 23:23:34 -05:00
d186c475b0 Added boilerplate script to aide in creation of new scripts 2025-12-31 22:51:16 -05:00
90fefb094e Have apt update repositories before upgrading packages 2025-12-31 22:50:35 -05:00
dff8209e31 Added instalation of app indicator dropdown for Wing Panel 2025-12-31 22:49:59 -05:00
a4f6ea6f9c Specified exactly which version of Flatpaks were being installed to better automate their installation 2025-12-31 18:32:10 -05:00
86e9244590 Fixed '10-globally-managed-devices.conf' not being created under '/mnt' 2025-12-31 18:31:33 -05:00
e1b75419c9 Revert commit fd1a033 2025-12-31 16:43:20 -05:00
8347198afe Fixed bad mount command 2025-12-31 16:24:17 -05:00
5c3cd838a9 Changed how 'elementary-desktop' is installed due to not being to via mmdebstrap 2025-12-31 16:11:43 -05:00
9b90ca2273 Missing apps installed and 'gnome-software' and 'snapd' removed to bring custom installation in line with default 2025-12-31 16:00:46 -05:00
e952c663ad Installation of 'elementary-desktop' now handled by mmdebstrap 2025-12-31 15:59:33 -05:00
0b562b0ccf Made groups to add user to when not Fedora into a variable with an if statement to add 'netdev' to that list if the OS is Debian, due to elementaryOS not having the 'netdev' group 2025-12-31 15:25:03 -05:00
99f90d47c8 Added elementaryOS to have 'home-fix.sh' run on first boot like Debian 2025-12-31 15:23:43 -05:00
74f884f7a0 Added bits that should fix networking both in chroot and after install 2025-12-31 15:23:02 -05:00
fd1a033bd9 Changed cpoy operation to use rsync 2025-12-31 15:22:05 -05:00
44c7813b22 Added 'rsync' to packages to install via 'mmdebstrap' 2025-12-31 15:21:27 -05:00
13f87e00dd Updated variable names and casing 2025-12-24 18:55:43 -05:00
07caef3f2c Added needed bits to set 'baseDir' and source variables from 'system.conf' 2025-12-24 18:54:52 -05:00
7ea1035154 Updated commands used to set 'baseDir' variable 2025-12-24 18:54:12 -05:00
781a2a9143 Corrected commands to set 'baseDir' variable 2025-12-24 18:52:39 -05:00
79d53e948b Added 'rsync' to list of packages for 'mmdebstrap' to install 2025-12-24 18:52:10 -05:00
0609f35f91 Explicitly install 'linux-headers-generic' (bug 1091428) 2025-12-24 17:52:32 -05:00
db6c05fbe3 Properly configured 'zfs.sh' and 'partition.sh' to recognize flags for running different parts of the script 2025-12-24 17:31:17 -05:00
b6c2455aaa Updated variable names and casing 2025-12-24 17:26:01 -05:00
feb638b9f1 Added check to see if 'ID' = 'debian' before creating 'contrib.sources' due to elementaryOS sharing this porting of 'debian.sh' with Debian 2025-12-24 17:12:10 -05:00
4d223b8815 Added check to see if 'ID' = 'debian' before creating 'contrib.sources' due to elementaryOS sharing this porting of 'debian.sh' with Debian 2025-12-24 17:05:59 -05:00
a918ccf2e7 Make new shell scripts executable 2025-12-24 16:48:05 -05:00
568c80a05e Commented out (should be) depricated part of setup process 2025-12-24 16:38:08 -05:00
00fe875b44 Removed unneeded double check if 'ID' = 'fedora' 2025-12-24 16:37:13 -05:00
8414563171 Split off ZFS-relatesd tasks into 'zfs.sh' 2025-12-24 16:36:33 -05:00
30b3b58336 Split off creating/formatting EFI partition into 'partition.sh' 2025-12-24 16:35:53 -05:00
3e4eeb7d37 Split off more Fedora-related tasks into 'fedora.sh' 2025-12-24 16:34:29 -05:00
8305fa16cd Split off more Debian-related tasks into 'debian.sh' 2025-12-24 16:32:44 -05:00
16018759fb Split off rsyncing folder of scripts to seperate script 2025-12-24 16:29:35 -05:00
2028fa4396 Split off rbinding operations 2025-12-24 16:28:55 -05:00
637f5b69db Split off mtab related activities 2025-12-24 16:28:18 -05:00
3902f873e9 Split off creating tmpfs directories 2025-12-24 16:27:28 -05:00
8bca55e467 Split off setting hostname 2025-12-24 16:26:47 -05:00
377d56b1cd Split off copying of hostid file 2025-12-24 16:25:49 -05:00
9c8add89e5 Updated variable names and casing 2025-12-24 16:22:32 -05:00
648d07f355 Split off creating and setting up 'home-fix.sh' 2025-12-24 16:14:33 -05:00
f44f7464b9 Split chroot operation into seperate script 2025-12-24 16:12:47 -05:00
ec2d8148e0 Split chroot operation into seperate script 2025-12-24 16:11:14 -05:00
27 changed files with 952 additions and 719 deletions

View File

@@ -6,13 +6,13 @@ The purpose of this branch is to modularize as many functions of the scripts as
## Checklist ## Checklist
[X] Rename all `base-` scripts to remove `base-` [X] Rename all `base-` scripts to remove `base-`
[ ] Move (at least almost) all Debian related commands and tasks to `debian.sh` [X] 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` [X] 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` [X] 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] 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] Move all EFI related commands and tasks to a new `efi.sh` script
[X] Rename `mkfs.zfs.sh` to `zfs.sh` [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` [ ] Rewrite `README.md`
[ ] Rename all script-specific variables to lowercase with singular capital letters to seperate words in variable name [X] 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] Update how `baseDir` is set using `realpath $(dirname "${0}")`

52
adduser.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
/etc/os-release
source \
"${baseDir}/system.conf"
printf \
'Adding user account...\n'
adduser ${username}
if [[ "${ID}" == 'fedora' ]]; then
printf \
'\033[?47h\033[2J\033[H'
cat << EOF
Enter a password for the new user account:
EOF
passwd \
${username}
printf \
'\033[?47l'
usermod \
-a \
-G \
audio,cdrom,dip,floppy,wheel,video,dialout \
${username}
else
if [[ -z "$(cat /etc/group | grep 'lpadmin')" ]]; then
groupadd --gid 108 lpadmin
fi
groups='audio,cdrom,dip,floppy,plugdev,sudo,video,dialout,lpadmin'
if [[ "${ID}" == 'debian' ]]; then
groups+=',netdev'
fi
usermod \
-a \
-G \
${groups} \
${username}
fi

28
apt-snapshot.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -euo pipefail
cat << EOF | tee /usr/bin/zfs-system-snapshot-apt &> /dev/null
#!/bin/bash
set -euo pipefail
TIMESTAMP="\$(date +%Y_%m_%d-%H_%M_%S)"
if [[ -z "\$(zfs list -t snapshot | grep 'apt-\${TIMESTAMP}')" ]]; then
zfs snapshot \$(zfs mount | grep 'ROOT' | sed 's| .*||')@apt-\${TIMESTAMP} && printf "\n- Snapshot taken\n\n"
fi
EOF
chmod \
+x \
/usr/bin/zfs-system-snapshot-apt
printf \
'DPkg::Pre-Install-Pkgs {"/usr/bin/zfs-system-snapshot-apt";};\n' | \
tee /etc/apt/apt.conf.d/90-zfs_system-snapshot &> /dev/null
printf \
'DPkg::Post-Invoke {"apt moo";};\n' | \
tee /etc/apt/apt.conf.d/99-apt_moo &> /dev/null

22
boilerplate.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
printf "Enter name of new script (without file extension):\n${baseDir}/"
read -r newScript
cat << EOF | tee "${baseDir}/${newScript}.sh" &> /dev/null
#!/bin/bash
set -euo pipefail
baseDir="\$(realpath "\$(dirname "\${0}")")"
source \\
/etc/os-release
source \\
"\${baseDir}/system.conf"
EOF
chmod +x "${baseDir}/${newScript}.sh"

17
chroot.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
printf \
"\nNow chrooting into /mnt...\n\n"
if [[ "${*}" == *--continue* ]]; then
chroot \
/mnt \
"$(printf "${baseDir}\n" | sed 's|.*\/|\/|')/install.sh"
else
chroot \
/mnt
fi

147
debian.sh
View File

@@ -9,8 +9,33 @@ source \
"${baseDir}/system.conf" "${baseDir}/system.conf"
if [[ "${1}" == '--live' ]]; then
if [[ "${ID}" == 'debian' ]] && [[ ! "$(hostname)" == "debian-live" ]]; then
cat << EOF | tee /etc/apt/sources.list.d/contrib.sources 1> /dev/null
Enabled: yes
Types: deb
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}
Components: contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
fi
apt \
--update \
install \
--yes \
mmdebstrap \
gdisk \
linux-headers-generic \
systemd-timesyncd \
whois \
zfsutils-linux
fi
if [[ "${1}" == '--mmdebstrap' ]]; then if [[ "${1}" == '--mmdebstrap' ]]; then
packages=(\ packages=(\
ca-certificates \
console-setup \ console-setup \
cryptsetup \ cryptsetup \
curl \ curl \
@@ -28,6 +53,8 @@ network-manager \
openssh-{client,server} \ openssh-{client,server} \
popularity-contest \ popularity-contest \
printer-driver-all \ printer-driver-all \
rsync \
sudo \
systemd-timesyncd \ systemd-timesyncd \
tasksel \ tasksel \
zfs-initramfs \ zfs-initramfs \
@@ -48,7 +75,9 @@ zstd\
${include} \ ${include} \
"${VERSION_CODENAME}" \ "${VERSION_CODENAME}" \
/mnt /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')) networkInterface=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
shopt -s extglob shopt -s extglob
@@ -58,7 +87,9 @@ allow-hotplug ${networkInterface[$i]}
iface ${networkInterface[$i]} inet dhcp iface ${networkInterface[$i]} inet dhcp
EOF EOF
done done
elif [[ "${1}" == '--sources' ]]; then fi
if [[ "${1}" == '--sources' ]]; then
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
# ${VERSION_CODENAME^} # ${VERSION_CODENAME^}
Enabled: yes Enabled: yes
@@ -87,3 +118,115 @@ EOF
rm /mnt/etc/apt/sources.list rm /mnt/etc/apt/sources.list
fi fi
if [[ "${1}" == '--dpkg-reconfigure' ]]; then
cat << EOF
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
Press any key to continue...
EOF
read -srn 1
dpkg-reconfigure \
locales \
tzdata \
keyboard-configuration \
console-setup
fi
if [[ "${1}" == '--purge-os-prober' ]]; then
apt \
purge \
--yes \
os-prober
fi
if [[ "${1}" == '--network-manager' ]]; then
cp \
/etc/NetworkManager/NetworkManager.conf \
/etc/NetworkManager/NetworkManager.conf.orig
cat \
/etc/NetworkManager/NetworkManager.conf.orig | \
sed 's|managed=false|managed=true|' | \
tee /etc/NetworkManager/NetworkManager.conf &> /dev/null
fi
if [[ "${1}" == '--contrib' ]]; then
cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
# ${VERSION_CODENAME^} Backports
Enabled: yes
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}-backports
Components: main non-free-firmware contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
cat << EOF | tee /etc/apt/preferences.d/backports.pref &> /dev/null
Package: *
Pin: release n=${VERSION_CODENAME}*
Pin-Priority: 990
Package: linux-*
Pin: release n=${VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
if [[ "${VERSION_CODENAME}" == 'bookworm' ]]; then
cat << EOF | tee --append /etc/apt/preferences.d/backports.pref &> /dev/null
Package: /wayland/
Pin: release n=${VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
fi
fi
if [[ "${1}" == '--tasksel' ]]; then
if [[ ! -f /usr/bin/tasksel ]]; then
apt \
--update \
install \
--yes \
tasksel
fi
tasksel \
--new-install
fi
if [[ "${1}" == '--initramfs' ]]; then
printf \
"UMASK=0077\n" | \
tee /etc/initramfs-tools/conf.d/umask.conf &> /dev/null
update-initramfs \
-c \
-k all
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
fi
if [[ "${1}" == '--systemctl-enable' ]]; then
systemctl \
enable \
zfs.target
systemctl \
enable \
zfs-import-cache
systemctl \
enable \
zfs-mount
systemctl \
enable \
zfs-import.target
fi

2
efi.sh Normal file → Executable file
View File

@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
baseDir="$(realpath "$(basename "${0}")")" baseDir="$(realpath "$(dirname "${0}")")"
source \ source \

View File

@@ -26,6 +26,7 @@ nano \
network-manager \ network-manager \
openssh-{client,server} \ openssh-{client,server} \
popularity-contest \ popularity-contest \
rsync \
zfs-initramfs \ zfs-initramfs \
zstd\ zstd\
) )
@@ -44,7 +45,9 @@ zstd\
${include} \ ${include} \
"${UBUNTU_VERSION_CODENAME}" \ "${UBUNTU_VERSION_CODENAME}" \
/mnt /mnt
elif [[ "${1}" == '--sources' ]]; then fi
if [[ "${1}" == '--sources' ]]; then
cat <<EOF >/mnt/etc/apt/sources.list.d/${UBUNTU_VERSION_CODENAME}.sources cat <<EOF >/mnt/etc/apt/sources.list.d/${UBUNTU_VERSION_CODENAME}.sources
# ${UBUNTU_VERSION_CODENAME^} # ${UBUNTU_VERSION_CODENAME^}
Enabled: yes Enabled: yes
@@ -90,11 +93,15 @@ Signed-By: /etc/apt/trusted.gpg.d/patches.key.asc
EOF EOF
rm /mnt/etc/apt/sources.list rm /mnt/etc/apt/sources.list
elif [[ "${1}" == '--skel' ]]; then fi
if [[ "${1}" == '--skel' ]]; then
rsync -pogAXtlHrDx \ rsync -pogAXtlHrDx \
/etc/skel \ /etc/skel \
/mnt/etc /mnt/etc
elif [[ "${1}" == '--elementary' ]]; then fi
if [[ "${1}" == '--elementary' ]]; then
cp \ cp \
/etc/os-release \ /etc/os-release \
/mnt/etc /mnt/etc
@@ -103,3 +110,90 @@ elif [[ "${1}" == '--elementary' ]]; then
/etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \ /etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \
/mnt/etc/apt/trusted.gpg.d/ /mnt/etc/apt/trusted.gpg.d/
fi fi
if [[ "${1}" == '--network' ]]; then
mkdir \
-p \
/mnt/run/systemd/resolve/
mount \
--bind \
/run/systemd/resolve/ \
/mnt/run/systemd/resolve/
touch \
/mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
fi
if [[ "${1}" == '--apps' ]]; then
app=(\
io.elementary.calculator \
io.elementary.camera \
io.elementary.capnet-assist \
io.elementary.maps \
io.elementary.music \
io.elementary.screenshot \
io.elementary.videos \
org.gnome.Epiphany \
org.gnome.Evince \
org.gnome.FileRoller \
org.gnome.font-viewer\
)
apps="app/${app[0]}/x86_64/stable"
for ((i=1;i<${#app[@]};i++)); do
apps+=" app/${app[${i}]}/x86_64/stable"
done
flatpak \
install \
appcenter \
-y \
${apps}
fi
if [[ "${1}" == '--purge' ]]; then
apt \
purge \
--yes \
--autoremove \
gnome-software \
snapd
fi
if [[ "${1}" == '--desktop' ]]; then
apt \
install \
--yes \
elementary-desktop
fi
if [[ "${1}" == '--namarupa' ]]; then
curl \
--progress \
--location \
--remote-name \
--continue-at - \
--output-dir '/tmp' \
'https://github.com/lenemter/wingpanel-indicator-namarupa/raw/main/com.github.lenemter.wingpanel-indicator-namarupa.deb'
apt \
--update \
install \
--yes \
'/tmp/com.github.lenemter.wingpanel-indicator-namarupa.deb'
mkdir \
-p \
/home/${username}/.config/autostart
cp \
/etc/xdg/autostart/indicator-application.desktop \
/home/${username}/.config/autostart/
sed \
-i \
's/^OnlyShowIn.*/OnlyShowIn=Unity;GNOME;Pantheon;/' \
/home/${username}/.config/autostart/indicator-application.desktop
fi

View File

@@ -9,6 +9,34 @@ source \
"${baseDir}/system.conf" "${baseDir}/system.conf"
if [[ "${1}" == '--live' ]]; then
if [[ "${VERSION_ID}" -lt '41' ]]; then
dnf config-manager \
--disable \
updates
else
dnf config-manager \
setopt \
updates.enabled=0
fi
dnf install \
-y \
https://zfsonlinux.org/fedora/zfs-release-${zolFedoraVer}$(rpm --eval "%{dist}").noarch.rpm
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 install \
-y \
zfs \
gdisk
modprobe \
zfs
fi
if [[ "${1}" == '--rsync' ]]; then if [[ "${1}" == '--rsync' ]]; then
mkdir -p /run/install mkdir -p /run/install
@@ -24,13 +52,77 @@ if [[ "${1}" == '--rsync' ]]; then
--exclude=/etc/machine-id \ --exclude=/etc/machine-id \
--info=progress2 \ --info=progress2 \
/run/install/ /mnt /run/install/ /mnt
elif [[ "${1}" == '--resolv-conf' ]]; then fi
if [[ "${1}" == '--resolv-conf' ]]; then
mv /mnt/etc/resolv.conf \ mv /mnt/etc/resolv.conf \
/mnt/etc/resolv.conf.orig /mnt/etc/resolv.conf.orig
cp -L \ cp -L \
/etc/resolv.conf \ /etc/resolv.conf \
/mnt/etc /mnt/etc
elif [[ "${1}" == '-3' ]]; 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 fi

View File

@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
printf '\033[?47l\012' printf '\033[?47l\012'

59
home-fix-setup.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
/etc/os-release
source \
"${baseDir}/system.conf"
cat << EOF | tee /usr/bin/home-fix.sh &> /dev/null
#!/bin/bash
set -euo pipefail
chown -R ${username}:${username} /home/${username}
sudo -u ${username} cp -a /etc/skel/. /home/${username}
if [[ ! -z "\$(find -P /home/${username}/ | grep '\.face')" ]]; then
find -P /home/${username}/ | grep '\.face' | xargs -d '\n' -I {} rm {}
fi
if [[ ! -z "\$(find -P /var/spool/cron | grep 'root')" ]]; then
rm \$(find -P /var/spool/cron | grep 'root')
fi
printf "\$(date +%Y-%m-%d\ %H:%M:%S) I did the thing\n" | tee /var/log/home-fix.log &> /dev/null
if [[ -f '/usr/bin/home-fix.sh' ]]; then
rm /usr/bin/home-fix.sh
fi
zfs snapshot ${hostname,,}/ROOT/${ID}@home-fix
zfs snapshot -r ${hostname,,}/home/${username}@home-fix
EOF
chmod \
+x \
/usr/bin/home-fix.sh
if [[ "${ID}" == 'fedora' ]]; then
printf \
"@reboot\tsudo -u ${username} '${baseDir}/finalize.sh'\n@reboot\t/usr/bin/home-fix.sh\n" | \
tee /var/spool/cron/root &> /dev/null
elif [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
printf \
"@reboot\tsudo -u ${username} '${baseDir}/finalize.sh'\n@reboot\t/usr/bin/home-fix.sh\n" | \
tee /var/spool/cron/crontabs/root &> /dev/null
chown \
:crontab \
/var/spool/cron/crontabs/root
chmod \
0600 \
/var/spool/cron/crontabs/root
fi

7
host-id.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
cp \
/etc/hostid \
/mnt/etc/

15
hostname.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
"${baseDir}/system.conf"
printf \
"${hostname}\n" | tee /mnt/etc/hostname &> /dev/null
printf \
"127.0.1.1\t${hostname}\n" | tee --append /mnt/etc/hosts &> /dev/null

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
baseDir="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
printf \ printf \
'\033[?47l\012' '\033[?47l\012'
@@ -29,139 +29,33 @@ source \
source \ source \
"${baseDir}/system.conf" "${baseDir}/system.conf"
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then
if [[ "${DISK}" == **/dev/nvme** ]]; then
PART1='p1'
PART2='p2'
else
PART1='1'
PART2='2'
fi
else
PART1='-part1'
PART2='-part2'
fi
if [[ ! -f "/etc/mtab" ]]; then if [[ ! -f "/etc/mtab" ]]; then
ln \ "${baseDir}/mtab.sh"
-s \
/proc/self/mounts \
/etc/mtab
fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
apt \
update
fi fi
if [[ "${ID}" == 'fedora' ]]; then if [[ "${ID}" == 'fedora' ]]; then
if [[ "${ENCRYPTION}" == 'yes' ]]; then "${baseDir}/fedora.sh" --zfs-install
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
fi
if [[ "${ID}" == 'fedora' ]]; then
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 fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
cat << EOF "${baseDir}/debian.sh" --dpkg-reconfigure
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
Press any key to continue...
EOF
read -srn 1
dpkg-reconfigure \
locales \
tzdata \
keyboard-configuration \
console-setup
fi fi
if [[ "${ID}" == 'debian' ]]; then "${baseDir}/partition.sh" --efi
printf \
'REMAKE_INITRD=yes\n' | \
tee /etc/dkms/zfs.conf &> /dev/null
fi
if [[ ! "${*}" = *--no-part* ]]; then
mkdosfs \
-F 32 \
-s 1 \
-n EFI \
${DISK}${PART1}
fi
mkdir \
-p \
/boot/efi
printf \
"/dev/disk/by-uuid/$(blkid -s UUID -o value ${DISK}${PART1}) /boot/efi vfat defaults 0 0\n" | \
tee --append /etc/fstab &> /dev/null
sleep 5
mount \
/boot/efi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
apt \ if [[ -e '/usr/bin/os-prober' ]]; then
purge \ "${baseDir}/debian.sh" --purge-os-prober
--yes \ fi
os-prober fi
if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --desktop
"${baseDir}/elementary.sh" --purge
"${baseDir}/elementary.sh" --apps
fi fi
printf \ printf \
@@ -177,76 +71,32 @@ passwd
printf \ printf \
'\033[?47l' '\033[?47l'
if [[ "${ENABLE_SWAP}" == "yes" ]]; then "${baseDir}/swap.sh"
printf \
"swap\t${DISK}${PART2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
tee /etc/crypttab &> /dev/null
printf \
'dev/mapper/swap\tnone\tswap\tsw\t0\t0\n' | \
tee --append /etc/fstab &> /dev/null
fi
if [[ "${ID}" == 'debian' ]]; then if [[ "${ID}" == 'debian' ]]; then
cp \ "${baseDir}/debian.sh" --network-manager
/etc/NetworkManager/NetworkManager.conf \
/etc/NetworkManager/NetworkManager.conf.orig
cat \
/etc/NetworkManager/NetworkManager.conf.orig | \
sed 's|managed=false|managed=true|' | \
tee /etc/NetworkManager/NetworkManager.conf &> /dev/null
fi fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
printf \ "${baseDir}/debian.sh" --initramfs
"UMASK=0077\n" | \
tee /etc/initramfs-tools/conf.d/umask.conf &> /dev/null
update-initramfs \
-c \
-k all
elif [[ "${ID}" == 'fedora' ]]; then elif [[ "${ID}" == 'fedora' ]]; then
dracut \ "${baseDir}/fedora.sh" --dracut
--force \
--regenerate-all
fi fi
zfs \ "${baseDir}/zfs.sh" --splash
set \
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
${HOSTNAME,,}/ROOT/${ID}
if [[ ! "${*}" = *--no-part* ]]; then if [[ ! -z "$(zfs list | grep 'keystore')" ]]; then
if [[ ! -z "$(zfs list | grep 'keystore')" ]]; then "${baseDir}/zfs.sh" --keystore
zfs \
set \
org.zfsbootmenu:keysource=${HOSTNAME,,}/keystore \
${HOSTNAME,,}
fi
fi fi
if [[ ! "${*}" = *--no-part* ]]; then "${baseDir}/efi.sh"
"${baseDir}/efi.sh"
fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
systemctl \ "${baseDir}/debian.sh" --systemctl-enable
enable \
zfs.target
systemctl \
enable \
zfs-import-cache
systemctl \
enable \
zfs-mount
systemctl \
enable \
zfs-import.target
fi fi
zfs \ zfs \
snapshot \ snapshot \
${HOSTNAME,,}/ROOT/${ID}@install ${hostname,,}/ROOT/${ID}@install
"${baseDir}/post-inst.sh" "${baseDir}/post-inst.sh"

16
list.sh
View File

@@ -2,18 +2,18 @@
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
DISKS_BY_ID="$(ls -Ago /dev/disk/by-id/ | grep -v 'sr' | grep -v 'dm-' | grep -v 'nvme-eui.' | grep -v '\-part' | grep -v 'wwn-' | grep -v '_[1-9] -> ' | grep -v 'total' | sed -e 's|^.*\:[0-5][0-9] ||g')" disksById="$(ls -Ago /dev/disk/by-id/ | grep -v 'sr' | grep -v 'dm-' | grep -v 'nvme-eui.' | grep -v '\-part' | grep -v 'wwn-' | grep -v '_[1-9] -> ' | grep -v 'total' | sed -e 's|^.*\:[0-5][0-9] ||g')"
DISKS="$(lsblk -do name | grep -v 'loop' | grep -v 'sr' | grep -v 'zram' | grep -v 'NAME')" disks="$(lsblk -do name | grep -v 'loop' | grep -v 'sr' | grep -v 'zram' | grep -v 'NAME')"
NETWORK_INTERFACES="$(ip -br addr show | sed -e 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg')" networkInterfaces="$(ip -br addr show | sed -e 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg')"
cat << EOF cat << EOF
####################################### #######################################
## ## ## ##
## $(cat "${BASEDIR}/title") Script ## ## $(cat "${baseDir}/title") Script ##
## ## ## ##
## Jean <jean@easthighnerd.net> ## ## Jean <jean@easthighnerd.net> ##
## ## ## ##
@@ -34,13 +34,13 @@ EOF
cat << EOF cat << EOF
Available disks (/dev/disk/by-id/): Available disks (/dev/disk/by-id/):
${DISKS_BY_ID} ${disksById}
Available disks (/dev/): Available disks (/dev/):
${DISKS} ${disks}
Available network interfaces: Available network interfaces:
${NETWORK_INTERFACES} ${networkInterfaces}
Press any key to return to the main menu Press any key to return to the main menu

38
menu.sh
View File

@@ -2,17 +2,17 @@
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
OPTION='start' option='start'
while [[ ! "${OPTION}" == 'Exit' ]]; do while [[ ! "${option}" == 'Exit' ]]; do
printf '\033[?47h\033[2J\033[H' printf '\033[?47h\033[2J\033[H'
cat << EOF cat << EOF
####################################### #######################################
## ## ## ##
## $(cat "${BASEDIR}/title") Script ## ## $(cat "${baseDir}/title") Script ##
## ## ## ##
## Jean <jean@easthighnerd.net> ## ## Jean <jean@easthighnerd.net> ##
## ## ## ##
@@ -26,10 +26,10 @@ while [[ ! "${OPTION}" == 'Exit' ]]; do
################# #################
EOF 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 do
case "${OPTION}" in case "${option}" in
'List'|'Configure'|'Pre Install'|'Install'|'WiFi Setup'|'Post Install'|'Finalize'|'Exit') 'List'|'Configure'|'Install'|'Finalize'|'WiFi Setup'|'Exit')
break break
;; ;;
*) *)
@@ -40,20 +40,16 @@ EOF
printf '\033[2J\033[H' printf '\033[2J\033[H'
if [[ "${OPTION}" == 'List' ]]; then if [[ "${option}" == 'List' ]]; then
"${BASEDIR}/list.sh" "${baseDir}/list.sh"
elif [[ "${OPTION}" == 'Configure' ]]; then elif [[ "${option}" == 'Configure' ]]; then
"${BASEDIR}/configure.sh" "${baseDir}/configure.sh"
elif [[ "${OPTION}" == 'Pre Install' ]]; then elif [[ "${option}" == 'Install' ]]; then
"${BASEDIR}/pre-inst.sh" "${baseDir}/pre-inst.sh"
elif [[ "${OPTION}" == 'Install' ]]; then elif [[ "${option}" == 'Finalize' ]]; then
"${BASEDIR}/install.sh" "${baseDir}/finalize.sh"
elif [[ "${OPTION}" == 'WiFi Setup' ]]; then elif [[ "${option}" == 'WiFi Setup' ]]; then
"${BASEDIR}/wifi.sh" "${baseDir}/wifi.sh"
elif [[ "${OPTION}" == 'Post Install' ]]; then
"${BASEDIR}/post-inst.sh"
elif [[ "${OPTION}" == 'Finalize' ]]; then
"${BASEDIR}/finalize.sh"
fi fi
printf '\033[?47h\033[2J\033[H' printf '\033[?47h\033[2J\033[H'

17
mkdir-tmpfs.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
mkdir \
-p \
/mnt/run
mount \
-t \
tmpfs \
tmpfs \
/mnt/run
mkdir \
-p \
/mnt/run/lock

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

8
mtab.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
ln \
-s \
/proc/self/mounts \
/etc/mtab

View File

@@ -1,62 +1,96 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
source \ source \
/etc/os-release /etc/os-release
source \ source \
"${BASEDIR}/system.conf" "${baseDir}/system.conf"
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then
if [[ "${DISK}" == **/dev/nvme** ]]; then if [[ "${1}" == '--disk' ]]; then
PART3='p3' if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part3='p3'
else
part3='3'
fi
else else
PART3='3' part3='-part3'
fi fi
else
PART3='-part3'
fi
swapoff \ swapoff \
--all --all
wipefs \ wipefs \
-a \ -a \
${DISK} ${disk}
if [[ ! "${DISK_TYPE}" == 'HDD' ]]; then if [[ ! "${diskType}" == 'HDD' ]]; then
blkdiscard \ blkdiscard \
-f \ -f \
${DISK} ${disk}
fi
sgdisk \
--zap-all \
${DISK}
sgdisk \
-n1:0:+512M \
-t1:EF00 \
-c1:EFI \
${DISK}
if [[ "${ENABLE_SWAP}" == "yes" ]]; then
SWAP_SIZE="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
if [[ "${SWAP_SIZE#}" -gt '32' ]]; then
SWAP_SIZE='32'
fi fi
sgdisk \ sgdisk \
-n2:0:+${SWAP_SIZE}G \ --zap-all \
-t2:BF02 \ ${disk}
-c2:swap \
${DISK} sgdisk \
-n1:0:+512M \
-t1:EF00 \
-c1:EFI \
${disk}
if [[ "${enableSwap}" == "yes" ]]; then
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
if [[ "${swapSize#}" -gt '16' ]]; then
swapSize='16'
fi
sgdisk \
-n2:0:+${swapSize}G \
-t2:BF02 \
-c2:swap \
${disk}
fi
sgdisk \
-n3:0:0 \
-t3:BF00 \
-c3:${ID} \
${disk}
fi fi
sgdisk \ if [[ "${1}" == '--efi' ]]; then
-n3:0:0 \ if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
-t3:BF00 \ if [[ "${disk}" == **/dev/nvme** ]]; then
-c3:${ID} \ part1='p1'
${DISK} else
part1='1'
fi
else
part1='-part1'
fi
mkdosfs \
-F 32 \
-s 1 \
-n EFI \
${disk}${part1}
mkdir \
-p \
/boot/efi
printf \
"/dev/disk/by-uuid/$(blkid -s UUID -o value ${disk}${part1}) /boot/efi vfat defaults 0 0\n" | \
tee --append /etc/fstab &> /dev/null
sleep 5
mount \
/boot/efi
fi

View File

@@ -2,7 +2,12 @@
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
source \
/etc/os-release
source \
"${baseDir}/system.conf"
printf \ printf \
@@ -11,7 +16,7 @@ printf \
cat << EOF cat << EOF
####################################### #######################################
## ## ## ##
## $(cat "${BASEDIR}/title") Script ## ## $(cat "${baseDir}/title") Script ##
## ## ## ##
## Jean <jean@easthighnerd.net> ## ## Jean <jean@easthighnerd.net> ##
## ## ## ##
@@ -28,231 +33,34 @@ cat << EOF
EOF EOF
source \ "${baseDir}/zfs.sh" --home
/etc/os-release
source \ "${baseDir}/adduser.sh"
"${BASEDIR}/system.conf"
if [[ ! "${*}" = *--no-part* ]]; then
zfs create\
${HOSTNAME,,}/home/${USERNAME}
zfs create\
${HOSTNAME,,}/home/${USERNAME}/.config
zfs create\
-o canmount=off\
${HOSTNAME,,}/home/${USERNAME}/.var
zfs create\
${HOSTNAME,,}/home/${USERNAME}/.var/app
zfs create\
-o canmount=off\
${HOSTNAME,,}/home/${USERNAME}/.local
zfs create\
-o canmount=off\
${HOSTNAME,,}/home/${USERNAME}/.local/share
zfs create\
${HOSTNAME,,}/home/${USERNAME}/.local/share/flatpak
printf \
'Adding user account...\n'
adduser ${USERNAME}
else
adduser --no-create-home ${USERNAME}
fi
if [[ "${ID}" == 'fedora' ]]; then
printf \
'\033[?47h\033[2J\033[H'
cat << EOF
Enter a password for the new user account:
EOF
passwd \
${USERNAME}
printf \
'\033[?47l'
usermod \
-a \
-G \
audio,cdrom,dip,floppy,wheel,video,dialout \
${USERNAME}
else
if [[ -z "$(cat /etc/group | grep 'lpadmin')" ]]; then
groupadd --gid 108 lpadmin
fi
usermod \
-a \
-G \
audio,cdrom,dip,floppy,netdev,plugdev,sudo,video,dialout,lpadmin \
${USERNAME}
fi
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'elementary' ]]; then
cat << EOF > /etc/apt/sources.list.d/backports.list "${baseDir}/elementary.sh" --namarupa
deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-backports main restricted universe multiverse
EOF
cat << EOF > /etc/apt/preferences.d/backports.pref
Package: *
Pin: release n=${UBUNTU_VERSION_CODENAME}*
Pin-Priority: 990
Package: linux* /wayland/
Pin: release n=${UBUNTU_VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
elif [[ "${ID}" == 'debian' ]]; then elif [[ "${ID}" == 'debian' ]]; then
cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null "${baseDir}/debian.sh" --contrib
# ${VERSION_CODENAME^} Backports
Enabled: yes
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}-backports
Components: main non-free-firmware contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
cat << EOF | tee /etc/apt/preferences.d/backports.pref &> /dev/null
Package: *
Pin: release n=${VERSION_CODENAME}*
Pin-Priority: 990
Package: linux-*
Pin: release n=${VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
if [[ "${VERSION_CODENAME}" == 'bookworm' ]]; then
cat << EOF | tee --append /etc/apt/preferences.d/backports.pref &> /dev/null
Package: /wayland/
Pin: release n=${VERSION_CODENAME}-backports
Pin-Priority: -1
EOF
fi
fi fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
apt \ apt \
--update \
dist-upgrade \ dist-upgrade \
--yes --yes
fi fi
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" = 'debian' ]]; then
apt \ "${baseDir}/debian.sh" --tasksel
install \
--yes \
--autoremove \
elementary-desktop
elif [[ "${ID}" = 'debian' ]]; then
if [[ ! -f /usr/bin/tasksel ]]; then
apt \
install \
--yes \
tasksel
fi
tasksel \
--new-install
fi fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
for file in /etc/logrotate.d/* ; do "${baseDir}/debian.sh" --logrotate
if grep -Eq "(^|[^#y])compress" "$file" ; then
sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
fi
done
cat << EOF | tee /usr/bin/zfs-system-snapshot-apt &> /dev/null "${baseDir}/apt-snapshot.sh"
#!/bin/bash
set -euo pipefail
TIMESTAMP="\$(date +%Y_%m_%d-%H_%M_%S)"
if [[ -z "\$(zfs list -t snapshot | grep 'apt-\${TIMESTAMP}')" ]]; then
zfs snapshot \$(zfs mount | grep 'ROOT' | sed 's| .*||')@apt-\${TIMESTAMP} && printf "\n- Snapshot taken\n\n"
fi
EOF
chmod \
+x \
/usr/bin/zfs-system-snapshot-apt
printf \
'DPkg::Pre-Install-Pkgs {"/usr/bin/zfs-system-snapshot-apt";};\n' | \
tee /etc/apt/apt.conf.d/90-zfs_system-snapshot &> /dev/null
printf \
'DPkg::Post-Invoke {"apt moo";};\n' | \
tee /etc/apt/apt.conf.d/99-apt_moo &> /dev/null
fi fi
if [[ ! "${*}" = *--no-part* ]]; then "${baseDir}/home-fix-setup.sh"
cat << EOF | tee /usr/bin/home-fix.sh &> /dev/null
#!/bin/bash
set -euo pipefail
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
sudo -u ${USERNAME} cp -a /etc/skel/. /home/${USERNAME}
if [[ ! -z "\$(find -P /home/${USERNAME}/ | grep '\.face')" ]]; then
find -P /home/${USERNAME}/ | grep '\.face' | xargs -d '\n' -I {} rm {}
fi
if [[ ! -z "\$(find -P /var/spool/cron | grep 'root')" ]]; then
rm \$(find -P /var/spool/cron | grep 'root')
fi
printf "\$(date +%Y-%m-%d\ %H:%M:%S) I did the thing\n" | tee /var/log/home-fix.log &> /dev/null
if [[ -f '/usr/bin/home-fix.sh' ]]; then
rm /usr/bin/home-fix.sh
fi
zfs snapshot ${HOSTNAME,,}/ROOT/${ID}@home-fix
zfs snapshot -r ${HOSTNAME,,}/home/${USERNAME}@home-fix
EOF
chmod \
+x \
/usr/bin/home-fix.sh
if [[ "${ID}" == 'fedora' ]]; then
printf \
"@reboot\tsudo -u ${USERNAME} '${BASEDIR}/finalize.sh'\n@reboot\t/usr/bin/home-fix.sh\n" | \
tee /var/spool/cron/root &> /dev/null
elif [[ "${ID}" == 'debian' ]]; then
printf \
"@reboot\tsudo -u ${USERNAME} '${BASEDIR}/finalize.sh'\n@reboot\t/usr/bin/home-fix.sh\n" | \
tee /var/spool/cron/crontabs/root &> /dev/null
chown \
:crontab \
/var/spool/cron/crontabs/root
chmod \
0600 \
/var/spool/cron/crontabs/root
fi
fi
if [[ ! -f '/usr/bin/shutdown' ]]; then if [[ ! -f '/usr/bin/shutdown' ]]; then
ln -s /sbin/shutdown /usr/bin/shutdown ln -s /sbin/shutdown /usr/bin/shutdown
@@ -264,7 +72,7 @@ fi
zfs \ zfs \
snapshot \ snapshot \
${HOSTNAME,,}/ROOT/${ID}@post-install ${hostname,,}/ROOT/${ID}@post-install
printf \ printf \
'\033[?47h\033[2J\033[H' '\033[?47h\033[2J\033[H'

View File

@@ -31,20 +31,6 @@ source \
"${baseDir}/system.conf" "${baseDir}/system.conf"
if [[ "${ID}" == 'debian' ]]; then
if [[ ! "$(hostname)" == "debian-live" ]]; then
cat << EOF | tee /etc/apt/sources.list.d/contrib.sources 1> /dev/null
Enabled: yes
Types: deb
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}
Components: contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
fi
fi
if [[ -f '/usr/bin/gsettings' ]]; then if [[ -f '/usr/bin/gsettings' ]]; then
gsettings \ gsettings \
set \ set \
@@ -54,72 +40,27 @@ if [[ -f '/usr/bin/gsettings' ]]; then
fi fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
apt \ "${baseDir}/debian.sh" --live
update && \
apt \
install \
--yes \
mmdebstrap \
gdisk \
systemd-timesyncd \
whois \
zfsutils-linux
elif [[ "${ID}" == 'fedora' ]]; then elif [[ "${ID}" == 'fedora' ]]; then
if [[ "${VERSION_ID}" -lt '41' ]]; then "${baseDir}/fedora.sh" --live
dnf config-manager \
--disable \
updates
else
dnf config-manager \
setopt \
updates.enabled=0
fi
dnf install \
-y \
https://zfsonlinux.org/fedora/zfs-release-${zolFedoraVer}$(rpm --eval "%{dist}").noarch.rpm
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 install \
-y \
zfs \
gdisk
modprobe \
zfs
fi fi
timedatectl timedatectl
if [[ ! "$(hostname)" == "debian-live" ]]; then if [[ ! "$(hostname)" == "debian-live" ]]; then
zgenhostid \ "${baseDir}/zfs.sh" --host-id
-f \
0x00bab10c
fi fi
"${baseDir}/partition.sh" "${baseDir}/partition.sh" --disk
sleep 5 sleep 5
"${baseDir}/zfs.sh" "${baseDir}/zfs.sh" --format
mkdir \ "${baseDir}/zfs.sh" --create
-p \
/mnt/run
mount \ "${baseDir}/mkdir-tmpfs.sh"
-t \
tmpfs \
tmpfs \
/mnt/run
mkdir \
-p \
/mnt/run/lock
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --mmdebstrap "${baseDir}/elementary.sh" --mmdebstrap
@@ -129,14 +70,12 @@ elif [[ "${ID}" == 'fedora' ]]; then
"${baseDir}/fedora.sh" --rsync "${baseDir}/fedora.sh" --rsync
fi fi
printf \ "${baseDir}/hostname.sh"
"${hostname}\n" | tee /mnt/etc/hostname &> /dev/null
printf \
"127.0.1.1\t${hostname}\n" | tee --append /mnt/etc/hosts &> /dev/null
if [[ "${ID}" == 'debian' ]]; then if [[ "${ID}" == 'debian' ]]; then
"${baseDir}/debian.sh" --network-interfaces "${baseDir}/debian.sh" --network-interfaces
elif [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --network
fi fi
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'elementary' ]]; then
@@ -145,67 +84,31 @@ elif [[ "${ID}" == 'debian' ]]; then
"${baseDir}/debian.sh" --sources "${baseDir}/debian.sh" --sources
fi fi
mount \ "${baseDir}/mount.sh"
--rbind \
/dev \
/mnt/dev
mount \ "${baseDir}/host-id.sh"
--rbind \
/proc \
/mnt/proc
mount \
--rbind \
/sys \
/mnt/sys
cp \
/etc/hostid \
/mnt/etc/
if [[ "${ID}" == 'fedora' ]]; then if [[ "${ID}" == 'fedora' ]]; then
"${baseDir}/fedora.sh" --resolv-conf "${baseDir}/fedora.sh" --resolv-conf
fi fi
rsync -pogAXtlHrDx \ "${baseDir}/rsync.sh"
"${baseDir}" \
/mnt
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --skel "${baseDir}/elementary.sh" --skel
fi fi
# if [[ ! "${*}" = *--no-part* ]]; then if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then
if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then "${baseDir}/zfs.sh" --key
cp \ fi
/etc/zfs/keys/${hostname,,}.key \
/mnt/etc/zfs/keys/
fi
# fi
if [[ "${ID}" == 'elementary' ]]; then if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --elementary "${baseDir}/elementary.sh" --elementary
fi fi
printf \ "${baseDir}/chroot.sh" --continue
"\nNow chrooting into /mnt...\n\n"
chroot \ "${baseDir}/zfs.sh" --unmount
/mnt \
"$(printf "${baseDir}\n" | sed 's|.*\/|\/|')/install.sh"
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -I {} umount -Rlf {}
if [[ "${ID}" == 'fedora' ]]; then
umount \
-nR \
/mnt
fi
zpool \
export \
-a
printf \ printf \
'\033[?47h\033[2J\033[H' '\033[?47h\033[2J\033[H'

18
rbind.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
mount \
--rbind \
/dev \
/mnt/dev
mount \
--rbind \
/proc \
/mnt/proc
mount \
--rbind \
/sys \
/mnt/sys

9
rsync.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
rsync -pogAXtlHrDx \
"${baseDir}" \
/mnt

29
swap.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
"${baseDir}/system.conf"
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part2='p2'
else
part2='2'
fi
else
part2='-part2'
fi
if [[ "${enableSwap}" == "yes" ]]; then
printf \
"swap\t${disk}${part2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
tee /etc/crypttab &> /dev/null
printf \
'dev/mapper/swap\tnone\tswap\tsw\t0\t0\n' | \
tee --append /etc/fstab &> /dev/null
fi

View File

@@ -7,13 +7,13 @@ set -euo pipefail
# resolvectl status | grep 'Link' | sed -e 's|^.*(||g; s|).*||g' | while read -r INTERFACE; do resolvectl dns ${INTERFACE} 9.9.9.9; done && sleep 3 && nmcli device status | grep -v 'DEVICE' | grep -v 'lo' | sed -e 's| .*||g' | while read -r INTERFACE; do nmcli device disconnect ${INTERFACE}; sleep 1; nmcli device connect ${INTERFACE}; done # resolvectl status | grep 'Link' | sed -e 's|^.*(||g; s|).*||g' | while read -r INTERFACE; do resolvectl dns ${INTERFACE} 9.9.9.9; done && sleep 3 && nmcli device status | grep -v 'DEVICE' | grep -v 'lo' | sed -e 's| .*||g' | while read -r INTERFACE; do nmcli device disconnect ${INTERFACE}; sleep 1; nmcli device connect ${INTERFACE}; done
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
cat << EOF cat << EOF
####################################### #######################################
## ## ## ##
## $(cat "${BASEDIR}/title") Script ## ## $(cat "${baseDir}/title") Script ##
## ## ## ##
## Jean <jean@easthighnerd.net> ## ## Jean <jean@easthighnerd.net> ##
## ## ## ##
@@ -35,9 +35,9 @@ nmcli radio wifi on
nmcli device wifi list nmcli device wifi list
printf "Enter the SSID of the WiFi network you wish to connect to:\n" 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 ${WIFI_NAME} nmcli --ask device wifi connect "${wifiName}"
cat << EOF cat << EOF

252
zfs.sh
View File

@@ -1,57 +1,57 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")" baseDir="$(realpath "$(dirname "${0}")")"
source \ source \
/etc/os-release /etc/os-release
source \ source \
"${BASEDIR}/system.conf" "${baseDir}/system.conf"
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${DISK}" == **/dev/nvme** ]]; then if [[ "${disk}" == **/dev/nvme** ]]; then
PART3='p3' part3='p3'
else else
PART3='3' part3='3'
fi fi
else else
PART3='-part3' part3='-part3'
fi fi
# if [[ ! "${*}" = *--no-part* ]]; then if [[ "${1}" == '--format' ]]; then
if [[ "${ENCRYPTION}" == 'yes' ]]; then if [[ "${encryption}" == 'yes' ]]; then
ZPOOL_PASSWORD='A' zpoolPassword='A'
ZPOOL_PASSWORD_VERIFY='B' zpoolPasswordVerify='B'
printf \ printf \
'\033[?47h\033[2J\033[H' '\033[?47h\033[2J\033[H'
while [[ ! "${ZPOOL_PASSWORD}" == "${ZPOOL_PASSWORD_VERIFY}" ]] || [[ -z "${ZPOOL_PASSWORD}" ]] || [[ "${#ZPOOL_PASSWORD}" -lt '8' ]]; do while [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]] || [[ -z "${zpoolPassword}" ]] || [[ "${#zpoolPassword}" -lt '8' ]]; do
printf \ 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 \ read \
-r \ -r \
-s \ -s \
ZPOOL_PASSWORD zpoolPassword
printf \ printf \
"\nVerify the password to encrypt your root pool:\n" "Verify the password to encrypt your root pool:\n"
read \ read \
-r \ -r \
-s \ -s \
ZPOOL_PASSWORD_VERIFY zpoolPasswordVerify
if [[ ! "${ZPOOL_PASSWORD}" == "${ZPOOL_PASSWORD_VERIFY}" ]]; then if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
printf \ printf \
"ERROR:\tPasswords do not match!\n" "ERROR:\tPasswords do not match!\n\n"
elif [[ -z "${ZPOOL_PASSWORD}" ]]; then elif [[ -z "${zpoolPassword}" ]]; then
printf \ printf \
"ERROR:\tPassword is empty!\n" "ERROR:\tPassword is empty!\n\n"
elif [[ "${#ZPOOL_PASSWORD}" -lt '8' ]]; then elif [[ "${#zpoolPassword}" -lt '8' ]]; then
printf \ printf \
"ERROR:\tPassword is too short!\n" "ERROR:\tPassword is too short!\n\n"
fi fi
done done
@@ -63,18 +63,18 @@ fi
/etc/zfs/keys/ /etc/zfs/keys/
printf \ printf \
"${ZPOOL_PASSWORD}\n" | tee /etc/zfs/keys/${HOSTNAME,,}.key &> /dev/null "${zpoolPassword}\n" | tee /etc/zfs/keys/${hostname,,}.key &> /dev/null
chmod \ chmod \
000 \ 000 \
/etc/zfs/keys/${HOSTNAME,,}.key /etc/zfs/keys/${hostname,,}.key
zpool create \ zpool create \
-o ashift=12 \ -o ashift=12 \
-o autotrim=on \ -o autotrim=on \
-o compatibility=openzfs-2.1-linux \ -o compatibility=openzfs-2.1-linux \
-O encryption=on \ -O encryption=on \
-O keylocation=file:///etc/zfs/keys/${HOSTNAME,,}.key \ -O keylocation=file:///etc/zfs/keys/${hostname,,}.key \
-O keyformat=passphrase \ -O keyformat=passphrase \
-O acltype=posixacl \ -O acltype=posixacl \
-O xattr=sa \ -O xattr=sa \
@@ -85,8 +85,8 @@ fi
-O canmount=off \ -O canmount=off \
-O mountpoint=/ \ -O mountpoint=/ \
-R /mnt \ -R /mnt \
${HOSTNAME,,} \ ${hostname,,} \
${DISK}${PART3} ${disk}${part3}
else else
zpool create \ zpool create \
-o ashift=12 \ -o ashift=12 \
@@ -102,42 +102,31 @@ fi
-O canmount=off \ -O canmount=off \
-O mountpoint=/ \ -O mountpoint=/ \
-R /mnt \ -R /mnt \
${HOSTNAME,,} \ ${hostname,,} \
${DISK}${PART3} ${disk}${part3}
fi fi
fi
if [[ "${1}" == '--create' ]]; then
zfs create \ zfs create \
-o canmount=off \ -o canmount=off \
-o mountpoint=none \ -o mountpoint=none \
${HOSTNAME,,}/ROOT ${hostname,,}/ROOT
# else
# zpool import \
# -N \
# -R \
# /mnt \
# ${HOSTNAME,,}
#
# zfs load-key \
# -r \
# -L prompt \
# ${HOSTNAME,,}
# fi
zfs create \
-o canmount=noauto \
-o mountpoint=/ \
${HOSTNAME,,}/ROOT/${ID}
zfs mount \
${HOSTNAME,,}/ROOT/${ID}
# if [[ ! "${*}" = *--no-part* ]]; then
zfs create \ zfs create \
${HOSTNAME,,}/home -o canmount=noauto \
-o mountpoint=/ \
${hostname,,}/ROOT/${ID}
zfs mount \
${hostname,,}/ROOT/${ID}
zfs create \
${hostname,,}/home
zfs create \ zfs create \
-o mountpoint=/root \ -o mountpoint=/root \
${HOSTNAME,,}/home/root ${hostname,,}/home/root
chmod \ chmod \
700 \ 700 \
@@ -146,29 +135,29 @@ zfs mount \
zfs create \ zfs create \
-o canmount=off \ -o canmount=off \
-o mountpoint=/var \ -o mountpoint=/var \
${HOSTNAME,,}/var ${hostname,,}/var
zfs create \ zfs create \
-o canmount=off \ -o canmount=off \
${HOSTNAME,,}/var/lib ${hostname,,}/var/lib
zfs create \ zfs create \
${HOSTNAME,,}/var/log ${hostname,,}/var/log
zfs create \ zfs create \
${HOSTNAME,,}/var/spool ${hostname,,}/var/spool
zfs create \ zfs create \
-o com.sun:auto-snapshot=false \ -o com.sun:auto-snapshot=false \
${HOSTNAME,,}/var/cache ${hostname,,}/var/cache
zfs create \ zfs create \
-o com.sun:auto-snapshot=false \ -o com.sun:auto-snapshot=false \
${HOSTNAME,,}/var/lib/nfs ${hostname,,}/var/lib/nfs
zfs create \ zfs create \
-o com.sun:auto-snapshot=false \ -o com.sun:auto-snapshot=false \
${HOSTNAME,,}/var/tmp ${hostname,,}/var/tmp
chmod \ chmod \
1777 \ 1777 \
@@ -176,99 +165,114 @@ zfs mount \
zfs create \ zfs create \
-o mountpoint=/srv \ -o mountpoint=/srv \
${HOSTNAME,,}/srv ${hostname,,}/srv
zfs create \ zfs create \
-o canmount=off \ -o canmount=off \
-o mountpoint=/usr \ -o mountpoint=/usr \
${HOSTNAME,,}/usr ${hostname,,}/usr
zfs create \ zfs create \
${HOSTNAME,,}/usr/local ${hostname,,}/usr/local
zfs create \ zfs create \
${HOSTNAME,,}/var/games ${hostname,,}/var/games
zfs create \ zfs create \
${HOSTNAME,,}/var/lib/AccountsService ${hostname,,}/var/lib/AccountsService
zfs create \ zfs create \
${HOSTNAME,,}/var/lib/NetworkManager ${hostname,,}/var/lib/NetworkManager
zfs create \ zfs create \
${HOSTNAME,,}/var/www ${hostname,,}/var/www
zfs create \ zfs create \
-o com.sun:auto-snapshot=false \ -o com.sun:auto-snapshot=false \
-o mountpoint=/tmp \ -o mountpoint=/tmp \
${HOSTNAME,,}/tmp ${hostname,,}/tmp
if [[ "${ENCRYPTION}" == 'yes' ]]; then if [[ "${encryption}" == 'yes' ]]; then
zfs create \ zfs create \
-o com.sun:auto-snapshot=false \ -o com.sun:auto-snapshot=false \
-o mountpoint=/etc/zfs/keys \ -o mountpoint=/etc/zfs/keys \
${HOSTNAME,,}/keystore ${hostname,,}/keystore
fi fi
zpool set \ zpool set \
bootfs=${HOSTNAME,,}/ROOT/${ID} \ bootfs=${hostname,,}/ROOT/${ID} \
${HOSTNAME,,} ${hostname,,}
# else
# zfs mount \
# ${HOSTNAME,,}/home
#
# zfs mount \
# ${HOSTNAME,,}/home/root
#
# zfs mount \
# ${HOSTNAME,,}/var/log
#
# zfs mount \
# ${HOSTNAME,,}/var/spool
#
# zfs mount \
# ${HOSTNAME,,}/var/cache
#
# zfs mount \
# ${HOSTNAME,,}/var/lib/nfs
#
# zfs mount \
# ${HOSTNAME,,}/var/tmp
#
# zfs mount \
# ${HOSTNAME,,}/srv
#
# zfs mount \
# ${HOSTNAME,,}/usr/local
#
# zfs mount \
# ${HOSTNAME,,}/var/games
#
# zfs mount \
# ${HOSTNAME,,}/var/lib/AccountsService
#
# zfs mount \
# ${HOSTNAME,,}/var/lib/NetworkManager
#
# zfs mount \
# ${HOSTNAME,,}/var/www
#
# zfs mount \
# ${HOSTNAME,,}/keystore
# fi
if [[ "${ID}" == 'fedora' ]]; then if [[ "${ID}" == 'fedora' ]]; then
"${BASEDIR}/base-fedora.sh" -1 "${baseDir}/fedora.sh" --rsync
fi fi
# if [[ ! "${*}" = *--no-part* ]]; then
zfs create \ zfs create \
${HOSTNAME,,}/var/mail ${hostname,,}/var/mail
chmod \ chmod \
1777 \ 1777 \
/mnt/tmp /mnt/tmp
# else fi
# zfs mount \
# ${HOSTNAME,,}/var/mail if [[ "${1}" == '--key' ]]; then
# fi cp \
/etc/zfs/keys/${hostname,,}.key \
/mnt/etc/zfs/keys/
fi
if [[ "${1}" == '--unmount' ]]; then
umount \
-nR \
/mnt
zpool \
export \
${hostname,,}
fi
if [[ "${1}" == '--host-id' ]]; then
zgenhostid \
-f \
0x00bab10c
fi
if [[ "${1}" == '--home' ]]; then
zfs create\
${hostname,,}/home/${username}
zfs create\
${hostname,,}/home/${username}/.config
zfs create\
-o canmount=off\
${hostname,,}/home/${username}/.var
zfs create\
${hostname,,}/home/${username}/.var/app
zfs create\
-o canmount=off\
${hostname,,}/home/${username}/.local
zfs create\
-o canmount=off\
${hostname,,}/home/${username}/.local/share
zfs create\
${hostname,,}/home/${username}/.local/share/flatpak
fi
if [[ "${1}" == '--keystore' ]]; then
zfs \
set \
org.zfsbootmenu:keysource=${hostname,,}/keystore \
${hostname,,}
fi
if [[ "${1}" == '--splash' ]]; then
zfs \
set \
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
${hostname,,}/ROOT/${ID}
fi