Files
ZFSBootMenu-Root-Install/pre-inst.sh

128 lines
2.3 KiB
Bash
Executable File

#!/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" --disk
sleep 5
"${baseDir}/zfs.sh" --format
"${baseDir}/zfs.sh" --create
"${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
elif [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --network
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