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

90 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
/etc/os-release
source \
"${baseDir}/system.conf"
printf \
'\033[?47l\012'
cat << EOF
#######################################
## ##
## $(cat "${baseDir}/title") Script ##
## ##
## Jean <jean@easthighnerd.net> ##
## ##
#######################################
####################
## ##
## Post ##
## Installation ##
## ##
####################
EOF
"${baseDir}/zfs.sh" --home
"${baseDir}/adduser.sh"
if [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/elementary.sh" --namarupa
elif [[ "${ID}" == 'debian' ]]; then
"${baseDir}/debian.sh" --contrib
fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
apt \
--update \
dist-upgrade \
--yes
fi
if [[ "${ID}" = 'debian' ]]; then
"${baseDir}/debian.sh" --tasksel
fi
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
"${baseDir}/debian.sh" --logrotate
"${baseDir}/apt-snapshot.sh"
fi
"${baseDir}/home-fix-setup.sh"
if [[ ! -f '/usr/bin/shutdown' ]]; then
ln -s /sbin/shutdown /usr/bin/shutdown
fi
if [[ ! -f '/usr/bin/reboot' ]]; then
ln -s /sbin/reboot /usr/bin/reboot
fi
zfs \
snapshot \
${hostname,,}/ROOT/${ID}@post-install
printf \
'\033[?47h\033[2J\033[H'
cat << EOF
Script has finished running
Please exit the chroot
Press any key to return to the main menu
EOF
read -srn 1