Rename to gentoo-install
This commit is contained in:
parent
3b551f7509
commit
53a4d1cd37
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/protection.sh" || exit 1
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/internal_config.sh" || exit 1
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/internal_config.sh" || exit 1
|
||||
|
||||
|
||||
################################################
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/protection.sh" || exit 1
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
|
||||
|
||||
|
||||
################################################
|
||||
|
@ -199,21 +199,21 @@ mount_root() {
|
|||
mount_by_partuuid "$PARTITION_UUID_LINUX" "$ROOT_MOUNTPOINT"
|
||||
}
|
||||
|
||||
bind_bootstrap_dir() {
|
||||
bind_repo_dir() {
|
||||
# Use new location by default
|
||||
export GENTOO_BOOTSTRAP_DIR="$GENTOO_BOOTSTRAP_BIND"
|
||||
export GENTOO_INSTALL_REPO_DIR="$GENTOO_INSTALL_REPO_BIND"
|
||||
|
||||
# Bind the bootstrap dir to a location in /tmp,
|
||||
# Bind the repo dir to a location in /tmp,
|
||||
# so it can be accessed from within the chroot
|
||||
mountpoint -q -- "$GENTOO_BOOTSTRAP_BIND" \
|
||||
mountpoint -q -- "$GENTOO_INSTALL_REPO_BIND" \
|
||||
&& return
|
||||
|
||||
# Mount root device
|
||||
einfo "Bind mounting bootstrap directory"
|
||||
mkdir -p "$GENTOO_BOOTSTRAP_BIND" \
|
||||
|| die "Could not create mountpoint directory '$GENTOO_BOOTSTRAP_BIND'"
|
||||
mount --bind "$GENTOO_BOOTSTRAP_DIR_ORIGINAL" "$GENTOO_BOOTSTRAP_BIND" \
|
||||
|| die "Could not bind mount '$GENTOO_BOOTSTRAP_DIR_ORIGINAL' to '$GENTOO_BOOTSTRAP_BIND'"
|
||||
einfo "Bind mounting repo directory"
|
||||
mkdir -p "$GENTOO_INSTALL_REPO_BIND" \
|
||||
|| die "Could not create mountpoint directory '$GENTOO_INSTALL_REPO_BIND'"
|
||||
mount --bind "$GENTOO_INSTALL_REPO_DIR_ORIGINAL" "$GENTOO_INSTALL_REPO_BIND" \
|
||||
|| die "Could not bind mount '$GENTOO_INSTALL_REPO_DIR_ORIGINAL' to '$GENTOO_INSTALL_REPO_BIND'"
|
||||
}
|
||||
|
||||
download_stage3() {
|
||||
|
@ -334,7 +334,7 @@ gentoo_chroot() {
|
|||
|
||||
gentoo_umount
|
||||
mount_root
|
||||
bind_bootstrap_dir
|
||||
bind_repo_dir
|
||||
|
||||
# Copy resolv.conf
|
||||
einfo "Preparing chroot environment"
|
||||
|
@ -358,6 +358,6 @@ gentoo_chroot() {
|
|||
einfo "Chrooting..."
|
||||
EXECUTED_IN_CHROOT=true \
|
||||
TMP_DIR=$TMP_DIR \
|
||||
exec chroot -- "$ROOT_MOUNTPOINT" "$GENTOO_BOOTSTRAP_DIR/scripts/main_chroot.sh" "$@" \
|
||||
exec chroot -- "$ROOT_MOUNTPOINT" "$GENTOO_INSTALL_REPO_DIR/scripts/main_chroot.sh" "$@" \
|
||||
|| die "Failed to chroot into '$ROOT_MOUNTPOINT'"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/protection.sh" || exit 1
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
|
||||
|
||||
|
||||
################################################
|
||||
|
@ -8,11 +8,11 @@ source "$GENTOO_BOOTSTRAP_DIR/scripts/protection.sh" || exit 1
|
|||
|
||||
# The temporary directory for this script,
|
||||
# must reside in /tmp to allow the chrooted system to access the files
|
||||
TMP_DIR="/tmp/gentoo-bootstrap"
|
||||
TMP_DIR="/tmp/gentoo-install"
|
||||
# Mountpoint for the new system
|
||||
ROOT_MOUNTPOINT="$TMP_DIR/root"
|
||||
# Mountpoint for the script files for access from chroot
|
||||
GENTOO_BOOTSTRAP_BIND="$TMP_DIR/bind"
|
||||
GENTOO_INSTALL_REPO_BIND="$TMP_DIR/bind"
|
||||
# Mountpoint for the script files for access from chroot
|
||||
UUID_STORAGE_DIR="$TMP_DIR/uuids"
|
||||
|
||||
|
|
|
@ -16,16 +16,16 @@ get_source_dir() {
|
|||
echo -n "$(realpath "$(dirname "${source}")")"
|
||||
}
|
||||
|
||||
export GENTOO_BOOTSTRAP_DIR_ORIGINAL="$(dirname "$(get_source_dir)")"
|
||||
export GENTOO_BOOTSTRAP_DIR="$GENTOO_BOOTSTRAP_DIR_ORIGINAL"
|
||||
export GENTOO_BOOTSTRAP_SCRIPT_ACTIVE=true
|
||||
export GENTOO_BOOTSTRAP_SCRIPT_PID=$$
|
||||
export GENTOO_INSTALL_REPO_DIR_ORIGINAL="$(dirname "$(get_source_dir)")"
|
||||
export GENTOO_INSTALL_REPO_DIR="$GENTOO_INSTALL_REPO_DIR_ORIGINAL"
|
||||
export GENTOO_INSTALL_REPO_SCRIPT_ACTIVE=true
|
||||
export GENTOO_INSTALL_REPO_SCRIPT_PID=$$
|
||||
|
||||
umask 0077
|
||||
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/utils.sh"
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/config.sh"
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/functions.sh"
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/utils.sh"
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/config.sh"
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/functions.sh"
|
||||
|
||||
[[ $I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY == true ]] \
|
||||
|| die "You have not properly read the config. Set I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY=true to continue."
|
||||
|
@ -143,7 +143,7 @@ main_install_gentoo_in_chroot() {
|
|||
|
||||
# Generate a valid fstab file
|
||||
einfo "Generating fstab"
|
||||
install -m0644 -o root -g root "$GENTOO_BOOTSTRAP_DIR/configs/fstab" /etc/fstab \
|
||||
install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \
|
||||
|| die "Could not overwrite /etc/fstab"
|
||||
echo "PARTUUID=$PARTITION_UUID_LINUX / ext4 defaults,noatime,errors=remount-ro,discard 0 1" >> /etc/fstab \
|
||||
|| die "Could not append entry to fstab"
|
||||
|
@ -157,7 +157,7 @@ main_install_gentoo_in_chroot() {
|
|||
# Install and enable sshd
|
||||
if [[ "$INSTALL_SSHD" == true ]]; then
|
||||
einfo "Installing sshd"
|
||||
install -m0600 -o root -g root "$GENTOO_BOOTSTRAP_DIR/configs/sshd_config" /etc/ssh/sshd_config \
|
||||
install -m0600 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/sshd_config" /etc/ssh/sshd_config \
|
||||
|| die "Could not install /etc/ssh/sshd_config"
|
||||
rc-update add sshd default \
|
||||
|| die "Could not add sshd to default services"
|
||||
|
@ -219,7 +219,7 @@ main_install() {
|
|||
gentoo_umount
|
||||
install_stage3
|
||||
mount_efivars
|
||||
gentoo_chroot "$GENTOO_BOOTSTRAP_BIND/scripts/main.sh" install_gentoo_in_chroot
|
||||
gentoo_chroot "$GENTOO_INSTALL_REPO_BIND/scripts/main.sh" install_gentoo_in_chroot
|
||||
gentoo_umount
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ main_umount() {
|
|||
# Main dispatch
|
||||
|
||||
# Instantly kill when pressing ctrl-c
|
||||
trap 'kill "$GENTOO_BOOTSTRAP_SCRIPT_PID"' INT
|
||||
trap 'kill "$GENTOO_INSTALL_REPO_SCRIPT_PID"' INT
|
||||
|
||||
SCRIPT_ALIAS="$(basename "$0")"
|
||||
if [[ "$SCRIPT_ALIAS" == "main.sh" ]]; then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$GENTOO_BOOTSTRAP_SCRIPT_ACTIVE" != true ]]; then
|
||||
if [[ "$GENTOO_INSTALL_REPO_SCRIPT_ACTIVE" != true ]]; then
|
||||
echo "[1;31m * ERROR:[m This script must not be executed directly!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$GENTOO_BOOTSTRAP_DIR/scripts/protection.sh" || exit 1
|
||||
source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
|
||||
|
||||
elog() {
|
||||
echo "[1m *[m $*"
|
||||
|
@ -20,7 +20,7 @@ eerror() {
|
|||
|
||||
die() {
|
||||
eerror "$*"
|
||||
kill "$GENTOO_BOOTSTRAP_SCRIPT_PID"
|
||||
kill "$GENTOO_INSTALL_REPO_SCRIPT_PID"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue