This commit is contained in:
2026-01-24 05:57:54 +00:00
parent 976bfba988
commit 874c7910d5
2 changed files with 26 additions and 8 deletions

View File

@@ -29,12 +29,18 @@ chmod 0644 "$DST_BANNER"
# Ensure /etc/bash.bashrc sources both (idempotent)
tmp="$(mktemp)"
orig_mode="$(stat -c '%a' "$BASH_BASHRC")"
orig_owner="$(stat -c '%u' "$BASH_BASHRC")"
orig_group="$(stat -c '%g' "$BASH_BASHRC")"
awk -v s="$MARKER_START" -v e="$MARKER_END" '
$0==s {inside=1; next}
$0==e {inside=0; next}
!inside {print}
' "$BASH_BASHRC" > "$tmp"
cat "$tmp" > "$BASH_BASHRC"
install -m "$orig_mode" -o "$orig_owner" -g "$orig_group" "$tmp" "$BASH_BASHRC"
if command -v restorecon >/dev/null 2>&1; then
restorecon "$BASH_BASHRC" >/dev/null 2>&1 || true
fi
rm -f "$tmp"
cat >> "$BASH_BASHRC" <<EOF
@@ -55,6 +61,8 @@ echo " - $DST_PS1"
echo " - $DST_BANNER"
echo " - sourcet fra $BASH_BASHRC"
echo
echo "Åpne et nytt shell for å se endringene."
echo
echo "Disable per bruker:"
echo " export DISABLE_GLOBAL_PS1=1"
echo " export DISABLE_GLOBAL_BANNER=1"