Added chroot indicator

This commit is contained in:
oddlama 2020-01-02 23:56:36 +01:00
parent b3cf81f95d
commit 161afbc285
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
2 changed files with 8 additions and 5 deletions

View File

@ -271,7 +271,13 @@ gentoo_umount() {
} }
gentoo_chroot() { gentoo_chroot() {
[[ $# -gt 0 ]] || die "Missing command argument" if [[ $# -eq 0 ]]; then
cat > "$TMP_DIR/.bashrc" <<EOF
# Set the PS1 to a recognizable value
export PS1="(chroot) \$PS1"
EOF
gentoo_chroot /bin/bash --init-file "$TMP_DIR/.bashrc"
fi
[[ $EXECUTED_IN_CHROOT != true ]] \ [[ $EXECUTED_IN_CHROOT != true ]] \
|| die "Already in chroot" || die "Already in chroot"
@ -301,6 +307,6 @@ gentoo_chroot() {
disable_logging disable_logging
EXECUTED_IN_CHROOT=true \ EXECUTED_IN_CHROOT=true \
TMP_DIR=$TMP_DIR \ TMP_DIR=$TMP_DIR \
exec chroot "$ROOT_MOUNTPOINT" "$GENTOO_BOOTSTRAP_DIR/scripts/main_chroot.sh" "$@" \ exec chroot -- "$ROOT_MOUNTPOINT" "$GENTOO_BOOTSTRAP_DIR/scripts/main_chroot.sh" "$@" \
|| die "Failed to chroot into '$ROOT_MOUNTPOINT'" || die "Failed to chroot into '$ROOT_MOUNTPOINT'"
} }

View File

@ -14,8 +14,5 @@ export NPROC_ONE="$(($NPROC + 1))"
export MAKEFLAGS="-j$NPROC" export MAKEFLAGS="-j$NPROC"
export EMERGE_DEFAULT_OPTS="--jobs=$NPROC_ONE --load-average=$NPROC" export EMERGE_DEFAULT_OPTS="--jobs=$NPROC_ONE --load-average=$NPROC"
# Set the PS1 to a recognizable value
export PS1="(chroot) $PS1"
# Execute the requested command # Execute the requested command
exec "$@" exec "$@"