Files
apk/dist/init_rc.sh

30 lines
573 B
Bash
Raw Normal View History

2025-12-09 16:20:00 +01:00
#!/bin/bash
# detect if either .bashrc or .zshrc is present
2025-12-09 17:07:20 +01:00
# check if user is root and change user to builder
TEMP_USER="builder"
if [ "$EUID" -eq 0 ]; then
BUILD_USER="$TEMP_USER"
else
BUILD_USER="$USER"
fi
if [ -f "/home/$BUILD_USER/.bashrc" ]; then
SHELL_RC="/home/$BUILD_USER/.bashrc"
elif [ -f "/home/$BUILD_USER/.zshrc" ]; then
SHELL_RC="/home/$BUILD_USER/.zshrc"
2025-12-09 16:20:00 +01:00
else
2025-12-09 17:07:20 +01:00
touch "/home/$BUILD_USER/.bashrc"
SHELL_RC="/home/$BUILD_USER/.bashrc"
2025-12-09 16:20:00 +01:00
fi
echo "Using shell rc file: $SHELL_RC"
2025-12-09 17:14:53 +01:00
cat dist/.baserc >> "$SHELL_RC"
2025-12-09 16:20:00 +01:00
2025-12-09 17:14:53 +01:00
source "$SHELL_RC"