Change how we are handle the update alias and path export to go to the right places, and be verbose about it
This commit is contained in:
parent
c61a8b97c6
commit
d2f6ad273d
|
@ -138,17 +138,23 @@ if [[ "$SHELL" == *"bash"* ]]; then
|
||||||
elif [[ "$SHELL" == *"zsh"* ]]; then
|
elif [[ "$SHELL" == *"zsh"* ]]; then
|
||||||
shell_rc="$HOME/.zshrc"
|
shell_rc="$HOME/.zshrc"
|
||||||
else
|
else
|
||||||
echo "Unsupported shell. Please manually add the following to your shell configuration:"
|
echo "Unsupported shell. Please manually add the following alias to your shell configuration:"
|
||||||
echo 'export PATH=$PATH:$HOME/.allpac/bin'
|
|
||||||
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'"
|
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add AllPac to the system path and set up alias in the user's shell configuration file
|
# Check if the alias already exists in the shell configuration file
|
||||||
{
|
if ! grep -q "alias allpac-update-system=" "$shell_rc"; then
|
||||||
echo 'export PATH=$PATH:$HOME/.allpac/bin'
|
# Alias not found, add it to the shell configuration file
|
||||||
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'"
|
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'" >> "$shell_rc"
|
||||||
} >> "$shell_rc"
|
echo "Alias added to $shell_rc"
|
||||||
|
else
|
||||||
|
echo "Alias already exists in $shell_rc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Adding AllPac to the system path for all users..."
|
||||||
|
echo 'export PATH=$PATH:$HOME/.allpac/bin' | sudo tee -a /etc/profile.d/allpac.sh > /dev/null
|
||||||
|
sudo chmod +x /etc/profile.d/allpac.sh
|
||||||
|
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
cd ../../ || exit
|
cd ../../ || exit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user