Setup install script so that it can be ran unattended with curl again
This commit is contained in:
parent
6fcf36f068
commit
c61a8b97c6
|
@ -12,9 +12,9 @@ mkdir -p "$HOME/.allpac/cache" "$HOME/.allpac/logs" "$HOME/.allpac/bin"
|
|||
echo "We are about to write a new pkg.list"
|
||||
echo "Do you want us to proceed?"
|
||||
echo "(reply 'n' if you already have a pkg.list)"
|
||||
read -p "Proceed? [Y/n] " -n 1 -r
|
||||
read -p "Proceed? [Y/n] " -n 1 -r -e -i "Y" REPLY
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
||||
echo "Writing new pkg.list..."
|
||||
sleep 2
|
||||
touch ~/.allpac/pkg.list
|
||||
|
@ -31,9 +31,9 @@ echo "Checking if Go is installed..."
|
|||
if [[ "$go_version" != *"$required_version"* ]]; then
|
||||
echo "Required Go version is not installed."
|
||||
|
||||
read -p "Do you want to install Go? (this will also perform a general system update with pacman) [Y/n] " -n 1 -r
|
||||
read -p "Do you want to install Go? (this will also perform a general system update with pacman) [Y/n] " -n 1 -r -e -i "Y" REPLY
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
||||
echo " "
|
||||
echo "Running 'sudo pacman -Syu go' instead of 'pacman -Sy'..."
|
||||
echo " "
|
||||
|
@ -68,9 +68,9 @@ echo "Checking if wget is installed..."
|
|||
if ! command -v wget &>/dev/null; then
|
||||
echo "wget is not installed."
|
||||
|
||||
read -p "Do you want to install wget? [Y/n] " -n 1 -r
|
||||
read -p "Do you want to install wget? [Y/n] " -n 1 -r -e -i "Y" REPLY
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
||||
sudo pacman -Syu wget
|
||||
else
|
||||
echo "wget not installed. Exiting."
|
||||
|
@ -88,9 +88,9 @@ echo "Checking if Git is installed..."
|
|||
if ! command -v git &>/dev/null; then
|
||||
echo "Git is not installed."
|
||||
|
||||
read -p "Do you want to install Git? [Y/n] " -n 1 -r
|
||||
read -p "Do you want to install Git? [Y/n] " -n 1 -r -e -i "Y" REPLY
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
||||
sudo pacman -Syu git
|
||||
else
|
||||
echo "Git not installed. Exiting."
|
||||
|
@ -130,13 +130,25 @@ echo "Setting updater script permissions..."
|
|||
chmod u+rwx ~/.allpac/bin/allpac-updater.sh
|
||||
sleep 2
|
||||
|
||||
echo "Creating a script in /etc/profile.d/ to add AllPac to the system path and set up alias for all users..."
|
||||
echo "Detecting your shell and updating the configuration..."
|
||||
|
||||
# Determine the shell the user is using
|
||||
if [[ "$SHELL" == *"bash"* ]]; then
|
||||
shell_rc="$HOME/.bashrc"
|
||||
elif [[ "$SHELL" == *"zsh"* ]]; then
|
||||
shell_rc="$HOME/.zshrc"
|
||||
else
|
||||
echo "Unsupported shell. Please manually add the following to your shell configuration:"
|
||||
echo 'export PATH=$PATH:$HOME/.allpac/bin'
|
||||
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add AllPac to the system path and set up alias in the user's shell configuration file
|
||||
{
|
||||
echo 'export PATH=$PATH:$HOME/.allpac/bin'
|
||||
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'"
|
||||
} | sudo tee -a /etc/profile.d/allpac.sh > /dev/null
|
||||
echo "Making '/etc/profile.d/allpac.sh' executable..."
|
||||
sudo chmod +x /etc/profile.d/allpac.sh
|
||||
} >> "$shell_rc"
|
||||
|
||||
echo "Cleaning up..."
|
||||
cd ../../ || exit
|
||||
|
|
Loading…
Reference in New Issue
Block a user