Compare commits
55 Commits
mmdebstrap
...
feb638b9f1
| Author | SHA1 | Date | |
|---|---|---|---|
|
feb638b9f1
|
|||
|
4d223b8815
|
|||
|
a918ccf2e7
|
|||
|
568c80a05e
|
|||
|
00fe875b44
|
|||
|
8414563171
|
|||
|
30b3b58336
|
|||
|
3e4eeb7d37
|
|||
|
8305fa16cd
|
|||
|
16018759fb
|
|||
|
2028fa4396
|
|||
|
637f5b69db
|
|||
|
3902f873e9
|
|||
|
8bca55e467
|
|||
|
377d56b1cd
|
|||
|
9c8add89e5
|
|||
|
648d07f355
|
|||
|
f44f7464b9
|
|||
|
ec2d8148e0
|
|||
|
2139685f77
|
|||
|
58231de76b
|
|||
|
16bec76758
|
|||
|
6f99804427
|
|||
|
31b2c3579c
|
|||
|
e35e7d6f59
|
|||
|
eb74132f81
|
|||
|
d80992da00
|
|||
|
0b033e852c
|
|||
|
82871fc03a
|
|||
|
33fdebcd19
|
|||
|
8fd8e139b1
|
|||
|
3acf1af161
|
|||
|
e513fe2c60
|
|||
|
8a78dd7f96
|
|||
|
bee95926b7
|
|||
|
67763d1b39
|
|||
|
203a09eb05
|
|||
|
5b4a77f615
|
|||
|
939359b94e
|
|||
|
12beaaf5d2
|
|||
|
211a0413f5
|
|||
|
7ba4a4f60f
|
|||
|
328b02a294
|
|||
|
a36854c208
|
|||
|
6268d684c6
|
|||
|
ee48fb7560
|
|||
|
bba89f8185
|
|||
|
802fa4f3c8
|
|||
|
26f59f4a91
|
|||
|
ae6fc22074
|
|||
|
7244296734
|
|||
|
817653120c
|
|||
|
33435e5903
|
|||
|
62861d8c7b
|
|||
|
7442994d18
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
archive.sh
|
archive.sh
|
||||||
system.conf
|
system.conf
|
||||||
|
*kate-swp
|
||||||
|
|||||||
128
README.md
128
README.md
@@ -1,118 +1,18 @@
|
|||||||
# ZFSBootMenu Root Install
|
# ZFSBootMenu Root Install
|
||||||
|
|
||||||
## Intro
|
## (Re)Design Document
|
||||||
|
|
||||||
Well howdy!
|
The purpose of this branch is to modularize as many functions of the scripts as possible, i.e. by moving all Debian related commands into the Debian-specific script, move all EFI related commands into its own script, etc.
|
||||||
|
|
||||||
Welcome to the ZFSBootMenu Root Install script!
|
## Checklist
|
||||||
|
[X] Rename all `base-` scripts to remove `base-`
|
||||||
This here script is designed to install (currently) either Debian or Fedora
|
[ ] Move (at least almost) all Debian related commands and tasks to `debian.sh`
|
||||||
with OpenZFS as the root filesystem, and utilize ZFSBootMenu for actually
|
[ ] Move (at least almost) all Fedora related commands and tasks to `fedora.sh`
|
||||||
getting the system up and running (as opposed to i.e. GRUB2 or systemd-bootd)
|
[ ] 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`)
|
||||||
Some of the benefits of this setup include:
|
[X] Move all EFI related commands and tasks to a new `efi.sh` script
|
||||||
- Having a reliable copy-on-write (CoW) filesystem
|
[X] Rename `mkfs.zfs.sh` to `zfs.sh`
|
||||||
- Being able to easily create and rollback to snapshots from either the OS or ZFSBootMenu
|
[ ] Point any distro-specific commands/tasks that are shared with Debian to use `debian.sh` to avoid any unnecessary duplication
|
||||||
- Easy backups by sending/receiving snapshots to local or remote locations, including being able to do a "raw send", where the data being sent is the raw encrypted data without the decryption key, useful for backing up to third-party backup services
|
[ ] Rewrite `README.md`
|
||||||
- Having multiple version of an OS installed on the system via different root datasets (i.e. stable and testing versions, old and new versions, etc.)
|
[ ] 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}")`
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
**! THESE SCRIPTS ARE TO BE RUN ON THE LIVE MEDIUM OF THE OS YOU INTEND ON
|
|
||||||
INSTALLING AND AS THE ROOT USER !**
|
|
||||||
|
|
||||||
To use this script, you run the `menu.sh` script, and use its, well, menu to
|
|
||||||
go step by step through installing the OS you wish to have on your PC
|
|
||||||
|
|
||||||
The steps are as follows, and will be expanded on throughout this document:
|
|
||||||
- List
|
|
||||||
- Configure
|
|
||||||
- Partition
|
|
||||||
- Install
|
|
||||||
- Post Install
|
|
||||||
- Finalize
|
|
||||||
- WiFi Setup
|
|
||||||
|
|
||||||
|
|
||||||
## List
|
|
||||||
|
|
||||||
This lists all currently connected storage devices and network interfaces of the system
|
|
||||||
|
|
||||||
This is handy to know what devices and interfaces were picked up by the OS and the script, and to make sure that everything is "hunky-dory"
|
|
||||||
|
|
||||||
Storage devices are listed seperately for both /dev/ (i.e. sda, sdb), and for /dev/disk/by-id/ (i.e. ata-WD_Blue)
|
|
||||||
|
|
||||||
The latter method (/dev/disk/by-id/) is STRONGLY recommended when selecting the installation disk during configuration, and the former method (/dev/) should only be used in an environment where the latter method is unavailable (i.e. in a virtual machine)
|
|
||||||
|
|
||||||
|
|
||||||
## Configure
|
|
||||||
|
|
||||||
When run, this will guide you through creating a configuration file (system.conf) that is used throughout the script for various tasks
|
|
||||||
|
|
||||||
This includes:
|
|
||||||
- Disk type (SSD or HDD)
|
|
||||||
- Disk to install to
|
|
||||||
- Hostname of the machine
|
|
||||||
- Username of your new user account
|
|
||||||
- Whether to configure SWAP or not (SWAP will be equal to RAM x2)
|
|
||||||
- Whether to use encryption or not (ZFS native encryption is used)
|
|
||||||
|
|
||||||
|
|
||||||
## Partition
|
|
||||||
|
|
||||||
The disk selected during configuration will be completely wiped and
|
|
||||||
partitioned, and formatted with the ZFS filesystem
|
|
||||||
|
|
||||||
Debian or Fedora will be installed via their respective means for this setup (debootstrap for Debian, and an rsync for Fedora)
|
|
||||||
|
|
||||||
If encryption was configured on, you will enter a password for your new zpool during this step
|
|
||||||
|
|
||||||
The partition layout is as such:
|
|
||||||
- A 512MiB partition for EFI
|
|
||||||
- A RAMx2 partition for SWAP (if configured)
|
|
||||||
- A partition for ZFS (remaining space)
|
|
||||||
|
|
||||||
Multiple ZFS datatets are setup from this script, including (but not limited to):
|
|
||||||
- A dataset for the root filesystem (such as to allow multiple OSes)
|
|
||||||
- A dataset for your home directory
|
|
||||||
- A datatset for your config directory
|
|
||||||
- Seperate datasets for /srv, /tmp, /usr, /var, etc.
|
|
||||||
|
|
||||||
After this script has mostly concluded, you will be chrooted into the new installation to continue
|
|
||||||
|
|
||||||
Once the chroot has been exited, everything will be unmounted and the zpool exported
|
|
||||||
|
|
||||||
Afterwards, you will be notified to reboot the machine
|
|
||||||
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
This is where you finish installing the system
|
|
||||||
|
|
||||||
After being chrooted by the partition script, you'll run the menu script again from `/ZFSBootMenu Root Install/menu.sh` and begin this step
|
|
||||||
|
|
||||||
This is where the needed packages are installed, the system gets configured, and ZFSBootMenu is downloaded and EFI entries made
|
|
||||||
|
|
||||||
Exactly what needs doing depends on what OS is being installed (Debian or Fedora)
|
|
||||||
|
|
||||||
After completion, the post install script should be automatically ran
|
|
||||||
|
|
||||||
|
|
||||||
## Post Install
|
|
||||||
|
|
||||||
This is where the datasets for the individual user are created, as well as the user themselves
|
|
||||||
|
|
||||||
When installing Debian, this part will also have you select the desktop environment you wish to install (if any), and setup an APT hook to a script that takes a snapshot before any packages are installed, removed, or upgraded, to allow for easy rollback in the event of a botched package operation
|
|
||||||
|
|
||||||
|
|
||||||
## Finalize
|
|
||||||
|
|
||||||
This part ensures that timedatectl is set properly, as well as locks the root account, and sets up Flathub in user mode for installation of software packaged as Flatpaks
|
|
||||||
|
|
||||||
|
|
||||||
## WiFi Setup
|
|
||||||
|
|
||||||
This part is mostly obsolete
|
|
||||||
|
|
||||||
This script allows for the configuration of a WiFi network from the terminal, in the event that a wired connection is unavailable
|
|
||||||
|
|||||||
17
chroot.sh
Executable file
17
chroot.sh
Executable 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
|
||||||
110
configure.sh
110
configure.sh
@@ -2,13 +2,13 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
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> ##
|
||||||
## ##
|
## ##
|
||||||
@@ -25,17 +25,17 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'ZOL_FEDORA_VER="2-6"\n' | \
|
'zolFedoraVer="2-6"\n' | \
|
||||||
tee \
|
tee \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'(NVMe) SSD or HDD?\n'
|
'(NVMe) SSD or HDD?\n'
|
||||||
select OPTION in 'SSD' 'HDD'
|
select option in 'SSD' 'HDD'
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${option}" in
|
||||||
'SSD'|'HDD')
|
'SSD'|'HDD')
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -47,10 +47,10 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"DISK_TYPE=\"${OPTION}\"\n" | \
|
"diskType=\"${option}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
@@ -59,9 +59,9 @@ printf \
|
|||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\nGet disk from:\n'
|
'\nGet disk from:\n'
|
||||||
select OPTION in '/dev/disk/by-id/' '/dev/'
|
select option in '/dev/disk/by-id/' '/dev/'
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${option}" in
|
||||||
'/dev/disk/by-id/'|'/dev/')
|
'/dev/disk/by-id/'|'/dev/')
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -75,26 +75,26 @@ done
|
|||||||
printf \
|
printf \
|
||||||
'\033[2J\033[H'
|
'\033[2J\033[H'
|
||||||
|
|
||||||
if [[ "${OPTION}" == '/dev/disk/by-id/' ]]; then
|
if [[ "${option}" == '/dev/disk/by-id/' ]]; then
|
||||||
DRIVES="$(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 's|^.*\:[0-5][0-9] ||g; s| -> .*$||g' | tr -d '[:blank:]')"
|
drives="$(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 's|^.*\:[0-5][0-9] ||g; s| -> .*$||g' | tr -d '[:blank:]')"
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\nSelect the disk you want to use:\n'
|
'\nSelect the disk you want to use:\n'
|
||||||
|
|
||||||
DRIVES=( ${DRIVES} )
|
drives=( ${drives} )
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
MENU="@(${DRIVES[0]}"
|
menu="@(${drives[0]}"
|
||||||
|
|
||||||
for ((i=1;i<${#DRIVES[@]};i++)); do
|
for ((i=1;i<${#drives[@]};i++)); do
|
||||||
MENU+="|${DRIVES[$i]}"
|
menu+="|${drives[$i]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
MENU+=")"
|
menu+=")"
|
||||||
|
|
||||||
select DRIVE in "${DRIVES[@]}"
|
select drive in "${drives[@]}"
|
||||||
do
|
do
|
||||||
case ${DRIVE} in
|
case ${drive} in
|
||||||
${MENU})
|
${menu})
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -105,32 +105,32 @@ if [[ "${OPTION}" == '/dev/disk/by-id/' ]]; then
|
|||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"DISK=\"/dev/disk/by-id/${DRIVE}\"\n" | \
|
"disk=\"/dev/disk/by-id/${drive}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
elif [[ "${OPTION}" == '/dev/' ]]; then
|
elif [[ "${option}" == '/dev/' ]]; then
|
||||||
DRIVES="$(lsblk -do name | grep -v 'loop' | grep -v 'sr' | grep -v 'zram' | grep -v 'NAME' | tr -d '[:blank:]')"
|
drives="$(lsblk -do name | grep -v 'loop' | grep -v 'sr' | grep -v 'zram' | grep -v 'NAME' | tr -d '[:blank:]')"
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\nSelect the disk you want to use:\n'
|
'\nSelect the disk you want to use:\n'
|
||||||
|
|
||||||
DRIVES=( ${DRIVES} )
|
drives=( ${drives} )
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
MENU="@(${DRIVES[0]}"
|
menu="@(${drives[0]}"
|
||||||
|
|
||||||
for ((i=1;i<${#DRIVES[@]};i++)); do
|
for ((i=1;i<${#drives[@]};i++)); do
|
||||||
MENU+="|${DRIVES[$i]}"
|
menu+="|${drives[$i]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
MENU+=")"
|
menu+=")"
|
||||||
|
|
||||||
select DRIVE in "${DRIVES[@]}"
|
select drive in "${drives[@]}"
|
||||||
do
|
do
|
||||||
case ${DRIVE} in
|
case ${drive} in
|
||||||
${MENU})
|
${menu})
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -141,10 +141,10 @@ elif [[ "${OPTION}" == '/dev/' ]]; then
|
|||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"DISK=\"/dev/${DRIVE}\"\n" | \
|
"disk=\"/dev/${drive}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
fi
|
fi
|
||||||
@@ -152,52 +152,52 @@ fi
|
|||||||
printf \
|
printf \
|
||||||
'\033[2J\033[H'
|
'\033[2J\033[H'
|
||||||
|
|
||||||
HOSTNAME='-'
|
hostname='-'
|
||||||
|
|
||||||
while [[ "${HOSTNAME}" == '-' ]] || [[ -z "${HOSTNAME}" ]] || [[ "${HOSTNAME}" = *' '* ]] || [[ "${HOSTNAME}" = *_* ]]; do
|
while [[ "${hostname}" == '-' ]] || [[ -z "${hostname}" ]] || [[ "${hostname}" = *' '* ]] || [[ "${hostname}" = *_* ]]; do
|
||||||
printf \
|
printf \
|
||||||
'\nEnter a hostname for this machine (no spaces or underscores):\n'
|
'\nEnter a hostname for this machine (no spaces or underscores):\n'
|
||||||
read \
|
read \
|
||||||
-r \
|
-r \
|
||||||
HOSTNAME
|
hostname
|
||||||
|
|
||||||
if [[ "${HOSTNAME}" = *' '* ]] || [[ "${HOSTNAME}" = *_* ]]; then
|
if [[ "${hostname}" = *' '* ]] || [[ "${hostname}" = *_* ]]; then
|
||||||
printf \
|
printf \
|
||||||
'ERROR:\tNo spaces or underscores in the hostname!\n'
|
'ERROR:\tNo spaces or underscores in the hostname!\n'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"HOSTNAME=\"${HOSTNAME}\"\n" | \
|
"hostname=\"${hostname}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\033[2J\033[H'
|
'\033[2J\033[H'
|
||||||
|
|
||||||
USERNAME='-'
|
username='-'
|
||||||
|
|
||||||
while [[ "${USERNAME}" == '-' ]] || [[ -z "${USERNAME}" ]] || [[ "${USERNAME}" = *' '* ]] || [[ "${USERNAME}" = *[A-Z]* ]]; do
|
while [[ "${username}" == '-' ]] || [[ -z "${username}" ]] || [[ "${username}" = *' '* ]] || [[ "${username}" = *[A-Z]* ]]; do
|
||||||
printf \
|
printf \
|
||||||
'\nEnter a name for the new user account (lowercase, no spaces):\n'
|
'\nEnter a name for the new user account (lowercase, no spaces):\n'
|
||||||
read \
|
read \
|
||||||
-r \
|
-r \
|
||||||
USERNAME
|
username
|
||||||
|
|
||||||
if [[ "${USERNAME}" = *' '* ]] || [[ "${USERNAME}" = *[A-Z]* ]]; then
|
if [[ "${username}" = *' '* ]] || [[ "${username}" = *[A-Z]* ]]; then
|
||||||
printf \
|
printf \
|
||||||
'ERROR:\tNo spaces or uppercase letters in the username!\n'
|
'ERROR:\tNo spaces or uppercase letters in the username!\n'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"USERNAME=\"${USERNAME}\"\n" | \
|
"username=\"${username}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
@@ -206,9 +206,9 @@ printf \
|
|||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\nEnable SWAP?\n'
|
'\nEnable SWAP?\n'
|
||||||
select OPTION in 'yes' 'no'
|
select option in 'yes' 'no'
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${option}" in
|
||||||
'yes'|'no')
|
'yes'|'no')
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -220,10 +220,10 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"ENABLE_SWAP=\"${OPTION}\"\n" | \
|
"enableSwap=\"${option}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
@@ -232,9 +232,9 @@ printf \
|
|||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\nEnable encryption?\n'
|
'\nEnable encryption?\n'
|
||||||
select OPTION in 'yes' 'no'
|
select option in 'yes' 'no'
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${option}" in
|
||||||
'yes'|'no')
|
'yes'|'no')
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -246,10 +246,10 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"ENCRYPTION=\"${OPTION}\"\n" | \
|
"encryption=\"${option}\"\n" | \
|
||||||
tee \
|
tee \
|
||||||
--append \
|
--append \
|
||||||
"${BASEDIR}/system.conf" \
|
"${baseDir}/system.conf" \
|
||||||
&> \
|
&> \
|
||||||
/dev/null
|
/dev/null
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ printf \
|
|||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
Configuration stored in '${BASEDIR}/system.conf'
|
Configuration stored in '${baseDir}/system.conf'
|
||||||
|
|
||||||
Press any key to return to the main menu
|
Press any key to return to the main menu
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
179
debian.sh
Executable file
179
debian.sh
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
source \
|
||||||
|
/etc/os-release
|
||||||
|
source \
|
||||||
|
"${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 \
|
||||||
|
systemd-timesyncd \
|
||||||
|
whois \
|
||||||
|
zfsutils-linux
|
||||||
|
elif [[ "${1}" == '--mmdebstrap' ]]; then
|
||||||
|
packages=(\
|
||||||
|
console-setup \
|
||||||
|
cryptsetup \
|
||||||
|
curl \
|
||||||
|
dosfstools \
|
||||||
|
dpkg-dev \
|
||||||
|
efibootmgr \
|
||||||
|
ethtool \
|
||||||
|
firmware-{ast,atheros,bnx{2,2x},brcm80211,iwlwifi,libertas,linux,realtek,zd1211} \
|
||||||
|
flatpak \
|
||||||
|
keyboard-configuration \
|
||||||
|
linux-{headers,image}-amd64 \
|
||||||
|
locales \
|
||||||
|
nano \
|
||||||
|
network-manager \
|
||||||
|
openssh-{client,server} \
|
||||||
|
popularity-contest \
|
||||||
|
printer-driver-all \
|
||||||
|
systemd-timesyncd \
|
||||||
|
tasksel \
|
||||||
|
zfs-initramfs \
|
||||||
|
zstd\
|
||||||
|
)
|
||||||
|
|
||||||
|
include="--include=${packages[0]}"
|
||||||
|
|
||||||
|
for ((i=1;i<${#packages[@]};i++)); do
|
||||||
|
include+=" --include=${packages[${i}]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
mmdebstrap \
|
||||||
|
--skip=check/empty \
|
||||||
|
--components=main,non-free-firmware,contrib \
|
||||||
|
--mode=root \
|
||||||
|
--format=directory \
|
||||||
|
${include} \
|
||||||
|
"${VERSION_CODENAME}" \
|
||||||
|
/mnt
|
||||||
|
elif [[ "${1}" == '--network-interfaces' ]]; then
|
||||||
|
networkInterface=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
for ((i = 0; i < ${#networkInterface[@]}; i++)); do
|
||||||
|
cat << EOF | tee /mnt/etc/network/interfaces.d/${networkInterface[$i]} &> /dev/null
|
||||||
|
allow-hotplug ${networkInterface[$i]}
|
||||||
|
iface ${networkInterface[$i]} inet dhcp
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
elif [[ "${1}" == '--sources' ]]; then
|
||||||
|
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
|
||||||
|
# ${VERSION_CODENAME^}
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://deb.debian.org/debian/
|
||||||
|
Suites: ${VERSION_CODENAME}
|
||||||
|
Components: main non-free-firmware contrib
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
# ${VERSION_CODENAME^} Security
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://deb.debian.org/debian-security/
|
||||||
|
Suites: ${VERSION_CODENAME}-security
|
||||||
|
Components: main non-free-firmware contrib
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
# ${VERSION_CODENAME^} Updates
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://deb.debian.org/debian/
|
||||||
|
Suites: ${VERSION_CODENAME}-updates
|
||||||
|
Components: main non-free-firmware contrib
|
||||||
|
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
|
||||||
61
efi.sh
Executable file
61
efi.sh
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(basename "${0}")")"
|
||||||
|
|
||||||
|
|
||||||
|
source \
|
||||||
|
"${baseDir}/system.conf"
|
||||||
|
|
||||||
|
|
||||||
|
mkdir \
|
||||||
|
-p \
|
||||||
|
/boot/efi/EFI/ZBM
|
||||||
|
|
||||||
|
mkdir \
|
||||||
|
-p \
|
||||||
|
/boot/efi/EFI/BOOT
|
||||||
|
|
||||||
|
curl \
|
||||||
|
--progress-bar \
|
||||||
|
--show-error \
|
||||||
|
--output \
|
||||||
|
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
||||||
|
--location \
|
||||||
|
https://get.zfsbootmenu.org/efi
|
||||||
|
|
||||||
|
rsync \
|
||||||
|
-pogAXtlHrDx \
|
||||||
|
--stats \
|
||||||
|
--info=progress2 \
|
||||||
|
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
||||||
|
/boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI
|
||||||
|
|
||||||
|
rsync \
|
||||||
|
-pogAXtlHrDx \
|
||||||
|
--stats \
|
||||||
|
--info=progress2 \
|
||||||
|
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
||||||
|
/boot/efi/EFI/BOOT/BOOTX64.EFI
|
||||||
|
|
||||||
|
rsync \
|
||||||
|
-pogAXtlHrDx \
|
||||||
|
--stats \
|
||||||
|
--info=progress2 \
|
||||||
|
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
||||||
|
/boot/efi/EFI/BOOT/shellx64.efi
|
||||||
|
|
||||||
|
efibootmgr \
|
||||||
|
-c \
|
||||||
|
-d "${disk}" \
|
||||||
|
-p '1' \
|
||||||
|
-L 'ZFSBootMenu (Backup)' \
|
||||||
|
-l '\EFI\ZBM\VMLINUZ-BACKUP.EFI'
|
||||||
|
|
||||||
|
efibootmgr \
|
||||||
|
-c \
|
||||||
|
-d "${disk}" \
|
||||||
|
-p '1' \
|
||||||
|
-L 'ZFSBootMenu' \
|
||||||
|
-l '\EFI\ZBM\VMLINUZ.EFI'
|
||||||
105
elementary.sh
Executable file
105
elementary.sh
Executable file
@@ -0,0 +1,105 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
source \
|
||||||
|
/etc/os-release
|
||||||
|
source \
|
||||||
|
"${baseDir}/system.conf"
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "${1}" == '--mmdebstrap' ]]; then
|
||||||
|
packages=(\
|
||||||
|
console-setup \
|
||||||
|
cryptsetup \
|
||||||
|
curl \
|
||||||
|
dosfstools \
|
||||||
|
dpkg-dev \
|
||||||
|
efibootmgr \
|
||||||
|
ethtool \
|
||||||
|
flatpak \
|
||||||
|
keyboard-configuration \
|
||||||
|
linux-generic \
|
||||||
|
locales \
|
||||||
|
nano \
|
||||||
|
network-manager \
|
||||||
|
openssh-{client,server} \
|
||||||
|
popularity-contest \
|
||||||
|
zfs-initramfs \
|
||||||
|
zstd\
|
||||||
|
)
|
||||||
|
|
||||||
|
include="--include=${packages[0]}"
|
||||||
|
|
||||||
|
for ((i=1;i<${#packages[@]};i++)); do
|
||||||
|
include+=" --include=${packages[${i}]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
mmdebstrap \
|
||||||
|
--skip=check/empty \
|
||||||
|
--components=main,restricted,universe,multiverse \
|
||||||
|
--mode=root \
|
||||||
|
--format=directory \
|
||||||
|
${include} \
|
||||||
|
"${UBUNTU_VERSION_CODENAME}" \
|
||||||
|
/mnt
|
||||||
|
elif [[ "${1}" == '--sources' ]]; then
|
||||||
|
cat <<EOF >/mnt/etc/apt/sources.list.d/${UBUNTU_VERSION_CODENAME}.sources
|
||||||
|
# ${UBUNTU_VERSION_CODENAME^}
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://archive.ubuntu.com/ubuntu/
|
||||||
|
Suites: ${UBUNTU_VERSION_CODENAME}
|
||||||
|
Components: main restricted universe multiverse
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
|
|
||||||
|
# ${UBUNTU_VERSION_CODENAME^} Security
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://security.ubuntu.com/ubuntu/
|
||||||
|
Suites: ${UBUNTU_VERSION_CODENAME}-security
|
||||||
|
Components: main restricted universe multiverse
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
|
|
||||||
|
# ${UBUNTU_VERSION_CODENAME^} Updates
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://archive.ubuntu.com/ubuntu/
|
||||||
|
Suites: ${UBUNTU_VERSION_CODENAME}-updates
|
||||||
|
Components: main restricted universe multiverse
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/mnt/etc/apt/sources.list.d/elementary.sources
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: https://ppa.launchpadcontent.net/elementary-os/stable/ubuntu
|
||||||
|
Suites: ${UBUNTU_VERSION_CODENAME}
|
||||||
|
Components: main
|
||||||
|
Signed-By: /etc/apt/trusted.gpg.d/elementary.key.asc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/mnt/etc/apt/sources.list.d/patches.sources
|
||||||
|
Enabled: yes
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: https://ppa.launchpadcontent.net/elementary-os/os-patches/ubuntu
|
||||||
|
Suites: ${UBUNTU_VERSION_CODENAME}
|
||||||
|
Components: main
|
||||||
|
Signed-By: /etc/apt/trusted.gpg.d/patches.key.asc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm /mnt/etc/apt/sources.list
|
||||||
|
elif [[ "${1}" == '--skel' ]]; then
|
||||||
|
rsync -pogAXtlHrDx \
|
||||||
|
/etc/skel \
|
||||||
|
/mnt/etc
|
||||||
|
elif [[ "${1}" == '--elementary' ]]; then
|
||||||
|
cp \
|
||||||
|
/etc/os-release \
|
||||||
|
/mnt/etc
|
||||||
|
|
||||||
|
cp \
|
||||||
|
/etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \
|
||||||
|
/mnt/etc/apt/trusted.gpg.d/
|
||||||
|
fi
|
||||||
62
fedora.sh
Executable file
62
fedora.sh
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
source \
|
||||||
|
/etc/os-release
|
||||||
|
source \
|
||||||
|
"${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
|
||||||
|
elif [[ "${1}" == '--rsync' ]]; then
|
||||||
|
mkdir -p /run/install
|
||||||
|
|
||||||
|
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||||
|
mount /dev/mapper/live-base /run/install
|
||||||
|
else
|
||||||
|
mount /dev/live-base /run/install
|
||||||
|
fi
|
||||||
|
|
||||||
|
rsync -pogAXtlHrDx \
|
||||||
|
--stats \
|
||||||
|
--exclude=/boot/efi/* \
|
||||||
|
--exclude=/etc/machine-id \
|
||||||
|
--info=progress2 \
|
||||||
|
/run/install/ /mnt
|
||||||
|
elif [[ "${1}" == '--resolv-conf' ]]; then
|
||||||
|
mv /mnt/etc/resolv.conf \
|
||||||
|
/mnt/etc/resolv.conf.orig
|
||||||
|
|
||||||
|
cp -L \
|
||||||
|
/etc/resolv.conf \
|
||||||
|
/mnt/etc
|
||||||
|
elif [[ "${1}" == '-3' ]]; then
|
||||||
|
#
|
||||||
|
fi
|
||||||
59
home-fix-setup.sh
Executable file
59
home-fix-setup.sh
Executable 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
Executable file
7
host-id.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
cp \
|
||||||
|
/etc/hostid \
|
||||||
|
/mnt/etc/
|
||||||
9
hostname.sh
Executable file
9
hostname.sh
Executable 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
|
||||||
190
install.sh
190
install.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
baseDir="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\033[?47l\012'
|
'\033[?47l\012'
|
||||||
@@ -9,7 +9,7 @@ printf \
|
|||||||
cat << EOF
|
cat << EOF
|
||||||
#######################################
|
#######################################
|
||||||
## ##
|
## ##
|
||||||
## $(cat "${BASEDIR}/title") Script ##
|
## $(cat "${baseDir}/title") Script ##
|
||||||
## ##
|
## ##
|
||||||
## Jean <jean@easthighnerd.net> ##
|
## Jean <jean@easthighnerd.net> ##
|
||||||
## ##
|
## ##
|
||||||
@@ -27,26 +27,23 @@ EOF
|
|||||||
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
|
||||||
PART1='p1'
|
part1='p1'
|
||||||
PART2='p2'
|
part2='p2'
|
||||||
else
|
else
|
||||||
PART1='1'
|
part1='1'
|
||||||
PART2='2'
|
part2='2'
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PART1='-part1'
|
part1='-part1'
|
||||||
PART2='-part2'
|
part2='-part2'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f "/etc/mtab" ]]; then
|
if [[ ! -f "/etc/mtab" ]]; then
|
||||||
ln \
|
"${baseDir}/mtab.sh"
|
||||||
-s \
|
|
||||||
/proc/self/mounts \
|
|
||||||
/etc/mtab
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||||
@@ -60,7 +57,7 @@ if [[ "${ID}" == 'fedora' ]]; then
|
|||||||
nofsck="yes"
|
nofsck="yes"
|
||||||
add_dracutmodules+=" zfs "
|
add_dracutmodules+=" zfs "
|
||||||
omit_dracutmodules+=" btrfs "
|
omit_dracutmodules+=" btrfs "
|
||||||
install_items+=" /etc/zfs/keys/${HOSTNAME,,}.key "
|
install_items+=" /etc/zfs/keys/${hostname,,}.key "
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
cat <<EOF >/etc/dracut.conf.d/zol.conf
|
cat <<EOF >/etc/dracut.conf.d/zol.conf
|
||||||
@@ -69,49 +66,7 @@ add_dracutmodules+=" zfs "
|
|||||||
omit_dracutmodules+=" btrfs "
|
omit_dracutmodules+=" btrfs "
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
apt \
|
|
||||||
install \
|
|
||||||
--yes \
|
|
||||||
--no-install-recommends \
|
|
||||||
console-setup \
|
|
||||||
cryptsetup \
|
|
||||||
curl \
|
|
||||||
dpkg-dev \
|
|
||||||
efibootmgr \
|
|
||||||
ethtool \
|
|
||||||
flatpak \
|
|
||||||
keyboard-configuration \
|
|
||||||
linux-generic \
|
|
||||||
locales \
|
|
||||||
nano \
|
|
||||||
network-manager \
|
|
||||||
openssh-{client,server} \
|
|
||||||
popularity-contest
|
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
|
||||||
apt \
|
|
||||||
install \
|
|
||||||
--yes \
|
|
||||||
console-setup \
|
|
||||||
cryptsetup \
|
|
||||||
curl \
|
|
||||||
dpkg-dev \
|
|
||||||
efibootmgr \
|
|
||||||
ethtool \
|
|
||||||
firmware-{ast,atheros,bnx{2,2x},brcm80211,ipw2x00,iwlwifi,libertas,linux,realtek,zd1211} \
|
|
||||||
flatpak \
|
|
||||||
keyboard-configuration \
|
|
||||||
linux-{headers,image}-amd64 \
|
|
||||||
locales \
|
|
||||||
nano \
|
|
||||||
network-manager \
|
|
||||||
openssh-{client,server} \
|
|
||||||
popularity-contest \
|
|
||||||
printer-driver-all \
|
|
||||||
tasksel
|
|
||||||
elif [[ "${ID}" == 'fedora' ]]; then
|
|
||||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||||
dnf \
|
dnf \
|
||||||
config-manager \
|
config-manager \
|
||||||
@@ -155,59 +110,21 @@ elif [[ "${ID}" == 'fedora' ]]; then
|
|||||||
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
|
|
||||||
|
|
||||||
apt install \
|
|
||||||
--yes \
|
|
||||||
dosfstools \
|
|
||||||
systemd-timesyncd \
|
|
||||||
zfs-initramfs
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]]; then
|
# if [[ "${ID}" == 'debian' ]]; then
|
||||||
printf \
|
# printf \
|
||||||
'REMAKE_INITRD=yes\n' | \
|
# 'REMAKE_INITRD=yes\n' | \
|
||||||
tee /etc/dkms/zfs.conf &> /dev/null
|
# tee /etc/dkms/zfs.conf &> /dev/null
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
mkdosfs \
|
"${baseDir}/partition.sh" --efi
|
||||||
-F 32 \
|
|
||||||
-s 1 \
|
|
||||||
-n EFI \
|
|
||||||
${DISK}${PART1}
|
|
||||||
fi
|
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 \
|
"${baseDir}/debian.sh" --purge-os-prober
|
||||||
purge \
|
|
||||||
--yes \
|
|
||||||
os-prober
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
@@ -223,9 +140,9 @@ passwd
|
|||||||
printf \
|
printf \
|
||||||
'\033[?47l'
|
'\033[?47l'
|
||||||
|
|
||||||
if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
if [[ "${enableSwap}" == "yes" ]]; then
|
||||||
printf \
|
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
|
tee /etc/crypttab &> /dev/null
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
@@ -234,14 +151,7 @@ if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
|||||||
fi
|
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
|
||||||
@@ -261,59 +171,19 @@ fi
|
|||||||
zfs \
|
zfs \
|
||||||
set \
|
set \
|
||||||
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
|
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
|
||||||
${HOSTNAME,,}/ROOT/${ID}
|
${hostname,,}/ROOT/${ID}
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
if [[ ! -z "$(zfs list | grep 'keystore')" ]]; then
|
if [[ ! -z "$(zfs list | grep 'keystore')" ]]; then
|
||||||
zfs \
|
zfs \
|
||||||
set \
|
set \
|
||||||
org.zfsbootmenu:keysource=${HOSTNAME,,}/keystore \
|
org.zfsbootmenu:keysource=${hostname,,}/keystore \
|
||||||
${HOSTNAME,,}
|
${hostname,,}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
mkdir \
|
"${baseDir}/efi.sh"
|
||||||
-p \
|
|
||||||
/boot/efi/EFI/ZBM
|
|
||||||
|
|
||||||
mkdir \
|
|
||||||
-p \
|
|
||||||
/boot/efi/EFI/BOOT
|
|
||||||
|
|
||||||
curl \
|
|
||||||
--progress-bar \
|
|
||||||
--show-error \
|
|
||||||
--output \
|
|
||||||
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
|
||||||
--location \
|
|
||||||
https://get.zfsbootmenu.org/efi
|
|
||||||
|
|
||||||
cp \
|
|
||||||
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
|
||||||
/boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI
|
|
||||||
|
|
||||||
cp \
|
|
||||||
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
|
||||||
/boot/efi/EFI/BOOT/BOOTX64.EFI
|
|
||||||
|
|
||||||
cp \
|
|
||||||
/boot/efi/EFI/ZBM/VMLINUZ.EFI \
|
|
||||||
/boot/efi/EFI/BOOT/shellx64.efi
|
|
||||||
|
|
||||||
efibootmgr \
|
|
||||||
-c \
|
|
||||||
-d "${DISK}" \
|
|
||||||
-p '1' \
|
|
||||||
-L 'ZFSBootMenu (Backup)' \
|
|
||||||
-l '\EFI\ZBM\VMLINUZ-BACKUP.EFI'
|
|
||||||
|
|
||||||
efibootmgr \
|
|
||||||
-c \
|
|
||||||
-d "${DISK}" \
|
|
||||||
-p '1' \
|
|
||||||
-L 'ZFSBootMenu' \
|
|
||||||
-l '\EFI\ZBM\VMLINUZ.EFI'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||||
@@ -333,6 +203,6 @@ fi
|
|||||||
|
|
||||||
zfs \
|
zfs \
|
||||||
snapshot \
|
snapshot \
|
||||||
${HOSTNAME,,}/ROOT/${ID}@install
|
${hostname,,}/ROOT/${ID}@install
|
||||||
|
|
||||||
"${BASEDIR}/post-inst.sh"
|
"${baseDir}/post-inst.sh"
|
||||||
|
|||||||
8
menu.sh
8
menu.sh
@@ -26,10 +26,10 @@ while [[ ! "${OPTION}" == 'Exit' ]]; do
|
|||||||
#################
|
#################
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
select OPTION in 'List' 'Configure' 'Partition' 'Install' 'WiFi Setup' 'Post Install' 'Finalize' 'Exit'
|
select OPTION in 'List' 'Configure' 'Pre Install' 'Install' 'WiFi Setup' 'Post Install' 'Finalize' 'Exit'
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${OPTION}" in
|
||||||
'List'|'Configure'|'Partition'|'Install'|'WiFi Setup'|'Post Install'|'Finalize'|'Exit')
|
'List'|'Configure'|'Pre Install'|'Install'|'WiFi Setup'|'Post Install'|'Finalize'|'Exit')
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -44,8 +44,8 @@ EOF
|
|||||||
"${BASEDIR}/list.sh"
|
"${BASEDIR}/list.sh"
|
||||||
elif [[ "${OPTION}" == 'Configure' ]]; then
|
elif [[ "${OPTION}" == 'Configure' ]]; then
|
||||||
"${BASEDIR}/configure.sh"
|
"${BASEDIR}/configure.sh"
|
||||||
elif [[ "${OPTION}" == 'Partition' ]]; then
|
elif [[ "${OPTION}" == 'Pre Install' ]]; then
|
||||||
"${BASEDIR}/partition.sh"
|
"${BASEDIR}/pre-inst.sh"
|
||||||
elif [[ "${OPTION}" == 'Install' ]]; then
|
elif [[ "${OPTION}" == 'Install' ]]; then
|
||||||
"${BASEDIR}/install.sh"
|
"${BASEDIR}/install.sh"
|
||||||
elif [[ "${OPTION}" == 'WiFi Setup' ]]; then
|
elif [[ "${OPTION}" == 'WiFi Setup' ]]; then
|
||||||
|
|||||||
17
mkdir-tmpfs.sh
Executable file
17
mkdir-tmpfs.sh
Executable 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
Executable file
8
mtab.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
ln \
|
||||||
|
-s \
|
||||||
|
/proc/self/mounts \
|
||||||
|
/etc/mtab
|
||||||
588
partition.sh
588
partition.sh
@@ -3,593 +3,81 @@ set -euo pipefail
|
|||||||
|
|
||||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
||||||
|
|
||||||
printf \
|
|
||||||
'\033[?47l\012'
|
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
#######################################
|
|
||||||
## ##
|
|
||||||
## $(cat "${BASEDIR}/title") Script ##
|
|
||||||
## ##
|
|
||||||
## Jean <jean@easthighnerd.net> ##
|
|
||||||
## ##
|
|
||||||
#######################################
|
|
||||||
|
|
||||||
|
|
||||||
#################
|
|
||||||
## ##
|
|
||||||
## Partition ##
|
|
||||||
## ##
|
|
||||||
#################
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]]; then
|
|
||||||
if [[ ! "${HOST}" == "debian-live" ]]; then
|
|
||||||
cat << EOF | tee /mnt/etc/apt/sources.list.d/contrib.sources &> /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 \
|
|
||||||
org.gnome.desktop.media-handling \
|
|
||||||
automount \
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]]; then
|
|
||||||
apt \
|
|
||||||
update && \
|
|
||||||
apt \
|
|
||||||
install \
|
|
||||||
--yes \
|
|
||||||
debootstrap \
|
|
||||||
gdisk \
|
|
||||||
zfsutils-linux \
|
|
||||||
systemd-timesyncd
|
|
||||||
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-${ZOL_FEDORA_VER}$(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
|
|
||||||
|
|
||||||
timedatectl
|
|
||||||
|
|
||||||
if [[ ! "${HOST}" == "debian-live" ]]; then
|
|
||||||
zgenhostid \
|
|
||||||
-f \
|
|
||||||
0x00bab10c
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
swapoff \
|
swapoff \
|
||||||
--all
|
--all
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
wipefs \
|
||||||
wipefs \
|
|
||||||
-a \
|
-a \
|
||||||
${DISK}
|
${disk}
|
||||||
|
|
||||||
if [[ ! "${DISK_TYPE}" == 'HDD' ]]; then
|
if [[ ! "${diskType}" == 'HDD' ]]; then
|
||||||
blkdiscard \
|
blkdiscard \
|
||||||
-f \
|
-f \
|
||||||
${DISK}
|
${disk}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sgdisk \
|
sgdisk \
|
||||||
--zap-all \
|
--zap-all \
|
||||||
${DISK}
|
${disk}
|
||||||
|
|
||||||
sgdisk \
|
sgdisk \
|
||||||
-n1:0:+512M \
|
-n1:0:+512M \
|
||||||
-t1:EF00 \
|
-t1:EF00 \
|
||||||
-c1:EFI \
|
-c1:EFI \
|
||||||
${DISK}
|
${disk}
|
||||||
|
|
||||||
if [[ "${ENABLE_SWAP}" == "yes" ]]; then
|
if [[ "${enableSwap}" == "yes" ]]; then
|
||||||
SWAP_SIZE="$(((($(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))"
|
||||||
|
|
||||||
sgdisk \
|
if [[ "${swapSize#}" -gt '32' ]]; then
|
||||||
-n2:0:+${SWAP_SIZE}G \
|
swapSize='32'
|
||||||
-t2:BF02 \
|
|
||||||
-c2:swap \
|
|
||||||
${DISK}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sgdisk \
|
sgdisk \
|
||||||
|
-n2:0:+${swapSize}G \
|
||||||
|
-t2:BF02 \
|
||||||
|
-c2:swap \
|
||||||
|
${disk}
|
||||||
|
fi
|
||||||
|
|
||||||
|
sgdisk \
|
||||||
-n3:0:0 \
|
-n3:0:0 \
|
||||||
-t3:BF00 \
|
-t3:BF00 \
|
||||||
-c3:${ID} \
|
-c3:${ID} \
|
||||||
${DISK}
|
${disk}
|
||||||
|
|
||||||
sleep 5
|
if [[ "${*}" == *--efi* ]]; then
|
||||||
|
mkdosfs \
|
||||||
if [[ "${ENCRYPTION}" == 'yes' ]]; then
|
-F 32 \
|
||||||
ZPOOL_PASSWORD='A'
|
-s 1 \
|
||||||
ZPOOL_PASSWORD_VERIFY='B'
|
-n EFI \
|
||||||
|
${disk}${part1}
|
||||||
printf \
|
|
||||||
'\033[?47h\033[2J\033[H'
|
|
||||||
|
|
||||||
while [[ ! "${ZPOOL_PASSWORD}" == "${ZPOOL_PASSWORD_VERIFY}" ]] || [[ -z "${ZPOOL_PASSWORD}" ]] || [[ "${#ZPOOL_PASSWORD}" -lt '8' ]]; do
|
|
||||||
printf \
|
|
||||||
"\nEnter a password to encrypt your root pool (minimum 8 characters):\n"
|
|
||||||
read \
|
|
||||||
-r \
|
|
||||||
-s \
|
|
||||||
ZPOOL_PASSWORD
|
|
||||||
|
|
||||||
printf \
|
|
||||||
"\nVerify the password to encrypt your root pool:\n"
|
|
||||||
read \
|
|
||||||
-r \
|
|
||||||
-s \
|
|
||||||
ZPOOL_PASSWORD_VERIFY
|
|
||||||
|
|
||||||
if [[ ! "${ZPOOL_PASSWORD}" == "${ZPOOL_PASSWORD_VERIFY}" ]]; then
|
|
||||||
printf \
|
|
||||||
"ERROR:\tPasswords do not match!\n"
|
|
||||||
elif [[ -z "${ZPOOL_PASSWORD}" ]]; then
|
|
||||||
printf \
|
|
||||||
"ERROR:\tPassword is empty!\n"
|
|
||||||
elif [[ "${#ZPOOL_PASSWORD}" -lt '8' ]]; then
|
|
||||||
printf \
|
|
||||||
"ERROR:\tPassword is too short!\n"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
printf \
|
|
||||||
'\033[?47l'
|
|
||||||
|
|
||||||
mkdir \
|
mkdir \
|
||||||
-p \
|
-p \
|
||||||
/etc/zfs/keys/
|
/boot/efi
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
"${ZPOOL_PASSWORD}\n" | tee /etc/zfs/keys/${HOSTNAME,,}.key &> /dev/null
|
"/dev/disk/by-uuid/$(blkid -s UUID -o value ${disk}${part1}) /boot/efi vfat defaults 0 0\n" | \
|
||||||
|
tee --append /etc/fstab &> /dev/null
|
||||||
|
|
||||||
chmod \
|
sleep 5
|
||||||
000 \
|
|
||||||
/etc/zfs/keys/${HOSTNAME,,}.key
|
|
||||||
|
|
||||||
zpool create \
|
mount \
|
||||||
-o ashift=12 \
|
/boot/efi
|
||||||
-o autotrim=on \
|
|
||||||
-o compatibility=openzfs-2.1-linux \
|
|
||||||
-O encryption=on \
|
|
||||||
-O keylocation=file:///etc/zfs/keys/${HOSTNAME,,}.key \
|
|
||||||
-O keyformat=passphrase \
|
|
||||||
-O acltype=posixacl \
|
|
||||||
-O xattr=sa \
|
|
||||||
-O dnodesize=auto \
|
|
||||||
-O compression=zstd-3 \
|
|
||||||
-O normalization=formD \
|
|
||||||
-O relatime=on \
|
|
||||||
-O canmount=off \
|
|
||||||
-O mountpoint=/ \
|
|
||||||
-R /mnt \
|
|
||||||
${HOSTNAME,,} \
|
|
||||||
${DISK}${PART3}
|
|
||||||
else
|
|
||||||
zpool create \
|
|
||||||
-o ashift=12 \
|
|
||||||
-o autotrim=on \
|
|
||||||
-o compatibility=openzfs-2.1-linux \
|
|
||||||
-O encryption=off \
|
|
||||||
-O acltype=posixacl \
|
|
||||||
-O xattr=sa \
|
|
||||||
-O dnodesize=auto \
|
|
||||||
-O compression=zstd-3 \
|
|
||||||
-O normalization=formD \
|
|
||||||
-O relatime=on \
|
|
||||||
-O canmount=off \
|
|
||||||
-O mountpoint=/ \
|
|
||||||
-R /mnt \
|
|
||||||
${HOSTNAME,,} \
|
|
||||||
${DISK}${PART3}
|
|
||||||
fi
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o canmount=off \
|
|
||||||
-o mountpoint=none \
|
|
||||||
${HOSTNAME,,}/ROOT
|
|
||||||
else
|
|
||||||
zpool import \
|
|
||||||
-N \
|
|
||||||
-R \
|
|
||||||
/mnt \
|
|
||||||
${HOSTNAME,,}
|
|
||||||
|
|
||||||
zfs load-key \
|
|
||||||
-r \
|
|
||||||
-L prompt \
|
|
||||||
${HOSTNAME,,}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o canmount=noauto \
|
|
||||||
-o mountpoint=/ \
|
|
||||||
${HOSTNAME,,}/ROOT/${ID}
|
|
||||||
|
|
||||||
zfs mount \
|
|
||||||
${HOSTNAME,,}/ROOT/${ID}
|
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/home
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o mountpoint=/root \
|
|
||||||
${HOSTNAME,,}/home/root
|
|
||||||
|
|
||||||
chmod \
|
|
||||||
700 \
|
|
||||||
/mnt/root
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o canmount=off \
|
|
||||||
-o mountpoint=/var \
|
|
||||||
${HOSTNAME,,}/var
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o canmount=off \
|
|
||||||
${HOSTNAME,,}/var/lib
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/log
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/spool
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o com.sun:auto-snapshot=false \
|
|
||||||
${HOSTNAME,,}/var/cache
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o com.sun:auto-snapshot=false \
|
|
||||||
${HOSTNAME,,}/var/lib/nfs
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o com.sun:auto-snapshot=false \
|
|
||||||
${HOSTNAME,,}/var/tmp
|
|
||||||
|
|
||||||
chmod \
|
|
||||||
1777 \
|
|
||||||
/mnt/var/tmp
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o mountpoint=/srv \
|
|
||||||
${HOSTNAME,,}/srv
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o canmount=off \
|
|
||||||
-o mountpoint=/usr \
|
|
||||||
${HOSTNAME,,}/usr
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/usr/local
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/games
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/lib/AccountsService
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/lib/NetworkManager
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/www
|
|
||||||
|
|
||||||
zfs create \
|
|
||||||
-o com.sun:auto-snapshot=false \
|
|
||||||
-o mountpoint=/tmp \
|
|
||||||
${HOSTNAME,,}/tmp
|
|
||||||
|
|
||||||
if [[ "${ENCRYPTION}" == 'yes' ]]; then
|
|
||||||
zfs create \
|
|
||||||
-o com.sun:auto-snapshot=false \
|
|
||||||
-o mountpoint=/etc/zfs/keys \
|
|
||||||
${HOSTNAME,,}/keystore
|
|
||||||
fi
|
|
||||||
|
|
||||||
zpool set \
|
|
||||||
bootfs=${HOSTNAME,,}/ROOT/${ID} \
|
|
||||||
${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
|
|
||||||
mkdir -p /run/install
|
|
||||||
|
|
||||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
|
||||||
mount /dev/mapper/live-base /run/install
|
|
||||||
else
|
|
||||||
mount /dev/live-base /run/install
|
|
||||||
fi
|
|
||||||
|
|
||||||
rsync -pogAXtlHrDx \
|
|
||||||
--stats \
|
|
||||||
--exclude=/boot/efi/* \
|
|
||||||
--exclude=/etc/machine-id \
|
|
||||||
--info=progress2 \
|
|
||||||
/run/install/ /mnt
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
|
||||||
zfs create \
|
|
||||||
${HOSTNAME,,}/var/mail
|
|
||||||
|
|
||||||
chmod \
|
|
||||||
1777 \
|
|
||||||
/mnt/tmp
|
|
||||||
else
|
|
||||||
zfs mount \
|
|
||||||
${HOSTNAME,,}/var/mail
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir \
|
|
||||||
-p \
|
|
||||||
/mnt/run
|
|
||||||
|
|
||||||
mount \
|
|
||||||
-t \
|
|
||||||
tmpfs \
|
|
||||||
tmpfs \
|
|
||||||
/mnt/run
|
|
||||||
|
|
||||||
mkdir \
|
|
||||||
-p \
|
|
||||||
/mnt/run/lock
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
debootstrap \
|
|
||||||
"${UBUNTU_VERSION_CODENAME}" \
|
|
||||||
/mnt
|
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
|
||||||
debootstrap \
|
|
||||||
"${VERSION_CODENAME}" \
|
|
||||||
/mnt
|
|
||||||
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
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]]; then
|
|
||||||
NETWORK_INTERFACE=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
for ((i = 0; i < ${#NETWORK_INTERFACE[@]}; i++)); do
|
|
||||||
cat << EOF | tee /mnt/etc/network/interfaces.d/${NETWORK_INTERFACE[$i]} &> /dev/null
|
|
||||||
allow-hotplug ${NETWORK_INTERFACE[$i]}
|
|
||||||
iface ${NETWORK_INTERFACE[$i]} inet dhcp
|
|
||||||
EOF
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
cat <<EOF >/mnt/etc/apt/sources.list
|
|
||||||
deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME} main restricted universe multiverse
|
|
||||||
deb-src http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME} main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://security.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-security main restricted universe multiverse
|
|
||||||
deb-src http://security.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-security main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-updates main restricted universe multiverse
|
|
||||||
deb-src http://archive.ubuntu.com/ubuntu/ ${UBUNTU_VERSION_CODENAME}-updates main restricted universe multiverse
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF >/mnt/etc/apt/sources.list.d/elementary.list
|
|
||||||
deb https://ppa.launchpadcontent.net/elementary-os/stable/ubuntu ${UBUNTU_VERSION_CODENAME} main
|
|
||||||
deb-src https://ppa.launchpadcontent.net/elementary-os/stable/ubuntu ${UBUNTU_VERSION_CODENAME} main
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF >/mnt/etc/apt/sources.list.d/patches.list
|
|
||||||
deb https://ppa.launchpadcontent.net/elementary-os/os-patches/ubuntu ${UBUNTU_VERSION_CODENAME} main
|
|
||||||
deb-src https://ppa.launchpadcontent.net/elementary-os/os-patches/ubuntu ${UBUNTU_VERSION_CODENAME} main
|
|
||||||
EOF
|
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
|
||||||
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
|
|
||||||
# ${VERSION_CODENAME^}
|
|
||||||
Enabled: yes
|
|
||||||
Types: deb deb-src
|
|
||||||
URIs: http://deb.debian.org/debian/
|
|
||||||
Suites: ${VERSION_CODENAME}
|
|
||||||
Components: main non-free-firmware contrib
|
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
||||||
|
|
||||||
# ${VERSION_CODENAME^} Security
|
|
||||||
Enabled: yes
|
|
||||||
Types: deb deb-src
|
|
||||||
URIs: http://deb.debian.org/debian-security/
|
|
||||||
Suites: ${VERSION_CODENAME}-security
|
|
||||||
Components: main non-free-firmware contrib
|
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
||||||
|
|
||||||
# ${VERSION_CODENAME^} Updates
|
|
||||||
Enabled: yes
|
|
||||||
Types: deb deb-src
|
|
||||||
URIs: http://deb.debian.org/debian/
|
|
||||||
Suites: ${VERSION_CODENAME}-updates
|
|
||||||
Components: main non-free-firmware contrib
|
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount \
|
|
||||||
--rbind \
|
|
||||||
/dev \
|
|
||||||
/mnt/dev
|
|
||||||
|
|
||||||
mount \
|
|
||||||
--rbind \
|
|
||||||
/proc \
|
|
||||||
/mnt/proc
|
|
||||||
|
|
||||||
mount \
|
|
||||||
--rbind \
|
|
||||||
/sys \
|
|
||||||
/mnt/sys
|
|
||||||
|
|
||||||
cp \
|
|
||||||
/etc/hostid \
|
|
||||||
/mnt/etc/
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'fedora' ]]; then
|
|
||||||
mv /mnt/etc/resolv.conf \
|
|
||||||
/mnt/etc/resolv.conf.orig
|
|
||||||
|
|
||||||
cp -L \
|
|
||||||
/etc/resolv.conf \
|
|
||||||
/mnt/etc
|
|
||||||
fi
|
|
||||||
|
|
||||||
rsync -pogAXtlHrDx \
|
|
||||||
"${BASEDIR}" \
|
|
||||||
/mnt
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
rsync -pogAXtlHrDx \
|
|
||||||
/etc/skel \
|
|
||||||
/mnt/etc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
|
||||||
if [[ -f "/etc/zfs/keys/${HOSTNAME,,}.key" ]]; then
|
|
||||||
cp \
|
|
||||||
/etc/zfs/keys/${HOSTNAME,,}.key \
|
|
||||||
/mnt/etc/zfs/keys/
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
|
||||||
cp \
|
|
||||||
/etc/os-release \
|
|
||||||
/mnt/etc
|
|
||||||
|
|
||||||
cp \
|
|
||||||
/etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \
|
|
||||||
/mnt/etc/apt/trusted.gpg.d/
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf \
|
|
||||||
"\nNow chrooting into /mnt...\n\n"
|
|
||||||
|
|
||||||
chroot \
|
|
||||||
/mnt \
|
|
||||||
bash \
|
|
||||||
--login
|
|
||||||
|
|
||||||
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 \
|
|
||||||
'\033[?47h\033[2J\033[H'
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
|
|
||||||
Script has finished running
|
|
||||||
|
|
||||||
Please reboot your computer
|
|
||||||
|
|
||||||
Press any key to return to the main menu
|
|
||||||
EOF
|
|
||||||
|
|
||||||
read -srn 1
|
|
||||||
|
|||||||
136
post-inst.sh
136
post-inst.sh
@@ -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> ##
|
||||||
## ##
|
## ##
|
||||||
@@ -32,41 +37,41 @@ source \
|
|||||||
/etc/os-release
|
/etc/os-release
|
||||||
|
|
||||||
source \
|
source \
|
||||||
"${BASEDIR}/system.conf"
|
"${baseDir}/system.conf"
|
||||||
|
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
zfs create\
|
zfs create\
|
||||||
${HOSTNAME,,}/home/${USERNAME}
|
${hostname,,}/home/${username}
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.config
|
${hostname,,}/home/${username}/.config
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
-o canmount=off\
|
-o canmount=off\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.var
|
${hostname,,}/home/${username}/.var
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.var/app
|
${hostname,,}/home/${username}/.var/app
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
-o canmount=off\
|
-o canmount=off\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.local
|
${hostname,,}/home/${username}/.local
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
-o canmount=off\
|
-o canmount=off\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.local/share
|
${hostname,,}/home/${username}/.local/share
|
||||||
|
|
||||||
zfs create\
|
zfs create\
|
||||||
${HOSTNAME,,}/home/${USERNAME}/.local/share/flatpak
|
${hostname,,}/home/${username}/.local/share/flatpak
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'Adding user account...\n'
|
'Adding user account...\n'
|
||||||
|
|
||||||
adduser ${USERNAME}
|
adduser ${username}
|
||||||
else
|
# else
|
||||||
adduser --no-create-home ${USERNAME}
|
# adduser --no-create-home ${username}
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'fedora' ]]; then
|
if [[ "${ID}" == 'fedora' ]]; then
|
||||||
printf \
|
printf \
|
||||||
@@ -77,7 +82,7 @@ if [[ "${ID}" == 'fedora' ]]; then
|
|||||||
Enter a password for the new user account:
|
Enter a password for the new user account:
|
||||||
EOF
|
EOF
|
||||||
passwd \
|
passwd \
|
||||||
${USERNAME}
|
${username}
|
||||||
|
|
||||||
printf \
|
printf \
|
||||||
'\033[?47l'
|
'\033[?47l'
|
||||||
@@ -86,13 +91,17 @@ EOF
|
|||||||
-a \
|
-a \
|
||||||
-G \
|
-G \
|
||||||
audio,cdrom,dip,floppy,wheel,video,dialout \
|
audio,cdrom,dip,floppy,wheel,video,dialout \
|
||||||
${USERNAME}
|
${username}
|
||||||
else
|
else
|
||||||
|
if [[ -z "$(cat /etc/group | grep 'lpadmin')" ]]; then
|
||||||
|
groupadd --gid 108 lpadmin
|
||||||
|
fi
|
||||||
|
|
||||||
usermod \
|
usermod \
|
||||||
-a \
|
-a \
|
||||||
-G \
|
-G \
|
||||||
audio,cdrom,dip,floppy,netdev,plugdev,sudo,video,dialout,lpadmin \
|
audio,cdrom,dip,floppy,netdev,plugdev,sudo,video,dialout,lpadmin \
|
||||||
${USERNAME}
|
${username}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
@@ -111,29 +120,7 @@ Pin: release n=${UBUNTU_VERSION_CODENAME}-backports
|
|||||||
Pin-Priority: -1
|
Pin-Priority: -1
|
||||||
EOF
|
EOF
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
elif [[ "${ID}" == 'debian' ]]; then
|
||||||
cat << EOF | tee /etc/apt/sources.list.d/backports.sources &> /dev/null
|
"${baseDir}/debian.sh" --contrib
|
||||||
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
|
|
||||||
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
|
||||||
@@ -149,15 +136,7 @@ if [[ "${ID}" == 'elementary' ]]; then
|
|||||||
--autoremove \
|
--autoremove \
|
||||||
elementary-desktop
|
elementary-desktop
|
||||||
elif [[ "${ID}" = 'debian' ]]; then
|
elif [[ "${ID}" = 'debian' ]]; then
|
||||||
if [[ ! -f /usr/bin/tasksel ]]; then
|
"${baseDir}/debian.sh" --tasksel
|
||||||
apt \
|
|
||||||
install \
|
|
||||||
--yes \
|
|
||||||
tasksel
|
|
||||||
fi
|
|
||||||
|
|
||||||
tasksel \
|
|
||||||
--new-install
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||||
@@ -193,60 +172,21 @@ EOF
|
|||||||
tee /etc/apt/apt.conf.d/99-apt_moo &> /dev/null
|
tee /etc/apt/apt.conf.d/99-apt_moo &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! "${*}" = *--no-part* ]]; then
|
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
cat << EOF | tee /usr/bin/home-fix.sh &> /dev/null
|
"${baseDir}/home-fix-setup.sh"
|
||||||
#!/bin/bash
|
# fi
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
|
if [[ ! -f '/usr/bin/shutdown' ]]; then
|
||||||
|
ln -s /sbin/shutdown /usr/bin/shutdown
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [[ ! -z "\$(find -P /var/spool/cron | grep 'root')" ]]; then
|
if [[ ! -f '/usr/bin/reboot' ]]; then
|
||||||
rm \$(find -P /var/spool/cron | grep 'root')
|
ln -s /sbin/reboot /usr/bin/reboot
|
||||||
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 /usr/bin/home-fix.sh\n' | \
|
|
||||||
tee /var/spool/cron/root &> /dev/null
|
|
||||||
elif [[ "${ID}" == 'debian' ]]; then
|
|
||||||
printf \
|
|
||||||
'@reboot /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
|
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'
|
||||||
@@ -255,7 +195,7 @@ cat << EOF
|
|||||||
|
|
||||||
Script has finished running
|
Script has finished running
|
||||||
|
|
||||||
Please reboot your computer
|
Please exit the chroot
|
||||||
|
|
||||||
Press any key to return to the main menu
|
Press any key to return to the main menu
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
123
pre-inst.sh
Executable file
123
pre-inst.sh
Executable file
@@ -0,0 +1,123 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
printf \
|
||||||
|
'\033[?47l\012'
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
#######################################
|
||||||
|
## ##
|
||||||
|
## $(cat "${baseDir}/title") Script ##
|
||||||
|
## ##
|
||||||
|
## Jean <jean@easthighnerd.net> ##
|
||||||
|
## ##
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
## ##
|
||||||
|
## Pre ##
|
||||||
|
## Installation ##
|
||||||
|
## ##
|
||||||
|
####################
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
source \
|
||||||
|
/etc/os-release
|
||||||
|
source \
|
||||||
|
"${baseDir}/system.conf"
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -f '/usr/bin/gsettings' ]]; then
|
||||||
|
gsettings \
|
||||||
|
set \
|
||||||
|
org.gnome.desktop.media-handling \
|
||||||
|
automount \
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
"${baseDir}/debian.sh" --live
|
||||||
|
elif [[ "${ID}" == 'fedora' ]]; then
|
||||||
|
"${baseDir}/fedora.sh" --live
|
||||||
|
fi
|
||||||
|
|
||||||
|
timedatectl
|
||||||
|
|
||||||
|
if [[ ! "$(hostname)" == "debian-live" ]]; then
|
||||||
|
"${baseDir}/zfs.sh" --host-id
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
"${baseDir}/partition.sh"
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
"${baseDir}/zfs.sh"
|
||||||
|
|
||||||
|
"${baseDir}/mkdir-tmpfs.sh"
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
"${baseDir}/elementary.sh" --mmdebstrap
|
||||||
|
elif [[ "${ID}" == 'debian' ]]; then
|
||||||
|
"${baseDir}/debian.sh" --mmdebstrap
|
||||||
|
elif [[ "${ID}" == 'fedora' ]]; then
|
||||||
|
"${baseDir}/fedora.sh" --rsync
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${baseDir}/hostname.sh"
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'debian' ]]; then
|
||||||
|
"${baseDir}/debian.sh" --network-interfaces
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
"${baseDir}/elementary.sh" --sources
|
||||||
|
elif [[ "${ID}" == 'debian' ]]; then
|
||||||
|
"${baseDir}/debian.sh" --sources
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${baseDir}/rbind.sh"
|
||||||
|
|
||||||
|
"${baseDir}/host-id.sh"
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'fedora' ]]; then
|
||||||
|
"${baseDir}/fedora.sh" --resolv-conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${baseDir}/rsync.sh"
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
"${baseDir}/elementary.sh" --skel
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
|
if [[ -f "/etc/zfs/keys/${hostname,,}.key" ]]; then
|
||||||
|
"${baseDir}/zfs.sh" --key
|
||||||
|
fi
|
||||||
|
# fi
|
||||||
|
|
||||||
|
if [[ "${ID}" == 'elementary' ]]; then
|
||||||
|
"${baseDir}/elementary.sh" --elementary
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${baseDir}/chroot.sh" --continue
|
||||||
|
|
||||||
|
"${baseDir}/zfs.sh" --unmount
|
||||||
|
|
||||||
|
printf \
|
||||||
|
'\033[?47h\033[2J\033[H'
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Script has finished running
|
||||||
|
|
||||||
|
Please reboot your computer
|
||||||
|
|
||||||
|
Press any key to return to the main menu
|
||||||
|
EOF
|
||||||
|
|
||||||
|
read -srn 1
|
||||||
18
rbind.sh
Executable file
18
rbind.sh
Executable 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
9
rsync.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
|
||||||
|
rsync -pogAXtlHrDx \
|
||||||
|
"${baseDir}" \
|
||||||
|
/mnt
|
||||||
296
zfs.sh
Executable file
296
zfs.sh
Executable file
@@ -0,0 +1,296 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
baseDir="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
|
source \
|
||||||
|
/etc/os-release
|
||||||
|
source \
|
||||||
|
"${baseDir}/system.conf"
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
|
||||||
|
if [[ "${disk}" == **/dev/nvme** ]]; then
|
||||||
|
part3='p3'
|
||||||
|
else
|
||||||
|
part3='3'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
part3='-part3'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
|
if [[ "${encryption}" == 'yes' ]]; then
|
||||||
|
zpoolPassword='A'
|
||||||
|
zpoolPasswordVerify='B'
|
||||||
|
|
||||||
|
printf \
|
||||||
|
'\033[?47h\033[2J\033[H'
|
||||||
|
|
||||||
|
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 \
|
||||||
|
zpoolPassword
|
||||||
|
|
||||||
|
printf \
|
||||||
|
"\nVerify the password to encrypt your root pool:\n"
|
||||||
|
read \
|
||||||
|
-r \
|
||||||
|
-s \
|
||||||
|
zpoolPasswordVerify
|
||||||
|
|
||||||
|
if [[ ! "${zpoolPassword}" == "${zpoolPasswordVerify}" ]]; then
|
||||||
|
printf \
|
||||||
|
"ERROR:\tPasswords do not match!\n"
|
||||||
|
elif [[ -z "${zpoolPassword}" ]]; then
|
||||||
|
printf \
|
||||||
|
"ERROR:\tPassword is empty!\n"
|
||||||
|
elif [[ "${#zpoolPassword}" -lt '8' ]]; then
|
||||||
|
printf \
|
||||||
|
"ERROR:\tPassword is too short!\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf \
|
||||||
|
'\033[?47l'
|
||||||
|
|
||||||
|
mkdir \
|
||||||
|
-p \
|
||||||
|
/etc/zfs/keys/
|
||||||
|
|
||||||
|
printf \
|
||||||
|
"${zpoolPassword}\n" | tee /etc/zfs/keys/${hostname,,}.key &> /dev/null
|
||||||
|
|
||||||
|
chmod \
|
||||||
|
000 \
|
||||||
|
/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 keyformat=passphrase \
|
||||||
|
-O acltype=posixacl \
|
||||||
|
-O xattr=sa \
|
||||||
|
-O dnodesize=auto \
|
||||||
|
-O compression=zstd-3 \
|
||||||
|
-O normalization=formD \
|
||||||
|
-O relatime=on \
|
||||||
|
-O canmount=off \
|
||||||
|
-O mountpoint=/ \
|
||||||
|
-R /mnt \
|
||||||
|
${hostname,,} \
|
||||||
|
${disk}${part3}
|
||||||
|
else
|
||||||
|
zpool create \
|
||||||
|
-o ashift=12 \
|
||||||
|
-o autotrim=on \
|
||||||
|
-o compatibility=openzfs-2.1-linux \
|
||||||
|
-O encryption=off \
|
||||||
|
-O acltype=posixacl \
|
||||||
|
-O xattr=sa \
|
||||||
|
-O dnodesize=auto \
|
||||||
|
-O compression=zstd-3 \
|
||||||
|
-O normalization=formD \
|
||||||
|
-O relatime=on \
|
||||||
|
-O canmount=off \
|
||||||
|
-O mountpoint=/ \
|
||||||
|
-R /mnt \
|
||||||
|
${hostname,,} \
|
||||||
|
${disk}${part3}
|
||||||
|
fi
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o canmount=off \
|
||||||
|
-o mountpoint=none \
|
||||||
|
${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 \
|
||||||
|
${hostname,,}/home
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o mountpoint=/root \
|
||||||
|
${hostname,,}/home/root
|
||||||
|
|
||||||
|
chmod \
|
||||||
|
700 \
|
||||||
|
/mnt/root
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o canmount=off \
|
||||||
|
-o mountpoint=/var \
|
||||||
|
${hostname,,}/var
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o canmount=off \
|
||||||
|
${hostname,,}/var/lib
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/log
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/spool
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o com.sun:auto-snapshot=false \
|
||||||
|
${hostname,,}/var/cache
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o com.sun:auto-snapshot=false \
|
||||||
|
${hostname,,}/var/lib/nfs
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o com.sun:auto-snapshot=false \
|
||||||
|
${hostname,,}/var/tmp
|
||||||
|
|
||||||
|
chmod \
|
||||||
|
1777 \
|
||||||
|
/mnt/var/tmp
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o mountpoint=/srv \
|
||||||
|
${hostname,,}/srv
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o canmount=off \
|
||||||
|
-o mountpoint=/usr \
|
||||||
|
${hostname,,}/usr
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/usr/local
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/games
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/lib/AccountsService
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/lib/NetworkManager
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/www
|
||||||
|
|
||||||
|
zfs create \
|
||||||
|
-o com.sun:auto-snapshot=false \
|
||||||
|
-o mountpoint=/tmp \
|
||||||
|
${hostname,,}/tmp
|
||||||
|
|
||||||
|
if [[ "${encryption}" == 'yes' ]]; then
|
||||||
|
zfs create \
|
||||||
|
-o com.sun:auto-snapshot=false \
|
||||||
|
-o mountpoint=/etc/zfs/keys \
|
||||||
|
${hostname,,}/keystore
|
||||||
|
fi
|
||||||
|
|
||||||
|
zpool set \
|
||||||
|
bootfs=${hostname,,}/ROOT/${ID} \
|
||||||
|
${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
|
||||||
|
"${baseDir}/fedora.sh" -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if [[ ! "${*}" = *--no-part* ]]; then
|
||||||
|
zfs create \
|
||||||
|
${hostname,,}/var/mail
|
||||||
|
|
||||||
|
chmod \
|
||||||
|
1777 \
|
||||||
|
/mnt/tmp
|
||||||
|
# else
|
||||||
|
# zfs mount \
|
||||||
|
# ${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