Compare commits
16 Commits
2139685f77
...
568c80a05e
| Author | SHA1 | Date | |
|---|---|---|---|
|
568c80a05e
|
|||
|
00fe875b44
|
|||
|
8414563171
|
|||
|
30b3b58336
|
|||
|
3e4eeb7d37
|
|||
|
8305fa16cd
|
|||
|
16018759fb
|
|||
|
2028fa4396
|
|||
|
637f5b69db
|
|||
|
3902f873e9
|
|||
|
8bca55e467
|
|||
|
377d56b1cd
|
|||
|
9c8add89e5
|
|||
|
648d07f355
|
|||
|
f44f7464b9
|
|||
|
ec2d8148e0
|
17
chroot.sh
Normal file
17
chroot.sh
Normal 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
|
||||
92
debian.sh
92
debian.sh
@@ -9,7 +9,28 @@ source \
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
|
||||
if [[ "${1}" == '--mmdebstrap' ]]; then
|
||||
if [[ "${1}" == '--live' ]]; 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
|
||||
|
||||
apt \
|
||||
--update \
|
||||
install \
|
||||
--yes \
|
||||
mmdebstrap \
|
||||
gdisk \
|
||||
systemd-timesyncd \
|
||||
whois \
|
||||
zfsutils-linux
|
||||
elif [[ "${1}" == '--mmdebstrap' ]]; then
|
||||
packages=(\
|
||||
console-setup \
|
||||
cryptsetup \
|
||||
@@ -86,4 +107,73 @@ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
EOF
|
||||
|
||||
rm /mnt/etc/apt/sources.list
|
||||
elif [[ "${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
|
||||
elif [[ "${1}" == '--purge-os-prober' ]]; then
|
||||
apt \
|
||||
purge \
|
||||
--yes \
|
||||
os-prober
|
||||
elif [[ "${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
|
||||
elif [[ "${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
|
||||
elif [[ "${1}" == '--tasksel' ]]; then
|
||||
if [[ ! -f /usr/bin/tasksel ]]; then
|
||||
apt \
|
||||
--update \
|
||||
install \
|
||||
--yes \
|
||||
tasksel
|
||||
fi
|
||||
|
||||
tasksel \
|
||||
--new-install
|
||||
fi
|
||||
|
||||
28
fedora.sh
28
fedora.sh
@@ -9,7 +9,33 @@ source \
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
|
||||
if [[ "${1}" == '--rsync' ]]; then
|
||||
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
|
||||
elif [[ "${1}" == '--rsync' ]]; then
|
||||
mkdir -p /run/install
|
||||
|
||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||
|
||||
59
home-fix-setup.sh
Normal file
59
home-fix-setup.sh
Normal 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' ]]; 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
Normal file
7
host-id.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
cp \
|
||||
/etc/hostid \
|
||||
/mnt/etc/
|
||||
9
hostname.sh
Normal file
9
hostname.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
printf \
|
||||
"${hostname}\n" | tee /mnt/etc/hostname &> /dev/null
|
||||
|
||||
printf \
|
||||
"127.0.1.1\t${hostname}\n" | tee --append /mnt/etc/hosts &> /dev/null
|
||||
94
install.sh
94
install.sh
@@ -29,24 +29,21 @@ source \
|
||||
source \
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${DISK}" == **/dev/nvme** ]]; then
|
||||
PART1='p1'
|
||||
PART2='p2'
|
||||
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${disk}" == **/dev/nvme** ]]; then
|
||||
part1='p1'
|
||||
part2='p2'
|
||||
else
|
||||
PART1='1'
|
||||
PART2='2'
|
||||
part1='1'
|
||||
part2='2'
|
||||
fi
|
||||
else
|
||||
PART1='-part1'
|
||||
PART2='-part2'
|
||||
part1='-part1'
|
||||
part2='-part2'
|
||||
fi
|
||||
|
||||
if [[ ! -f "/etc/mtab" ]]; then
|
||||
ln \
|
||||
-s \
|
||||
/proc/self/mounts \
|
||||
/etc/mtab
|
||||
"${baseDir}/mtab.sh"
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||
@@ -60,7 +57,7 @@ if [[ "${ID}" == 'fedora' ]]; then
|
||||
nofsck="yes"
|
||||
add_dracutmodules+=" zfs "
|
||||
omit_dracutmodules+=" btrfs "
|
||||
install_items+=" /etc/zfs/keys/${HOSTNAME,,}.key "
|
||||
install_items+=" /etc/zfs/keys/${hostname,,}.key "
|
||||
EOF
|
||||
else
|
||||
cat <<EOF >/etc/dracut.conf.d/zol.conf
|
||||
@@ -69,9 +66,7 @@ add_dracutmodules+=" zfs "
|
||||
omit_dracutmodules+=" btrfs "
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||
dnf \
|
||||
config-manager \
|
||||
@@ -115,53 +110,21 @@ if [[ "${ID}" == 'fedora' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; 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
|
||||
"${baseDir}/debian.sh" --dpkg-reconfigure
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]]; then
|
||||
printf \
|
||||
'REMAKE_INITRD=yes\n' | \
|
||||
tee /etc/dkms/zfs.conf &> /dev/null
|
||||
fi
|
||||
# if [[ "${ID}" == 'debian' ]]; then
|
||||
# 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}
|
||||
"${baseDir}/partition.sh" --efi
|
||||
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
|
||||
apt \
|
||||
purge \
|
||||
--yes \
|
||||
os-prober
|
||||
"${baseDir}/debian.sh" --purge-os-prober
|
||||
fi
|
||||
|
||||
printf \
|
||||
@@ -177,9 +140,9 @@ passwd
|
||||
printf \
|
||||
'\033[?47l'
|
||||
|
||||
if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
||||
if [[ "${enableSwap}" == "yes" ]]; then
|
||||
printf \
|
||||
"swap\t${DISK}${PART2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
|
||||
"swap\t${disk}${part2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
|
||||
tee /etc/crypttab &> /dev/null
|
||||
|
||||
printf \
|
||||
@@ -188,14 +151,7 @@ if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]]; 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
|
||||
"${baseDir}/debian.sh" --network-manager
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||
@@ -215,14 +171,14 @@ fi
|
||||
zfs \
|
||||
set \
|
||||
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
|
||||
${HOSTNAME,,}/ROOT/${ID}
|
||||
${hostname,,}/ROOT/${ID}
|
||||
|
||||
if [[ ! "${*}" = *--no-part* ]]; then
|
||||
if [[ ! -z "$(zfs list | grep 'keystore')" ]]; then
|
||||
zfs \
|
||||
set \
|
||||
org.zfsbootmenu:keysource=${HOSTNAME,,}/keystore \
|
||||
${HOSTNAME,,}
|
||||
org.zfsbootmenu:keysource=${hostname,,}/keystore \
|
||||
${hostname,,}
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -247,6 +203,6 @@ fi
|
||||
|
||||
zfs \
|
||||
snapshot \
|
||||
${HOSTNAME,,}/ROOT/${ID}@install
|
||||
${hostname,,}/ROOT/${ID}@install
|
||||
|
||||
"${baseDir}/post-inst.sh"
|
||||
|
||||
17
mkdir-tmpfs.sh
Normal file
17
mkdir-tmpfs.sh
Normal 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
|
||||
8
mtab.sh
Normal file
8
mtab.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
ln \
|
||||
-s \
|
||||
/proc/self/mounts \
|
||||
/etc/mtab
|
||||
55
partition.sh
55
partition.sh
@@ -8,14 +8,14 @@ source \
|
||||
source \
|
||||
"${BASEDIR}/system.conf"
|
||||
|
||||
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${DISK}" == **/dev/nvme** ]]; then
|
||||
PART3='p3'
|
||||
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${disk}" == **/dev/nvme** ]]; then
|
||||
part3='p3'
|
||||
else
|
||||
PART3='3'
|
||||
part3='3'
|
||||
fi
|
||||
else
|
||||
PART3='-part3'
|
||||
part3='-part3'
|
||||
fi
|
||||
|
||||
swapoff \
|
||||
@@ -23,40 +23,61 @@ swapoff \
|
||||
|
||||
wipefs \
|
||||
-a \
|
||||
${DISK}
|
||||
${disk}
|
||||
|
||||
if [[ ! "${DISK_TYPE}" == 'HDD' ]]; then
|
||||
if [[ ! "${diskType}" == 'HDD' ]]; then
|
||||
blkdiscard \
|
||||
-f \
|
||||
${DISK}
|
||||
${disk}
|
||||
fi
|
||||
|
||||
sgdisk \
|
||||
--zap-all \
|
||||
${DISK}
|
||||
${disk}
|
||||
|
||||
sgdisk \
|
||||
-n1:0:+512M \
|
||||
-t1:EF00 \
|
||||
-c1:EFI \
|
||||
${DISK}
|
||||
${disk}
|
||||
|
||||
if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
||||
SWAP_SIZE="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
|
||||
if [[ "${enableSwap}" == "yes" ]]; then
|
||||
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
|
||||
|
||||
if [[ "${SWAP_SIZE#}" -gt '32' ]]; then
|
||||
SWAP_SIZE='32'
|
||||
if [[ "${swapSize#}" -gt '32' ]]; then
|
||||
swapSize='32'
|
||||
fi
|
||||
|
||||
sgdisk \
|
||||
-n2:0:+${SWAP_SIZE}G \
|
||||
-n2:0:+${swapSize}G \
|
||||
-t2:BF02 \
|
||||
-c2:swap \
|
||||
${DISK}
|
||||
${disk}
|
||||
fi
|
||||
|
||||
sgdisk \
|
||||
-n3:0:0 \
|
||||
-t3:BF00 \
|
||||
-c3:${ID} \
|
||||
${DISK}
|
||||
${disk}
|
||||
|
||||
if [[ "${*}" == *--efi* ]]; then
|
||||
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
|
||||
|
||||
136
post-inst.sh
136
post-inst.sh
@@ -2,7 +2,12 @@
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
||||
baseDir="$(realpath "$(dirname "${0}")")"
|
||||
|
||||
source \
|
||||
/etc/os-release
|
||||
source \
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
|
||||
printf \
|
||||
@@ -11,7 +16,7 @@ printf \
|
||||
cat << EOF
|
||||
#######################################
|
||||
## ##
|
||||
## $(cat "${BASEDIR}/title") Script ##
|
||||
## $(cat "${baseDir}/title") Script ##
|
||||
## ##
|
||||
## Jean <jean@easthighnerd.net> ##
|
||||
## ##
|
||||
@@ -32,41 +37,41 @@ source \
|
||||
/etc/os-release
|
||||
|
||||
source \
|
||||
"${BASEDIR}/system.conf"
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
|
||||
if [[ ! "${*}" = *--no-part* ]]; then
|
||||
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||
zfs create\
|
||||
${HOSTNAME,,}/home/${USERNAME}
|
||||
${hostname,,}/home/${username}
|
||||
|
||||
zfs create\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.config
|
||||
${hostname,,}/home/${username}/.config
|
||||
|
||||
zfs create\
|
||||
-o canmount=off\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.var
|
||||
${hostname,,}/home/${username}/.var
|
||||
|
||||
zfs create\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.var/app
|
||||
${hostname,,}/home/${username}/.var/app
|
||||
|
||||
zfs create\
|
||||
-o canmount=off\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.local
|
||||
${hostname,,}/home/${username}/.local
|
||||
|
||||
zfs create\
|
||||
-o canmount=off\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.local/share
|
||||
${hostname,,}/home/${username}/.local/share
|
||||
|
||||
zfs create\
|
||||
${HOSTNAME,,}/home/${USERNAME}/.local/share/flatpak
|
||||
${hostname,,}/home/${username}/.local/share/flatpak
|
||||
|
||||
printf \
|
||||
'Adding user account...\n'
|
||||
|
||||
adduser ${USERNAME}
|
||||
else
|
||||
adduser --no-create-home ${USERNAME}
|
||||
fi
|
||||
adduser ${username}
|
||||
# else
|
||||
# adduser --no-create-home ${username}
|
||||
# fi
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
printf \
|
||||
@@ -77,7 +82,7 @@ if [[ "${ID}" == 'fedora' ]]; then
|
||||
Enter a password for the new user account:
|
||||
EOF
|
||||
passwd \
|
||||
${USERNAME}
|
||||
${username}
|
||||
|
||||
printf \
|
||||
'\033[?47l'
|
||||
@@ -86,7 +91,7 @@ EOF
|
||||
-a \
|
||||
-G \
|
||||
audio,cdrom,dip,floppy,wheel,video,dialout \
|
||||
${USERNAME}
|
||||
${username}
|
||||
else
|
||||
if [[ -z "$(cat /etc/group | grep 'lpadmin')" ]]; then
|
||||
groupadd --gid 108 lpadmin
|
||||
@@ -96,7 +101,7 @@ else
|
||||
-a \
|
||||
-G \
|
||||
audio,cdrom,dip,floppy,netdev,plugdev,sudo,video,dialout,lpadmin \
|
||||
${USERNAME}
|
||||
${username}
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'elementary' ]]; then
|
||||
@@ -115,35 +120,7 @@ Pin: release n=${UBUNTU_VERSION_CODENAME}-backports
|
||||
Pin-Priority: -1
|
||||
EOF
|
||||
elif [[ "${ID}" == 'debian' ]]; 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
|
||||
"${baseDir}/debian.sh" --contrib
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||
@@ -159,15 +136,7 @@ if [[ "${ID}" == 'elementary' ]]; then
|
||||
--autoremove \
|
||||
elementary-desktop
|
||||
elif [[ "${ID}" = 'debian' ]]; then
|
||||
if [[ ! -f /usr/bin/tasksel ]]; then
|
||||
apt \
|
||||
install \
|
||||
--yes \
|
||||
tasksel
|
||||
fi
|
||||
|
||||
tasksel \
|
||||
--new-install
|
||||
"${baseDir}/debian.sh" --tasksel
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||
@@ -203,56 +172,9 @@ EOF
|
||||
tee /etc/apt/apt.conf.d/99-apt_moo &> /dev/null
|
||||
fi
|
||||
|
||||
if [[ ! "${*}" = *--no-part* ]]; then
|
||||
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 [[ ! "${*}" = *--no-part* ]]; then
|
||||
"${baseDir}/home-fix-setup.sh"
|
||||
# fi
|
||||
|
||||
if [[ ! -f '/usr/bin/shutdown' ]]; then
|
||||
ln -s /sbin/shutdown /usr/bin/shutdown
|
||||
@@ -264,7 +186,7 @@ fi
|
||||
|
||||
zfs \
|
||||
snapshot \
|
||||
${HOSTNAME,,}/ROOT/${ID}@post-install
|
||||
${hostname,,}/ROOT/${ID}@post-install
|
||||
|
||||
printf \
|
||||
'\033[?47h\033[2J\033[H'
|
||||
|
||||
121
pre-inst.sh
121
pre-inst.sh
@@ -31,20 +31,6 @@ source \
|
||||
"${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
|
||||
gsettings \
|
||||
set \
|
||||
@@ -54,50 +40,15 @@ if [[ -f '/usr/bin/gsettings' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||
apt \
|
||||
update && \
|
||||
apt \
|
||||
install \
|
||||
--yes \
|
||||
mmdebstrap \
|
||||
gdisk \
|
||||
systemd-timesyncd \
|
||||
whois \
|
||||
zfsutils-linux
|
||||
"${baseDir}/debian.sh" --live
|
||||
elif [[ "${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://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
|
||||
"${baseDir}/fedora.sh" --live
|
||||
fi
|
||||
|
||||
timedatectl
|
||||
|
||||
if [[ ! "$(hostname)" == "debian-live" ]]; then
|
||||
zgenhostid \
|
||||
-f \
|
||||
0x00bab10c
|
||||
"${baseDir}/zfs.sh" --host-id
|
||||
fi
|
||||
|
||||
|
||||
@@ -107,19 +58,7 @@ sleep 5
|
||||
|
||||
"${baseDir}/zfs.sh"
|
||||
|
||||
mkdir \
|
||||
-p \
|
||||
/mnt/run
|
||||
|
||||
mount \
|
||||
-t \
|
||||
tmpfs \
|
||||
tmpfs \
|
||||
/mnt/run
|
||||
|
||||
mkdir \
|
||||
-p \
|
||||
/mnt/run/lock
|
||||
"${baseDir}/mkdir-tmpfs.sh"
|
||||
|
||||
if [[ "${ID}" == 'elementary' ]]; then
|
||||
"${baseDir}/elementary.sh" --mmdebstrap
|
||||
@@ -129,11 +68,7 @@ elif [[ "${ID}" == 'fedora' ]]; then
|
||||
"${baseDir}/fedora.sh" --rsync
|
||||
fi
|
||||
|
||||
printf \
|
||||
"${hostname}\n" | tee /mnt/etc/hostname &> /dev/null
|
||||
|
||||
printf \
|
||||
"127.0.1.1\t${hostname}\n" | tee --append /mnt/etc/hosts &> /dev/null
|
||||
"${baseDir}/hostname.sh"
|
||||
|
||||
if [[ "${ID}" == 'debian' ]]; then
|
||||
"${baseDir}/debian.sh" --network-interfaces
|
||||
@@ -145,32 +80,15 @@ elif [[ "${ID}" == 'debian' ]]; then
|
||||
"${baseDir}/debian.sh" --sources
|
||||
fi
|
||||
|
||||
mount \
|
||||
--rbind \
|
||||
/dev \
|
||||
/mnt/dev
|
||||
"${baseDir}/rbind.sh"
|
||||
|
||||
mount \
|
||||
--rbind \
|
||||
/proc \
|
||||
/mnt/proc
|
||||
|
||||
mount \
|
||||
--rbind \
|
||||
/sys \
|
||||
/mnt/sys
|
||||
|
||||
cp \
|
||||
/etc/hostid \
|
||||
/mnt/etc/
|
||||
"${baseDir}/host-id.sh"
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
"${baseDir}/fedora.sh" --resolv-conf
|
||||
fi
|
||||
|
||||
rsync -pogAXtlHrDx \
|
||||
"${baseDir}" \
|
||||
/mnt
|
||||
"${baseDir}/rsync.sh"
|
||||
|
||||
if [[ "${ID}" == 'elementary' ]]; then
|
||||
"${baseDir}/elementary.sh" --skel
|
||||
@@ -178,9 +96,7 @@ fi
|
||||
|
||||
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||
if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then
|
||||
cp \
|
||||
/etc/zfs/keys/${hostname,,}.key \
|
||||
/mnt/etc/zfs/keys/
|
||||
"${baseDir}/zfs.sh" --key
|
||||
fi
|
||||
# fi
|
||||
|
||||
@@ -188,24 +104,9 @@ if [[ "${ID}" == 'elementary' ]]; then
|
||||
"${baseDir}/elementary.sh" --elementary
|
||||
fi
|
||||
|
||||
printf \
|
||||
"\nNow chrooting into /mnt...\n\n"
|
||||
"${baseDir}/chroot.sh" --continue
|
||||
|
||||
chroot \
|
||||
/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
|
||||
"${baseDir}/zfs.sh" --unmount
|
||||
|
||||
printf \
|
||||
'\033[?47h\033[2J\033[H'
|
||||
|
||||
18
rbind.sh
Normal file
18
rbind.sh
Normal 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
Normal file
9
rsync.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
baseDir="$(realpath "$(dirname "${0}")")"
|
||||
|
||||
|
||||
rsync -pogAXtlHrDx \
|
||||
"${baseDir}" \
|
||||
/mnt
|
||||
154
zfs.sh
154
zfs.sh
@@ -1,55 +1,55 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
||||
baseDir="$(realpath "$(dirname "${0}")")"
|
||||
|
||||
source \
|
||||
/etc/os-release
|
||||
source \
|
||||
"${BASEDIR}/system.conf"
|
||||
"${baseDir}/system.conf"
|
||||
|
||||
|
||||
if [[ ! "${DISK}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${DISK}" == **/dev/nvme** ]]; then
|
||||
PART3='p3'
|
||||
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
||||
if [[ "${disk}" == **/dev/nvme** ]]; then
|
||||
part3='p3'
|
||||
else
|
||||
PART3='3'
|
||||
part3='3'
|
||||
fi
|
||||
else
|
||||
PART3='-part3'
|
||||
part3='-part3'
|
||||
fi
|
||||
|
||||
|
||||
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||
if [[ "${ENCRYPTION}" == 'yes' ]]; then
|
||||
ZPOOL_PASSWORD='A'
|
||||
ZPOOL_PASSWORD_VERIFY='B'
|
||||
if [[ "${encryption}" == 'yes' ]]; then
|
||||
zpoolPassword='A'
|
||||
zpoolPasswordVerify='B'
|
||||
|
||||
printf \
|
||||
'\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 \
|
||||
"\nEnter a password to encrypt your root pool (minimum 8 characters):\n"
|
||||
read \
|
||||
-r \
|
||||
-s \
|
||||
ZPOOL_PASSWORD
|
||||
zpoolPassword
|
||||
|
||||
printf \
|
||||
"\nVerify the password to encrypt your root pool:\n"
|
||||
read \
|
||||
-r \
|
||||
-s \
|
||||
ZPOOL_PASSWORD_VERIFY
|
||||
zpoolPasswordVerify
|
||||
|
||||
if [[ ! "${ZPOOL_PASSWORD}" == "${ZPOOL_PASSWORD_VERIFY}" ]]; then
|
||||
if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
|
||||
printf \
|
||||
"ERROR:\tPasswords do not match!\n"
|
||||
elif [[ -z "${ZPOOL_PASSWORD}" ]]; then
|
||||
elif [[ -z "${zpoolPassword}" ]]; then
|
||||
printf \
|
||||
"ERROR:\tPassword is empty!\n"
|
||||
elif [[ "${#ZPOOL_PASSWORD}" -lt '8' ]]; then
|
||||
elif [[ "${#zpoolPassword}" -lt '8' ]]; then
|
||||
printf \
|
||||
"ERROR:\tPassword is too short!\n"
|
||||
fi
|
||||
@@ -63,18 +63,18 @@ fi
|
||||
/etc/zfs/keys/
|
||||
|
||||
printf \
|
||||
"${ZPOOL_PASSWORD}\n" | tee /etc/zfs/keys/${HOSTNAME,,}.key &> /dev/null
|
||||
"${zpoolPassword}\n" | tee /etc/zfs/keys/${hostname,,}.key &> /dev/null
|
||||
|
||||
chmod \
|
||||
000 \
|
||||
/etc/zfs/keys/${HOSTNAME,,}.key
|
||||
/etc/zfs/keys/${hostname,,}.key
|
||||
|
||||
zpool create \
|
||||
-o ashift=12 \
|
||||
-o autotrim=on \
|
||||
-o compatibility=openzfs-2.1-linux \
|
||||
-O encryption=on \
|
||||
-O keylocation=file:///etc/zfs/keys/${HOSTNAME,,}.key \
|
||||
-O keylocation=file:///etc/zfs/keys/${hostname,,}.key \
|
||||
-O keyformat=passphrase \
|
||||
-O acltype=posixacl \
|
||||
-O xattr=sa \
|
||||
@@ -85,8 +85,8 @@ fi
|
||||
-O canmount=off \
|
||||
-O mountpoint=/ \
|
||||
-R /mnt \
|
||||
${HOSTNAME,,} \
|
||||
${DISK}${PART3}
|
||||
${hostname,,} \
|
||||
${disk}${part3}
|
||||
else
|
||||
zpool create \
|
||||
-o ashift=12 \
|
||||
@@ -102,42 +102,42 @@ fi
|
||||
-O canmount=off \
|
||||
-O mountpoint=/ \
|
||||
-R /mnt \
|
||||
${HOSTNAME,,} \
|
||||
${DISK}${PART3}
|
||||
${hostname,,} \
|
||||
${disk}${part3}
|
||||
fi
|
||||
|
||||
zfs create \
|
||||
-o canmount=off \
|
||||
-o mountpoint=none \
|
||||
${HOSTNAME,,}/ROOT
|
||||
${hostname,,}/ROOT
|
||||
# else
|
||||
# zpool import \
|
||||
# -N \
|
||||
# -R \
|
||||
# /mnt \
|
||||
# ${HOSTNAME,,}
|
||||
# ${hostname,,}
|
||||
#
|
||||
# zfs load-key \
|
||||
# -r \
|
||||
# -L prompt \
|
||||
# ${HOSTNAME,,}
|
||||
# ${hostname,,}
|
||||
# fi
|
||||
|
||||
zfs create \
|
||||
-o canmount=noauto \
|
||||
-o mountpoint=/ \
|
||||
${HOSTNAME,,}/ROOT/${ID}
|
||||
${hostname,,}/ROOT/${ID}
|
||||
|
||||
zfs mount \
|
||||
${HOSTNAME,,}/ROOT/${ID}
|
||||
${hostname,,}/ROOT/${ID}
|
||||
|
||||
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||
zfs create \
|
||||
${HOSTNAME,,}/home
|
||||
${hostname,,}/home
|
||||
|
||||
zfs create \
|
||||
-o mountpoint=/root \
|
||||
${HOSTNAME,,}/home/root
|
||||
${hostname,,}/home/root
|
||||
|
||||
chmod \
|
||||
700 \
|
||||
@@ -146,29 +146,29 @@ zfs mount \
|
||||
zfs create \
|
||||
-o canmount=off \
|
||||
-o mountpoint=/var \
|
||||
${HOSTNAME,,}/var
|
||||
${hostname,,}/var
|
||||
|
||||
zfs create \
|
||||
-o canmount=off \
|
||||
${HOSTNAME,,}/var/lib
|
||||
${hostname,,}/var/lib
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/log
|
||||
${hostname,,}/var/log
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/spool
|
||||
${hostname,,}/var/spool
|
||||
|
||||
zfs create \
|
||||
-o com.sun:auto-snapshot=false \
|
||||
${HOSTNAME,,}/var/cache
|
||||
${hostname,,}/var/cache
|
||||
|
||||
zfs create \
|
||||
-o com.sun:auto-snapshot=false \
|
||||
${HOSTNAME,,}/var/lib/nfs
|
||||
${hostname,,}/var/lib/nfs
|
||||
|
||||
zfs create \
|
||||
-o com.sun:auto-snapshot=false \
|
||||
${HOSTNAME,,}/var/tmp
|
||||
${hostname,,}/var/tmp
|
||||
|
||||
chmod \
|
||||
1777 \
|
||||
@@ -176,99 +176,121 @@ zfs mount \
|
||||
|
||||
zfs create \
|
||||
-o mountpoint=/srv \
|
||||
${HOSTNAME,,}/srv
|
||||
${hostname,,}/srv
|
||||
|
||||
zfs create \
|
||||
-o canmount=off \
|
||||
-o mountpoint=/usr \
|
||||
${HOSTNAME,,}/usr
|
||||
${hostname,,}/usr
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/usr/local
|
||||
${hostname,,}/usr/local
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/games
|
||||
${hostname,,}/var/games
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/lib/AccountsService
|
||||
${hostname,,}/var/lib/AccountsService
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/lib/NetworkManager
|
||||
${hostname,,}/var/lib/NetworkManager
|
||||
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/www
|
||||
${hostname,,}/var/www
|
||||
|
||||
zfs create \
|
||||
-o com.sun:auto-snapshot=false \
|
||||
-o mountpoint=/tmp \
|
||||
${HOSTNAME,,}/tmp
|
||||
${hostname,,}/tmp
|
||||
|
||||
if [[ "${ENCRYPTION}" == 'yes' ]]; then
|
||||
if [[ "${encryption}" == 'yes' ]]; then
|
||||
zfs create \
|
||||
-o com.sun:auto-snapshot=false \
|
||||
-o mountpoint=/etc/zfs/keys \
|
||||
${HOSTNAME,,}/keystore
|
||||
${hostname,,}/keystore
|
||||
fi
|
||||
|
||||
zpool set \
|
||||
bootfs=${HOSTNAME,,}/ROOT/${ID} \
|
||||
${HOSTNAME,,}
|
||||
bootfs=${hostname,,}/ROOT/${ID} \
|
||||
${hostname,,}
|
||||
# else
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/home
|
||||
# ${hostname,,}/home
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/home/root
|
||||
# ${hostname,,}/home/root
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/log
|
||||
# ${hostname,,}/var/log
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/spool
|
||||
# ${hostname,,}/var/spool
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/cache
|
||||
# ${hostname,,}/var/cache
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/lib/nfs
|
||||
# ${hostname,,}/var/lib/nfs
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/tmp
|
||||
# ${hostname,,}/var/tmp
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/srv
|
||||
# ${hostname,,}/srv
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/usr/local
|
||||
# ${hostname,,}/usr/local
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/games
|
||||
# ${hostname,,}/var/games
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/lib/AccountsService
|
||||
# ${hostname,,}/var/lib/AccountsService
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/lib/NetworkManager
|
||||
# ${hostname,,}/var/lib/NetworkManager
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/www
|
||||
# ${hostname,,}/var/www
|
||||
#
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/keystore
|
||||
# ${hostname,,}/keystore
|
||||
# fi
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
"${BASEDIR}/base-fedora.sh" -1
|
||||
"${baseDir}/fedora.sh" -1
|
||||
fi
|
||||
|
||||
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||
zfs create \
|
||||
${HOSTNAME,,}/var/mail
|
||||
${hostname,,}/var/mail
|
||||
|
||||
chmod \
|
||||
1777 \
|
||||
/mnt/tmp
|
||||
# else
|
||||
# zfs mount \
|
||||
# ${HOSTNAME,,}/var/mail
|
||||
# ${hostname,,}/var/mail
|
||||
# fi
|
||||
|
||||
if [[ "${1}" == '--key' ]]; then
|
||||
cp \
|
||||
/etc/zfs/keys/${hostname,,}.key \
|
||||
/mnt/etc/zfs/keys/
|
||||
elif [[ "${1}" == '--unmount' ]]; then
|
||||
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -I {} umount -Rlf {}
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
umount \
|
||||
-nR \
|
||||
/mnt
|
||||
fi
|
||||
|
||||
zpool \
|
||||
export \
|
||||
-a
|
||||
elif [[ "${1}" == '--host-id' ]]; then
|
||||
zgenhostid \
|
||||
-f \
|
||||
0x00bab10c
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user