Files
apk/dist/init_rc.sh
anorien90 d5cdf6a106
Some checks failed
Test setup and build APKs archlinux / Build-APK-Arch-Linux (push) Failing after 6m8s
Test setup and build APKs / Build-and-Create-Development-Environment (push) Successful in 11s
added sdk.dir to gradle.properties
2025-12-09 17:07:20 +01:00

33 lines
771 B
Bash

#!/bin/bash
# detect if either .bashrc or .zshrc is present
# 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"
else
touch "/home/$BUILD_USER/.bashrc"
SHELL_RC="/home/$BUILD_USER/.bashrc"
fi
echo "Using shell rc file: $SHELL_RC"
# Check if content already exists in the shell rc file and if not, append it
cat /home/"$BUILD_USER"/"$SHELL_RC" | if ! grep -q "ANDROID_HOME" ; then
cat dist/.baserc >> /home/"$BUILD_USER"/"$SHELL_RC" fi
source /home/"$BUILD_USER"/"$SHELL_RC"