179 lines
3.1 KiB
Bash
Executable File
179 lines
3.1 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 [[ "${ID}" == 'debian' ]]; then
|
|
if [[ ! "$(hostname)" == "debian-live" ]]; then
|
|
cat << EOF | tee /etc/apt/sources.list.d/contrib.sources 1> /dev/null
|
|
Enabled: yes
|
|
Types: deb
|
|
URIs: http://deb.debian.org/debian/
|
|
Suites: ${VERSION_CODENAME}
|
|
Components: contrib
|
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
EOF
|
|
fi
|
|
fi
|
|
|
|
|
|
if [[ -f '/usr/bin/gsettings' ]]; then
|
|
gsettings \
|
|
set \
|
|
org.gnome.desktop.media-handling \
|
|
automount \
|
|
false
|
|
fi
|
|
|
|
if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
|
|
apt \
|
|
update && \
|
|
apt \
|
|
install \
|
|
--yes \
|
|
mmdebstrap \
|
|
gdisk \
|
|
systemd-timesyncd \
|
|
whois \
|
|
zfsutils-linux
|
|
elif [[ "${ID}" == 'fedora' ]]; then
|
|
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
|
dnf config-manager \
|
|
--disable \
|
|
updates
|
|
else
|
|
dnf config-manager \
|
|
setopt \
|
|
updates.enabled=0
|
|
fi
|
|
|
|
dnf install \
|
|
-y \
|
|
https://zfsonlinux.org/fedora/zfs-release-${zolFedoraVer}$(rpm --eval "%{dist}").noarch.rpm
|
|
|
|
dnf install \
|
|
-y \
|
|
https://dl.fedoraproject.org/pub/fedora/linux/releases/${VERSION_ID}/Everything/x86_64/os/Packages/k/kernel-devel-$(uname -r).rpm
|
|
|
|
dnf install \
|
|
-y \
|
|
zfs \
|
|
gdisk
|
|
|
|
modprobe \
|
|
zfs
|
|
fi
|
|
|
|
timedatectl
|
|
|
|
if [[ ! "$(hostname)" == "debian-live" ]]; then
|
|
zgenhostid \
|
|
-f \
|
|
0x00bab10c
|
|
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
|
|
|
|
rsync -pogAXtlHrDx \
|
|
"${baseDir}" \
|
|
/mnt
|
|
|
|
if [[ "${ID}" == 'elementary' ]]; then
|
|
"${baseDir}/elementary.sh" --skel
|
|
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
|
|
"${baseDir}/elementary.sh" --elementary
|
|
fi
|
|
|
|
"${baseDir}/chroot.sh" --continue
|
|
|
|
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
|