fixed ENV for .bashrc and .zshrc
This commit is contained in:
0
dist/.shellrc → dist/.baserc
vendored
0
dist/.shellrc → dist/.baserc
vendored
23
dist/init_rc.sh
vendored
Normal file
23
dist/init_rc.sh
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# detect if either .bashrc or .zshrc is present
|
||||
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
SHELL_RC="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
SHELL_RC="$HOME/.zshrc"
|
||||
else
|
||||
echo "No .bashrc or .zshrc file found in home directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using shell rc file: $SHELL_RC"
|
||||
|
||||
# Check if content already exists in the shell rc file and if not, append it
|
||||
|
||||
if ! grep -q "export PATH=\$PATH:\$HOME/.local/bin" "$SHELL_RC"; then
|
||||
echo "Adding .local/bin to PATH in $SHELL_RC"
|
||||
echo 'export PATH=$PATH:$HOME/.local/bin' >> "$SHELL_RC"
|
||||
else
|
||||
echo ".local/bin is already in PATH in $SHELL_RC"
|
||||
fi
|
||||
4
dist/pacman.sh
vendored
4
dist/pacman.sh
vendored
@@ -73,10 +73,8 @@ else
|
||||
yes | su - "$BUILD_USER" -c "paru -S --noconfirm ${paru_packages[*]}"
|
||||
yes | su - "$BUILD_USER" -c "yes | sdkmanager --licenses"
|
||||
yes | su - "$BUILD_USER" -c "yes | sudo pacman -Syu --noconfirm gradle"
|
||||
yes | su - "$BUILD_USER" -c "dist/init_rc.sh"
|
||||
# check if bashrc or zshrc contains sdkman initialization, if not add it
|
||||
SHELL_RC_CONTENT="$(echo dist/.shellrc)"
|
||||
echo "Checking shell rc for sdkman initialization..."
|
||||
yes | su - "$BUILD_USER" -c "if [[ -f ~/.bashrc ]]; then echo ${SHELL_RC_CONTENT} >> ~/.bashrc; fi else if [[ -f ~/.zshrc ]]; then echo ${SHELL_RC_CONTENT} >> ~/.zshrc; fi"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user