Compare commits
5 Commits
pre-instal
...
0b033e852c
| Author | SHA1 | Date | |
|---|---|---|---|
|
0b033e852c
|
|||
|
82871fc03a
|
|||
|
33fdebcd19
|
|||
|
8fd8e139b1
|
|||
|
3acf1af161
|
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
|
|
||||||
|
|||||||
61
efi.sh
Normal file
61
efi.sh
Normal 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'
|
||||||
50
install.sh
50
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,7 +27,7 @@ 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
|
||||||
@@ -227,47 +227,7 @@ if [[ ! "${*}" = *--no-part* ]]; then
|
|||||||
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
|
||||||
@@ -289,4 +249,4 @@ zfs \
|
|||||||
snapshot \
|
snapshot \
|
||||||
${HOSTNAME,,}/ROOT/${ID}@install
|
${HOSTNAME,,}/ROOT/${ID}@install
|
||||||
|
|
||||||
"${BASEDIR}/post-inst.sh"
|
"${baseDir}/post-inst.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user