Compare commits
31 Commits
d186c475b0
...
modularize
| Author | SHA1 | Date | |
|---|---|---|---|
|
2ebb72620b
|
|||
|
25afed7541
|
|||
|
b8b5918feb
|
|||
|
fd177fa071
|
|||
|
aaa209a056
|
|||
|
38dc3ab73a
|
|||
|
3c8719450d
|
|||
|
e8c745a307
|
|||
|
00324dfb5d
|
|||
|
e03ff714a7
|
|||
|
6e1670ac6a
|
|||
|
3e233de780
|
|||
|
b57734ddbb
|
|||
|
e78d63fee7
|
|||
|
ee2967c522
|
|||
|
023c12cb8e
|
|||
|
d1bbf9889b
|
|||
|
e3428baed2
|
|||
|
1e378f8fe1
|
|||
|
56b4fbd596
|
|||
|
7e9c59750b
|
|||
|
f7cdd0c419
|
|||
|
8b892d207d
|
|||
|
8d3c013539
|
|||
|
a6abd9e365
|
|||
|
a09f66e4a7
|
|||
|
f41eb46966
|
|||
|
df9a67caea
|
|||
|
2b1a2f29ee
|
|||
|
3e7a7a5788
|
|||
|
9a32510698
|
14
README.md
14
README.md
@@ -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
52
adduser.sh
Executable 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
28
apt-snapshot.sh
Executable 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
|
||||||
67
debian.sh
67
debian.sh
@@ -31,8 +31,11 @@ EOF
|
|||||||
systemd-timesyncd \
|
systemd-timesyncd \
|
||||||
whois \
|
whois \
|
||||||
zfsutils-linux
|
zfsutils-linux
|
||||||
elif [[ "${1}" == '--mmdebstrap' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--mmdebstrap' ]]; then
|
||||||
packages=(\
|
packages=(\
|
||||||
|
ca-certificates \
|
||||||
console-setup \
|
console-setup \
|
||||||
cryptsetup \
|
cryptsetup \
|
||||||
curl \
|
curl \
|
||||||
@@ -51,6 +54,7 @@ openssh-{client,server} \
|
|||||||
popularity-contest \
|
popularity-contest \
|
||||||
printer-driver-all \
|
printer-driver-all \
|
||||||
rsync \
|
rsync \
|
||||||
|
sudo \
|
||||||
systemd-timesyncd \
|
systemd-timesyncd \
|
||||||
tasksel \
|
tasksel \
|
||||||
zfs-initramfs \
|
zfs-initramfs \
|
||||||
@@ -71,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
|
||||||
|
|
||||||
@@ -81,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
|
||||||
@@ -109,7 +117,9 @@ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm /mnt/etc/apt/sources.list
|
rm /mnt/etc/apt/sources.list
|
||||||
elif [[ "${1}" == '--dpkg-reconfigure' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--dpkg-reconfigure' ]]; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
|
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
|
||||||
@@ -123,12 +133,16 @@ EOF
|
|||||||
tzdata \
|
tzdata \
|
||||||
keyboard-configuration \
|
keyboard-configuration \
|
||||||
console-setup
|
console-setup
|
||||||
elif [[ "${1}" == '--purge-os-prober' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--purge-os-prober' ]]; then
|
||||||
apt \
|
apt \
|
||||||
purge \
|
purge \
|
||||||
--yes \
|
--yes \
|
||||||
os-prober
|
os-prober
|
||||||
elif [[ "${1}" == '--network-manager' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--network-manager' ]]; then
|
||||||
cp \
|
cp \
|
||||||
/etc/NetworkManager/NetworkManager.conf \
|
/etc/NetworkManager/NetworkManager.conf \
|
||||||
/etc/NetworkManager/NetworkManager.conf.orig
|
/etc/NetworkManager/NetworkManager.conf.orig
|
||||||
@@ -137,7 +151,9 @@ elif [[ "${1}" == '--network-manager' ]]; then
|
|||||||
/etc/NetworkManager/NetworkManager.conf.orig | \
|
/etc/NetworkManager/NetworkManager.conf.orig | \
|
||||||
sed 's|managed=false|managed=true|' | \
|
sed 's|managed=false|managed=true|' | \
|
||||||
tee /etc/NetworkManager/NetworkManager.conf &> /dev/null
|
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
|
cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
|
||||||
|
|
||||||
# ${VERSION_CODENAME^} Backports
|
# ${VERSION_CODENAME^} Backports
|
||||||
@@ -167,7 +183,9 @@ Pin: release n=${VERSION_CODENAME}-backports
|
|||||||
Pin-Priority: -1
|
Pin-Priority: -1
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
elif [[ "${1}" == '--tasksel' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--tasksel' ]]; then
|
||||||
if [[ ! -f /usr/bin/tasksel ]]; then
|
if [[ ! -f /usr/bin/tasksel ]]; then
|
||||||
apt \
|
apt \
|
||||||
--update \
|
--update \
|
||||||
@@ -179,3 +197,36 @@ elif [[ "${1}" == '--tasksel' ]]; then
|
|||||||
tasksel \
|
tasksel \
|
||||||
--new-install
|
--new-install
|
||||||
fi
|
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
|
||||||
|
|||||||
@@ -45,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
|
||||||
@@ -91,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,7 +109,9 @@ elif [[ "${1}" == '--elementary' ]]; then
|
|||||||
cp \
|
cp \
|
||||||
/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/
|
||||||
elif [[ "${1}" == '--network' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--network' ]]; then
|
||||||
mkdir \
|
mkdir \
|
||||||
-p \
|
-p \
|
||||||
/mnt/run/systemd/resolve/
|
/mnt/run/systemd/resolve/
|
||||||
@@ -115,7 +123,9 @@ elif [[ "${1}" == '--network' ]]; then
|
|||||||
|
|
||||||
touch \
|
touch \
|
||||||
/mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
|
/mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
|
||||||
elif [[ "${1}" == '--apps' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--apps' ]]; then
|
||||||
app=(\
|
app=(\
|
||||||
io.elementary.calculator \
|
io.elementary.calculator \
|
||||||
io.elementary.camera \
|
io.elementary.camera \
|
||||||
@@ -141,16 +151,49 @@ org.gnome.font-viewer\
|
|||||||
appcenter \
|
appcenter \
|
||||||
-y \
|
-y \
|
||||||
${apps}
|
${apps}
|
||||||
elif [[ "${1}" == '--purge' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--purge' ]]; then
|
||||||
apt \
|
apt \
|
||||||
purge \
|
purge \
|
||||||
--yes \
|
--yes \
|
||||||
--autoremove \
|
--autoremove \
|
||||||
gnome-software \
|
gnome-software \
|
||||||
snapd
|
snapd
|
||||||
elif [[ "${1}" == '--desktop' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--desktop' ]]; then
|
||||||
apt \
|
apt \
|
||||||
install \
|
install \
|
||||||
--yes \
|
--yes \
|
||||||
elementary-desktop
|
elementary-desktop
|
||||||
fi
|
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
|
||||||
|
|||||||
74
fedora.sh
74
fedora.sh
@@ -35,7 +35,9 @@ if [[ "${1}" == '--live' ]]; then
|
|||||||
|
|
||||||
modprobe \
|
modprobe \
|
||||||
zfs
|
zfs
|
||||||
elif [[ "${1}" == '--rsync' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--rsync' ]]; then
|
||||||
mkdir -p /run/install
|
mkdir -p /run/install
|
||||||
|
|
||||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||||
@@ -50,13 +52,77 @@ elif [[ "${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
|
||||||
|
|||||||
131
install.sh
131
install.sh
@@ -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,100 +29,26 @@ source \
|
|||||||
source \
|
source \
|
||||||
"${baseDir}/system.conf"
|
"${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 [[ ! -f "/etc/mtab" ]]; then
|
if [[ ! -f "/etc/mtab" ]]; then
|
||||||
"${baseDir}/mtab.sh"
|
"${baseDir}/mtab.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
apt \
|
|
||||||
update
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
||||||
"${baseDir}/debian.sh" --dpkg-reconfigure
|
"${baseDir}/debian.sh" --dpkg-reconfigure
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if [[ "${ID}" == 'debian' ]]; then
|
|
||||||
# printf \
|
|
||||||
# 'REMAKE_INITRD=yes\n' | \
|
|
||||||
# tee /etc/dkms/zfs.conf &> /dev/null
|
|
||||||
# fi
|
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
|
||||||
"${baseDir}/partition.sh" --efi
|
"${baseDir}/partition.sh" --efi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
if [[ -e '/usr/bin/os-prober' ]]; then
|
||||||
"${baseDir}/debian.sh" --purge-os-prober
|
"${baseDir}/debian.sh" --purge-os-prober
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
"${baseDir}/elementary.sh" --desktop
|
"${baseDir}/elementary.sh" --desktop
|
||||||
@@ -145,65 +71,28 @@ passwd
|
|||||||
printf \
|
printf \
|
||||||
'\033[?47l'
|
'\033[?47l'
|
||||||
|
|
||||||
if [[ "${enableSwap}" == "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
|
||||||
"${baseDir}/debian.sh" --network-manager
|
"${baseDir}/debian.sh" --network-manager
|
||||||
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
|
||||||
zfs \
|
"${baseDir}/zfs.sh" --keystore
|
||||||
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 \
|
||||||
|
|||||||
14
menu.sh
14
menu.sh
@@ -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
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -44,16 +44,12 @@ EOF
|
|||||||
"${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
|
|
||||||
"${baseDir}/pre-inst.sh"
|
|
||||||
elif [[ "${option}" == 'Install' ]]; then
|
elif [[ "${option}" == 'Install' ]]; then
|
||||||
"${baseDir}/install.sh"
|
"${baseDir}/pre-inst.sh"
|
||||||
elif [[ "${option}" == 'WiFi Setup' ]]; then
|
|
||||||
"${baseDir}/wifi.sh"
|
|
||||||
elif [[ "${option}" == 'Post Install' ]]; then
|
|
||||||
"${baseDir}/post-inst.sh"
|
|
||||||
elif [[ "${option}" == 'Finalize' ]]; then
|
elif [[ "${option}" == 'Finalize' ]]; then
|
||||||
"${baseDir}/finalize.sh"
|
"${baseDir}/finalize.sh"
|
||||||
|
elif [[ "${option}" == 'WiFi Setup' ]]; then
|
||||||
|
"${baseDir}/wifi.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '\033[?47h\033[2J\033[H'
|
printf '\033[?47h\033[2J\033[H'
|
||||||
|
|||||||
28
mount.sh
Executable file
28
mount.sh
Executable 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
|
||||||
37
namarupa.sh
37
namarupa.sh
@@ -1,37 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
baseDir="$(realpath "$(dirname "${0}")")"
|
|
||||||
|
|
||||||
source \
|
|
||||||
/etc/os-release
|
|
||||||
source \
|
|
||||||
"${baseDir}/system.conf"
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -46,8 +46,8 @@ if [[ "${1}" == '--disk' ]]; then
|
|||||||
if [[ "${enableSwap}" == "yes" ]]; then
|
if [[ "${enableSwap}" == "yes" ]]; then
|
||||||
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
|
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
|
||||||
|
|
||||||
if [[ "${swapSize#}" -gt '32' ]]; then
|
if [[ "${swapSize#}" -gt '16' ]]; then
|
||||||
swapSize='32'
|
swapSize='16'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sgdisk \
|
sgdisk \
|
||||||
@@ -62,7 +62,9 @@ if [[ "${1}" == '--disk' ]]; then
|
|||||||
-t3:BF00 \
|
-t3:BF00 \
|
||||||
-c3:${ID} \
|
-c3:${ID} \
|
||||||
${disk}
|
${disk}
|
||||||
elif [[ "${1}" == '--efi' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--efi' ]]; then
|
||||||
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
||||||
if [[ "${disk}" == **/dev/nvme** ]]; then
|
if [[ "${disk}" == **/dev/nvme** ]]; then
|
||||||
part1='p1'
|
part1='p1'
|
||||||
|
|||||||
112
post-inst.sh
112
post-inst.sh
@@ -33,85 +33,12 @@ 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
|
|
||||||
|
|
||||||
groups='audio,cdrom,dip,floppy,plugdev,sudo,video,dialout,lpadmin'
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]]; then
|
|
||||||
groups+=',netdev'
|
|
||||||
fi
|
|
||||||
|
|
||||||
usermod \
|
|
||||||
-a \
|
|
||||||
-G \
|
|
||||||
${groups} \
|
|
||||||
${username}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
"${baseDir}/namarupa.sh"
|
"${baseDir}/elementary.sh" --namarupa
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
elif [[ "${ID}" == 'debian' ]]; then
|
||||||
"${baseDir}/debian.sh" --contrib
|
"${baseDir}/debian.sh" --contrib
|
||||||
fi
|
fi
|
||||||
@@ -128,41 +55,12 @@ if [[ "${ID}" = 'debian' ]]; then
|
|||||||
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"
|
"${baseDir}/home-fix-setup.sh"
|
||||||
# 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
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ elif [[ "${ID}" == 'debian' ]]; then
|
|||||||
"${baseDir}/debian.sh" --sources
|
"${baseDir}/debian.sh" --sources
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${baseDir}/rbind.sh"
|
"${baseDir}/mount.sh"
|
||||||
|
|
||||||
"${baseDir}/host-id.sh"
|
"${baseDir}/host-id.sh"
|
||||||
|
|
||||||
@@ -98,11 +98,9 @@ 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
|
"${baseDir}/zfs.sh" --key
|
||||||
fi
|
fi
|
||||||
# fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
"${baseDir}/elementary.sh" --elementary
|
"${baseDir}/elementary.sh" --elementary
|
||||||
|
|||||||
29
swap.sh
Executable file
29
swap.sh
Executable 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
|
||||||
4
wifi.sh
4
wifi.sh
@@ -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 ${wifiName}
|
nmcli --ask device wifi connect "${wifiName}"
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
|
|||||||
62
zfs.sh
62
zfs.sh
@@ -30,14 +30,14 @@ if [[ "${1}" == '--format' ]]; then
|
|||||||
|
|
||||||
while [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]] || [[ -z "${zpoolPassword}" ]] || [[ "${#zpoolPassword}" -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 \
|
||||||
zpoolPassword
|
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 \
|
||||||
@@ -45,13 +45,13 @@ if [[ "${1}" == '--format' ]]; then
|
|||||||
|
|
||||||
if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
|
if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
|
||||||
printf \
|
printf \
|
||||||
"ERROR:\tPasswords do not match!\n"
|
"ERROR:\tPasswords do not match!\n\n"
|
||||||
elif [[ -z "${zpoolPassword}" ]]; then
|
elif [[ -z "${zpoolPassword}" ]]; then
|
||||||
printf \
|
printf \
|
||||||
"ERROR:\tPassword is empty!\n"
|
"ERROR:\tPassword is empty!\n\n"
|
||||||
elif [[ "${#zpoolPassword}" -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
|
||||||
|
|
||||||
@@ -219,20 +219,60 @@ if [[ "${1}" == '--key' ]]; then
|
|||||||
cp \
|
cp \
|
||||||
/etc/zfs/keys/${hostname,,}.key \
|
/etc/zfs/keys/${hostname,,}.key \
|
||||||
/mnt/etc/zfs/keys/
|
/mnt/etc/zfs/keys/
|
||||||
elif [[ "${1}" == '--unmount' ]]; then
|
fi
|
||||||
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -I {} umount -Rlf {}
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'fedora' ]]; then
|
if [[ "${1}" == '--unmount' ]]; then
|
||||||
umount \
|
umount \
|
||||||
-nR \
|
-nR \
|
||||||
/mnt
|
/mnt
|
||||||
fi
|
|
||||||
|
|
||||||
zpool \
|
zpool \
|
||||||
export \
|
export \
|
||||||
-a
|
${hostname,,}
|
||||||
elif [[ "${1}" == '--host-id' ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "${1}" == '--host-id' ]]; then
|
||||||
zgenhostid \
|
zgenhostid \
|
||||||
-f \
|
-f \
|
||||||
0x00bab10c
|
0x00bab10c
|
||||||
fi
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user