EOL this project :(

This commit is contained in:
Sophia Atkinson 2024-03-20 20:49:27 -07:00
parent 797b4d8de6
commit 0cc27e1896
Signed by: Sophia
GPG Key ID: 73928E5CCCD28BE1
15 changed files with 767 additions and 546 deletions

View File

@ -1,73 +1,124 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Function to prompt user for installation
prompt_installation() {
while true; do
read -r -p "Would you like to install Gitea? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
return 0
;;
[nN][oO]|[nN])
break
return 1
;;
*)
echo "That wasn't an option..."
;;
esac
done
set -b
ping -c1 "github.com" &>"/dev/null"
ping -c1 "api.github.com" &>"/dev/null"
ping -c1 "dl.gitea.io" &>"/dev/null"
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
if [[ "${?}" -ne 0 ]]; then
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
elif [[ "${#args[@]}" -eq 0 ]]; then
}
# Function to check if required domains are accessible
check_domains() {
echo "Checking necessary domains..."
for domain in "github.com" "api.github.com" "dl.gitea.io" "raw.githubusercontent.com"; do
if ! ping -c1 "$domain" &>"/dev/null"; then
echo "Unable to access $domain. Installation cannot proceed."
exit 1
fi
done
}
# Function to install Gitea
install_gitea() {
echo "Installing Gitea..."
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
# Get latest Gitea version
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g')
sudo systemctl stop gitea
sudo apt-get install git -y
# Install git
echo "Installing git..."
sudo apt-get install git -y || { echo "Failed to install git. Exiting."; exit 1; }
# Create git user
echo "Creating git user..."
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
fi
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
fi
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
fi
# Download and install Gitea binary
echo "Downloading Gitea binary..."
case "$(uname -m)" in
i386)
arch="386"
;;
x86_64)
arch="amd64"
;;
armv6l)
arch="arm-6"
;;
armv7l)
arch="arm-7"
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac
gitea_url="https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-$arch"
echo "Downloading Gitea from: $gitea_url"
sudo curl -fsSL -o "/tmp/gitea" "$gitea_url"
sudo mv /tmp/gitea /usr/local/bin
sudo chmod +x /usr/local/bin/gitea
# Create necessary directories and files
echo "Setting up directories and files..."
sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea
sudo chmod -R 750 /var/lib/gitea
sudo mkdir /etc/gitea
sudo mkdir -p /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
curl -fsSL -o /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
# Configure systemd service
echo "Configuring systemd service..."
sudo curl -fsSL -o /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
sudo systemctl daemon-reload
sudo systemctl enable --now gitea
sudo systemctl start gitea
# Allow port through firewall
echo "Allowing port 3000 through firewall..."
sudo ufw allow 3000
# Get public and internal IP addresses
public_ip=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
internal_ip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
# Output installation information
echo -e "=================================================================="
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "Gitea Should be available at http://${intenalip}:3000"
echo "Or If you are using a VPS at http://${publicipaddress}:3000"
echo -e "=================================================================="
echo "Gitea has been installed successfully!"
echo "The Gitea web interface should be available at:"
echo "http://$internal_ip:3000"
echo "Or, if you are using a VPS, at:"
echo "http://$public_ip:3000"
echo "=================================================================="
}
# Main script
if prompt_installation; then
check_domains
install_gitea
else
echo "Gitea installation aborted."
fi
exit 0

View File

@ -1,32 +1,61 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Function to prompt user for confirmation
prompt_confirmation() {
while true; do
read -r -p "Would you like to uninstall Gitea? This is not reversible. [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
return 0
;;
[nN][oO]|[nN])
break
return 1
;;
*)
echo "That wasn't an option..."
;;
esac
done
}
# Function to perform uninstallation
uninstall_gitea() {
echo "Stopping Gitea service..."
sudo systemctl stop gitea
echo "Disabling Gitea service..."
sudo systemctl disable gitea
echo "Removing Gitea service file..."
sudo rm -rf /etc/systemd/system/gitea.service
echo "Backing up Files"
tar -cvzf gitea.tar.gz /var/lib/gitea/ /etc/gitea
sudo rm -rf /home/git
sudo userdel git
echo "Backing up files..."
timestamp=$(date +"%Y%m%d_%H%M%S")
tar -cvzf "gitea_backup_${timestamp}.tar.gz" /var/lib/gitea/ /etc/gitea || { echo "Failed to backup files. Exiting."; exit 1; }
echo "Removing Gitea user and home directory..."
sudo userdel -r git || { echo "Failed to delete Gitea user. Exiting."; exit 1; }
echo "Removing Gitea binary..."
sudo rm -rf /usr/local/bin/gitea
sudo rm -rf /var/lib/gitea/*
sudo rm -rf /etc/gitea
echo "Cleaning up Gitea data and configuration..."
sudo rm -rf /var/lib/gitea/* /etc/gitea
echo "Removing firewall rule for port 3000..."
sudo ufw delete allow 3000
echo "Gitea has been uninstalled, and all files have are backed up in gitea.tar.gz, you can delete it at your discretion."
echo "Gitea has been uninstalled, and all files have been backed up."
}
# Main script
trap 'exit 130' INT
if prompt_confirmation; then
uninstall_gitea
else
echo "Gitea uninstallation aborted."
fi
exit 0

View File

@ -1,61 +1,95 @@
#!/usr/bin/env bash
# Trap Ctrl+C to exit gracefully
trap 'exit 130' INT
while true
do
# Function to prompt user for confirmation
prompt_confirmation() {
while true; do
read -r -p "Would you like to update Gitea? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
return 0
;;
[nN][oO]|[nN])
break
return 1
;;
*)
echo "That wasn't an option..."
;;
esac
done
set -b
ping -c1 "github.com" &>"/dev/null"
ping -c1 "api.github.com" &>"/dev/null"
ping -c1 "dl.gitea.io" &>"/dev/null"
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
if [[ "${?}" -ne 0 ]]; then
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
elif [[ "${#args[@]}" -eq 0 ]]; then
}
# Function to check network connectivity
check_connectivity() {
echo "Checking necessary domains for connectivity..."
for domain in "github.com" "api.github.com" "dl.gitea.io" "raw.githubusercontent.com"; do
if ! ping -c1 "$domain" &>"/dev/null"; then
echo "Unable to access $domain. Update cannot proceed."
exit 1
fi
done
}
# Function to perform the update
update_gitea() {
echo "Updating Gitea..."
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
# Get latest Gitea version
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g')
sudo systemctl stop gitea
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
fi
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
fi
# Determine architecture
case "$(uname -m)" in
i386)
arch="386"
;;
x86_64)
arch="amd64"
;;
armv6l)
arch="arm-6"
;;
armv7l)
arch="arm-7"
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
fi
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
fi
# Download and install Gitea binary
gitea_url="https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-$arch"
echo "Downloading Gitea from: $gitea_url"
sudo curl -fsSL -o "/tmp/gitea" "$gitea_url"
sudo mv /tmp/gitea /usr/local/bin
sudo chmod +x /usr/local/bin/gitea
sudo chown -R git:git /var/lib/gitea
sudo chmod -R 750 /var/lib/gitea
sudo chown root:git /etc/gitea
sudo systemctl start gitea
# Restart Gitea service
echo "Restarting Gitea service..."
sudo systemctl restart gitea
# Allow port through firewall
echo "Allowing port 3000 through firewall..."
sudo ufw allow 3000
echo -e "=================================================================="
echo "Gitea has been updated!!"
echo -e "=================================================================="
echo "Gitea has been updated successfully!"
}
# Main script
if prompt_confirmation; then
check_connectivity
update_gitea
else
echo "Gitea update aborted."
fi
exit 0

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
while true
do
read -r -p "Would you like to uninstall Gitlab? This is not reversible. [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
break
;;
*)
echo "That wasn't an option..."
;;
esac
done
sudo gitlab-ctl stop
sudo apt remove gitlab-ce -y
sudo apt update && apt upgrade -y
sudo ufw delete allow 443
sudo ufw delete allow 80

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Confirmation prompt
while true; do
read -r -p "Would you like to install Go Language? [Y/n] " input
case $input in
@ -9,7 +9,8 @@ do
break
;;
[nN][oO]|[nN])
break
echo "Go installation aborted."
exit 0
;;
*)
echo "That wasn't an option..."
@ -18,27 +19,32 @@ do
done
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
if ! command -v curl &>/dev/null; then
echo "curl is required but not installed. Installing curl..."
sudo apt update && sudo apt install -y curl
fi
# Get latest Go version
if [ "$(uname -m)" == "x86_64" ]; then
ARCH="amd64"
elif [ "$(uname -m)" == "armv6l" ]; then
ARCH="armv6l"
else
CURL_NOT_EXIST=0
ARCH="386"
fi
apt remove golang -y
rm -rf /tmp/go/
mkdir /tmp/go/
cd /tmp/go/
VER=$(curl --silent "https://go.dev/dl/?mode=json" | grep '"version":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' | head -1)
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-amd64.tar.gz" "https://go.dev/dl/"$VER".linux-amd64.tar.gz"
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-armv6l.tar.gz" "https://go.dev/dl/"$VER".linux-armv6l.tar.gz"
fi
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-386.tar.gz" "https://go.dev/dl/"$VER".linux-386.tar.gz"
fi
rm -rf /usr/local/go && tar -C /usr/local -xzf *.tar.gz
chmod +x /usr/local/go/bin/go
GO_VERSION=$(curl -sSL https://golang.org/dl/?mode=json | grep -oP '"version":"\K[^"]+' | head -n1)
GO_URL="https://golang.org/dl/go$GO_VERSION.linux-$ARCH.tar.gz"
# Install Go
echo "Downloading and installing Go $GO_VERSION..."
curl -fsSL -o "/tmp/go.tar.gz" "$GO_URL"
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf /tmp/go.tar.gz
rm -f /tmp/go.tar.gz
# Update PATH
echo "Updating PATH..."
export PATH=$PATH:/usr/local/go/bin
cd ~
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc # Add to .bashrc for persistent PATH
echo "Go $GO_VERSION has been successfully installed."

View File

@ -1,7 +1,10 @@
#!/usr/bin/env bash
# Trap INT signal to ensure clean exits
trap 'exit 130' INT
while true
do
# Confirmation prompt
while true; do
read -r -p "Would you like to install Hugo? [Y/n] " input
case $input in
@ -9,41 +12,53 @@ do
break
;;
[nN][oO]|[nN])
break
echo "Hugo installation aborted."
exit 0
;;
*)
echo "That wasn't an option..."
;;
esac
done
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
# Check for dependencies and install if needed
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt update && sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
apt remove golang -y
apt autoremove -y
wget -O goinstall.sh https://sop.wtf/sh/u/goinstall && bash goinstall.sh
rm -rf /tmp/hugo/
mkdir /tmp/hugo/
VER=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
# Remove unused dependencies (optional)
echo "Removing unused dependencies..."
sudo apt autoremove -y
# Download Hugo
echo "Downloading Hugo..."
mkdir -p /tmp/hugo && cd /tmp/hugo || { echo "Failed to create directory. Exiting."; exit 1; }
VER=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' ) || { echo "Failed to fetch Hugo version. Exiting."; exit 1; }
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"_linux-amd64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"_linux-amd64.tar.gz"
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_${VER}_Linux-64bit.tar.gz"
elif [ -n "$(uname -a | grep armv6l)" ]; then
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_${VER}_Linux-ARM64.tar.gz"
elif [ -n "$(uname -a | grep armv7l)" ]; then
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_${VER}_Linux-ARM.tar.gz"
echo "Hugo Extended is not supported on armv7l, installing standard Hugo..."
sudo apt update && sudo apt install -y snapd || { echo "Failed to install snapd. Exiting."; exit 1; }
sudo snap install dart-sass || { echo "Failed to install dart-sass via snap. Exiting."; exit 1; }
else
echo "Unsupported architecture. Exiting."
exit 1
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"-arm64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"-arm64.tar.gz"
fi
# Download and install Hugo
echo "Downloading and installing Hugo..."
wget -O hugo.tar.gz "$HUGO_URL" || { echo "Failed to download Hugo. Exiting."; exit 1; }
tar -xzf hugo.tar.gz || { echo "Failed to extract Hugo. Exiting."; exit 1; }
sudo mv hugo /usr/local/bin || { echo "Failed to move Hugo binary. Exiting."; exit 1; }
echo "Hugo successfully installed!"
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_"$VER"-arm.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_"$VER"-arm.tar.gz"
echo "Hugo Extended is not supported on armv7l, Installing Hugo standard"
sudo apt update
sudo apt install snapd
sudo snap install dart-sass
fi
cd /tmp/hugo/
tar -xzf /tmp/hugo/*.tar.gz
sudo mv /tmp/hugo/hugo /usr/local/bin
# Clean up
rm -rf /tmp/hugo
cd ~
exit 0

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Confirmation prompt
while true; do
read -r -p "Would you like to install phpMyAdmin? [Y/n] " input
case $input in
@ -9,72 +10,68 @@ do
break
;;
[nN][oO]|[nN])
break
echo "phpMyAdmin installation aborted."
exit 0
;;
*)
echo "That wasn't an option..."
;;
esac
done
# Web server selection prompt
while [ "$go" != 'apache' ] && [ "$go" != 'nginx' ]; do
read -p "Would you like to install using Nginx or Apache? (nginx/apache) " go
done
# Update and upgrade system packages
apt update && apt upgrade -y
# Install dependencies and add repositories
apt-get install build-essential lsb-release software-properties-common -y
if [ "$go" == 'nginx' ]; then
sudo apt update && apt upgrade -y
sudo apt-get install build-essential lsb-release software-properties-common -y
sudo add-apt-repository --yes ppa:ondrej/nginx && sudo add-apt-repository --yes ppa:ondrej/php && sudo apt install php-fpm software-properties-common phpmyadmin php-mbstring php-zip php-gd php-json php-curl nginx-full php-mysql unzip -y
sudo systemctl stop nginx
sudo wget -O /etc/nginx/conf.d/phpmyadmin.conf https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/conf/pmanginx.conf
sudo systemctl enable nginx
sudo systemctl start nginx
## Updating phpMyAdmin.
sudo rm -rf /usr/share/phpmyadmin.bak
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
sudo mkdir /usr/share/phpmyadmin/
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -P /usr/share/phpmyadmin/
sudo unzip /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.zip -C /usr/share/phpmyadmin/
sudo mv /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages/* /usr/share/phpmyadmin
sudo mkdir /usr/share/phpmyadmin/tmp/ && chmod -R 777 /usr/share/phpmyadmin/tmp/
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.tar.gz
## Thanks https://stackoverflow.com/users/3266847/benjamin-w
add-apt-repository --yes ppa:ondrej/nginx
add-apt-repository --yes ppa:ondrej/php
apt install nginx-full phpmyadmin php-{mbstring,zip,fpm,gd,json,curl,mysql} unzip -y
systemctl stop nginx
wget -O /etc/nginx/conf.d/phpmyadmin.conf https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/conf/pmanginx.conf
systemctl enable nginx
systemctl start nginx
elif [ "$go" == 'apache' ]; then
add-apt-repository --yes ppa:ondrej/apache2
apt install apache2 libapache2-mod-php phpmyadmin php-{mbstring,zip,fpm,gd,json,curl,mysql} unzip -y
systemctl stop apache2
wget -O /etc/apache2/sites-enabled/phpmyadmin.conf https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/conf/pmaapache.conf
systemctl restart php-fpm
systemctl reload apache2
systemctl enable apache2
fi
# Update phpMyAdmin
rm -rf /usr/share/phpmyadmin.bak
mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
mkdir /usr/share/phpmyadmin/
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz -P /usr/share/phpmyadmin/
tar -xzf /usr/share/phpmyadmin/*.tar.gz -C /usr/share/phpmyadmin/
mv /usr/share/phpmyadmin/phpMyAdmin-*-all-languages/* /usr/share/phpmyadmin
mkdir /usr/share/phpmyadmin/tmp/ && chmod -R 777 /usr/share/phpmyadmin/tmp/
# Set random Blowfish secret
randomBlowfishSecret=$(openssl rand -base64 22)
sudo sed -e "s|cfg\['blowfish_secret'\] = ''|cfg['blowfish_secret'] = '$randomBlowfishSecret'|" /usr/share/phpmyadmin/config.sample.inc.php > /usr/share/phpmyadmin/config.inc.php
sudo systemctl restart nginx
sudo ufw allow 8080
sed -e "s|cfg\['blowfish_secret'\] = ''|cfg['blowfish_secret'] = '$randomBlowfishSecret'|" /usr/share/phpmyadmin/config.sample.inc.php > /usr/share/phpmyadmin/config.inc.php
# Restart web server and allow connections
if [ "$go" == 'nginx' ]; then
systemctl restart nginx
elif [ "$go" == 'apache' ]; then
systemctl restart apache2
fi
ufw allow 8080
# Display information
echo -e "=================================================================="
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "phpMyAdmin Should be available at http://${intenalip}:8080"
echo "Or If you are using a VPS at http://${publicipaddress}:8080"
internalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "phpMyAdmin should be available at http://${internalip}:8080"
echo "Or if you are using a VPS, at http://${publicipaddress}:8080"
echo -e "=================================================================="
fi
if [ "$go" == 'apache' ]; then
sudo apt update && apt upgrade -y
sudo apt-get install build-essential lsb-release software-properties-common -y
sudo add-apt-repository --yes ppa:ondrej/apache2 && apt install apache2 libapache2-mod-php php-fpm software-properties-common phpmyadmin php-mbstring php-zip php-gd php-json php-curl php-mysql unzip -y
sudo systemctl stop apache2
sudo wget -O /etc/apache2/sites-enabled/phpmyadmin.conf https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/conf/pmaapache.conf
sudo systemctl restart php-fpm
sudo systemctl reload apache2
sudo systemctl enable apache2
## Updating phpMyAdmin.
sudo rm -rf /usr/share/phpmyadmin.bak
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
sudo mkdir /usr/share/phpmyadmin/
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -P /usr/share/phpmyadmin/
sudo unzip /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.zip -C /usr/share/phpmyadmin/
sudo mv /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages/* /usr/share/phpmyadmin
sudo mkdir /usr/share/phpmyadmin/tmp/ && chmod -R 777 /usr/share/phpmyadmin/tmp/
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.tar.gz
## Thanks https://stackoverflow.com/users/3266847/benjamin-w
randomBlowfishSecret=$(openssl rand -base64 22)
sudo sed -e "s|cfg\['blowfish_secret'\] = ''|cfg['blowfish_secret'] = '$randomBlowfishSecret'|" /usr/share/phpmyadmin/config.sample.inc.php > /usr/share/phpmyadmin/config.inc.php
sudo systemctl restart apache2
sudo ufw allow 8080
echo -e "=================================================================="
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "phpMyAdmin Should be available at http://${intenalip}:8080"
echo "Or If you are using a VPS at http://${publicipaddress}:8080"
echo -e "=================================================================="
fi

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Confirmation prompt
while true; do
read -r -p "Would you like to uninstall phpMyAdmin? [Y/n] " input
case $input in
@ -9,26 +10,31 @@ do
break
;;
[nN][oO]|[nN])
break
echo "phpMyAdmin uninstallation aborted."
exit 0
;;
*)
echo "That wasn't an option..."
;;
esac
done
# Uninstallation
if [ -n "$(dpkg --get-selections | grep apache)" ]; then
sudo apt remove phpmyadmin -y
sudo apt-get autoremove -y
sudo rm -rf /usr/share/phpmyadmin/
sudo rm -rf /etc/apache2/sites-enabled/phpmyadmin.conf
sudo systemctl restart apache2
fi
if [ -n "$(dpkg --get-selections | grep nginx)" ]; then
elif [ -n "$(dpkg --get-selections | grep nginx)" ]; then
sudo apt remove phpmyadmin -y
sudo apt-get autoremove -y
sudo rm -rf /usr/share/phpmyadmin/
sudo rm -rf /etc/nginx/conf.d/phpmyadmin.conf
sudo systemctl restart nginx
else
echo "Neither Apache nor Nginx is installed. Cannot uninstall phpMyAdmin."
exit 1
fi
echo "phpMyAdmin has been successfully uninstalled."

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
trap 'exit 130' INT
while true
do
# Confirmation prompt
while true; do
read -r -p "Would you like to Update phpMyAdmin? [Y/n] " input
case $input in
@ -9,41 +10,37 @@ do
break
;;
[nN][oO]|[nN])
break
echo "phpMyAdmin update aborted."
exit 0
;;
*)
echo "That wasn't an option..."
;;
esac
done
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
# Dependency check
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt install -y curl
fi
sudo apt update && apt upgrade -y
# Update process
echo "Updating phpMyAdmin..."
sudo apt update && sudo apt upgrade -y
sudo rm -rf /usr/share/phpmyadmin.bak
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
sudo mkdir /usr/share/phpmyadmin/
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -P /usr/share/phpmyadmin/
sudo unzip /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.zip -C /usr/share/phpmyadmin/
sudo mv /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages/* /usr/share/phpmyadmin
sudo mkdir /usr/share/phpmyadmin/tmp/ && chmod -R 777 /usr/share/phpmyadmin/tmp/
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.tar.gz
## Thanks https://stackoverflow.com/users/3266847/benjamin-w
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz -P /usr/share/phpmyadmin/
sudo tar -xzf /usr/share/phpmyadmin/*.tar.gz -C /usr/share/phpmyadmin/
sudo mv /usr/share/phpmyadmin/phpMyAdmin-*-all-languages/* /usr/share/phpmyadmin
sudo mkdir /usr/share/phpmyadmin/tmp/ && sudo chmod -R 777 /usr/share/phpmyadmin/tmp/
randomBlowfishSecret=$(openssl rand -base64 22)
sudo sed -e "s|cfg\['blowfish_secret'\] = ''|cfg['blowfish_secret'] = '$randomBlowfishSecret'|" /usr/share/phpmyadmin/config.sample.inc.php > /usr/share/phpmyadmin/config.inc.php
sudo systemctl restart apache2
sudo systemctl restart nginx
sudo sed -i "s|cfg\['blowfish_secret'\] = ''|cfg['blowfish_secret'] = '$randomBlowfishSecret'|" /usr/share/phpmyadmin/config.sample.inc.php
sudo mv /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
sudo systemctl restart apache2 nginx
# Completion message
echo -e "=================================================================="
echo "phpMyAdmin has been updated!"
echo -e "=================================================================="

View File

@ -1,57 +1,102 @@
#!/usr/bin/env bash
trap 'exit 130' INT
set -b
ping -c1 "github.com" &>"/dev/null"
ping -c1 "api.github.com" &>"/dev/null"
ping -c1 "dl.gitea.io" &>"/dev/null"
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
if [[ "${?}" -ne 0 ]]; then
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
elif [[ "${#args[@]}" -eq 0 ]]; then
# Function to check if required domains are accessible
check_domains() {
echo "Checking necessary domains..."
for domain in "github.com" "api.github.com" "dl.gitea.io" "raw.githubusercontent.com"; do
if ! ping -c1 "$domain" &>"/dev/null"; then
echo "Unable to access $domain. Installation cannot proceed."
exit 1
fi
done
}
# Function to install Gitea
install_gitea() {
echo "Installing Gitea..."
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
# Get latest Gitea version
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g')
sudo systemctl stop gitea
sudo apt-get install git -y
# Install git
echo "Installing git..."
sudo apt-get install git -y || { echo "Failed to install git. Exiting."; exit 1; }
# Create git user
echo "Creating git user..."
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
fi
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
fi
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
fi
# Download and install Gitea binary
echo "Downloading Gitea binary..."
case "$(uname -m)" in
i386)
arch="386"
;;
x86_64)
arch="amd64"
;;
armv6l)
arch="arm-6"
;;
armv7l)
arch="arm-7"
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac
gitea_url="https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-$arch"
echo "Downloading Gitea from: $gitea_url"
sudo curl -fsSL -o "/tmp/gitea" "$gitea_url"
sudo mv /tmp/gitea /usr/local/bin
sudo chmod +x /usr/local/bin/gitea
# Create necessary directories and files
echo "Setting up directories and files..."
sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea
sudo chmod -R 750 /var/lib/gitea
sudo mkdir /etc/gitea
sudo mkdir -p /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
curl -fsSL -o /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
# Configure systemd service
echo "Configuring systemd service..."
sudo curl -fsSL -o /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
sudo systemctl daemon-reload
sudo systemctl enable --now gitea
sudo systemctl start gitea
# Allow port through firewall
echo "Allowing port 3000 through firewall..."
sudo ufw allow 3000
# Get public and internal IP addresses
public_ip=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
internal_ip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
# Output installation information
echo -e "=================================================================="
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "Gitea Should be available at http://${intenalip}:3000"
echo "Or If you are using a VPS at http://${publicipaddress}:3000"
echo -e "=================================================================="
fi
echo "Gitea has been installed successfully!"
echo "The Gitea web interface should be available at:"
echo "http://$internal_ip:3000"
echo "Or, if you are using a VPS, at:"
echo "http://$public_ip:3000"
echo "=================================================================="
}
# Main script
# Automate installation by assuming yes to the prompt
check_domains
install_gitea
exit 0

View File

@ -1,16 +1,39 @@
#!/usr/bin/env bash
trap 'exit 130' INT
# Function to perform uninstallation
uninstall_gitea() {
echo "Stopping Gitea service..."
sudo systemctl stop gitea
echo "Disabling Gitea service..."
sudo systemctl disable gitea
echo "Removing Gitea service file..."
sudo rm -rf /etc/systemd/system/gitea.service
echo "Backing up Files"
tar -cvzf gitea.tar.gz /var/lib/gitea/ /etc/gitea
sudo rm -rf /home/git
sudo userdel git
echo "Backing up files..."
timestamp=$(date +"%Y%m%d_%H%M%S")
tar -cvzf "gitea_backup_${timestamp}.tar.gz" /var/lib/gitea/ /etc/gitea || { echo "Failed to backup files. Exiting."; exit 1; }
echo "Removing Gitea user and home directory..."
sudo userdel -r git || { echo "Failed to delete Gitea user. Exiting."; exit 1; }
echo "Removing Gitea binary..."
sudo rm -rf /usr/local/bin/gitea
sudo rm -rf /var/lib/gitea/*
sudo rm -rf /etc/gitea
echo "Cleaning up Gitea data and configuration..."
sudo rm -rf /var/lib/gitea/* /etc/gitea
echo "Removing firewall rule for port 3000..."
sudo ufw delete allow 3000
echo "Gitea has been uninstalled, and all files have are backed up in gitea.tar.gz, you can delete it at your discretion."
echo "Gitea has been uninstalled, and all files have been backed up."
}
# Main script
trap 'exit 130' INT
# Automate confirmation by assuming yes to the prompt
uninstall_gitea
exit 0

View File

@ -1,45 +1,70 @@
#!/usr/bin/env bash
trap 'exit 130' INT
set -b
ping -c1 "github.com" &>"/dev/null"
ping -c1 "api.github.com" &>"/dev/null"
ping -c1 "dl.gitea.io" &>"/dev/null"
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
if [[ "${?}" -ne 0 ]]; then
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
elif [[ "${#args[@]}" -eq 0 ]]; then
# Function to check network connectivity
check_connectivity() {
echo "Checking necessary domains for connectivity..."
for domain in "github.com" "api.github.com" "dl.gitea.io" "raw.githubusercontent.com"; do
if ! ping -c1 "$domain" &>"/dev/null"; then
echo "Unable to access $domain. Update cannot proceed."
exit 1
fi
done
}
# Function to perform the update
update_gitea() {
echo "Updating Gitea..."
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
# Get latest Gitea version
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g')
sudo systemctl stop gitea
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
fi
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
fi
# Determine architecture
case "$(uname -m)" in
i386)
arch="386"
;;
x86_64)
arch="amd64"
;;
armv6l)
arch="arm-6"
;;
armv7l)
arch="arm-7"
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
fi
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
fi
# Download and install Gitea binary
gitea_url="https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-$arch"
echo "Downloading Gitea from: $gitea_url"
sudo curl -fsSL -o "/tmp/gitea" "$gitea_url"
sudo mv /tmp/gitea /usr/local/bin
sudo chmod +x /usr/local/bin/gitea
sudo chown -R git:git /var/lib/gitea
sudo chmod -R 750 /var/lib/gitea
sudo chown root:git /etc/gitea
sudo systemctl start gitea
# Restart Gitea service
echo "Restarting Gitea service..."
sudo systemctl restart gitea
# Allow port through firewall
echo "Allowing port 3000 through firewall..."
sudo ufw allow 3000
echo -e "=================================================================="
echo "Gitea has been updated!!"
echo -e "=================================================================="
fi
echo "Gitea has been updated successfully!"
}
# Main script
# Automate confirmation by assuming yes to the prompt
check_connectivity
update_gitea
exit 0

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
sudo gitlab-ctl stop
sudo apt remove gitlab-ce -y
sudo apt update && apt upgrade -y
sudo ufw delete allow 443
sudo ufw delete allow 80

View File

@ -1,27 +1,36 @@
#!/usr/bin/env bash
trap 'exit 130' INT
# Check if curl is installed
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
if ! command -v curl &>/dev/null; then
echo "curl is required but not installed. Installing curl..."
sudo apt update && sudo apt install -y curl || {
echo "Failed to install curl. Exiting."
exit 1
}
fi
apt remove golang -y
rm -rf /tmp/go/
mkdir /tmp/go/
cd /tmp/go/
VER=$(curl --silent "https://go.dev/dl/?mode=json" | grep '"version":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' | head -1)
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-amd64.tar.gz" "https://go.dev/dl/"$VER".linux-amd64.tar.gz"
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-armv6l.tar.gz" "https://go.dev/dl/"$VER".linux-armv6l.tar.gz"
fi
if [ -n "$(uname -a | grep i386)" ]; then
curl -fsSL -o "/tmp/go/"$VER".linux-386.tar.gz" "https://go.dev/dl/"$VER".linux-386.tar.gz"
fi
rm -rf /usr/local/go && tar -C /usr/local -xzf *.tar.gz
chmod +x /usr/local/go/bin/go
export PATH=$PATH:/usr/local/go/bin
cd ~
# Get latest Go version
ARCH=$(uname -m)
case $ARCH in
"x86_64") ARCH="amd64" ;;
"armv6l") ARCH="armv6l" ;;
*) ARCH="386" ;;
esac
GO_VERSION=$(curl -sSL https://golang.org/dl/?mode=json | grep -oP '"version":"\K[^"]+' | head -n1)
GO_URL="https://golang.org/dl/go$GO_VERSION.linux-$ARCH.tar.gz"
# Install Go
echo "Downloading and installing Go $GO_VERSION..."
sudo rm -rf /usr/local/go
sudo curl -fsSL "$GO_URL" | sudo tar -C /usr/local -xz || {
echo "Failed to download and install Go. Exiting."
exit 1
}
# Update PATH
echo "Updating PATH..."
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile.d/go.sh >/dev/null
source /etc/profile.d/go.sh
echo "Go $GO_VERSION has been successfully installed."

View File

@ -1,33 +1,46 @@
#!/usr/bin/env bash
# Trap INT signal to ensure clean exits
trap 'exit 130' INT
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
# Check for dependencies and install if needed
if ! command -v curl &>/dev/null; then
echo "Installing curl..."
sudo apt update && sudo apt install -y curl || { echo "Failed to install curl. Exiting."; exit 1; }
fi
apt remove golang -y
apt autoremove -y
wget -O goinstall.sh https://sop.wtf/sh/u/goinstall && bash goinstall.sh
rm -rf /tmp/hugo/
mkdir /tmp/hugo/
VER=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
# Remove unused dependencies (optional)
echo "Removing unused dependencies..."
sudo apt autoremove -y
# Download Hugo
echo "Downloading Hugo..."
mkdir -p /tmp/hugo && cd /tmp/hugo || { echo "Failed to create directory. Exiting."; exit 1; }
VER=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' ) || { echo "Failed to fetch Hugo version. Exiting."; exit 1; }
if [ -n "$(uname -a | grep x86_64)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"_linux-amd64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"_linux-amd64.tar.gz"
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_${VER}_Linux-64bit.tar.gz"
elif [ -n "$(uname -a | grep armv6l)" ]; then
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_${VER}_Linux-ARM64.tar.gz"
elif [ -n "$(uname -a | grep armv7l)" ]; then
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_${VER}_Linux-ARM.tar.gz"
echo "Hugo Extended is not supported on armv7l, installing standard Hugo..."
sudo apt update && sudo apt install -y snapd || { echo "Failed to install snapd. Exiting."; exit 1; }
sudo snap install dart-sass || { echo "Failed to install dart-sass via snap. Exiting."; exit 1; }
else
echo "Unsupported architecture. Exiting."
exit 1
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"-arm64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"-arm64.tar.gz"
fi
# Download and install Hugo
echo "Downloading and installing Hugo..."
wget -O hugo.tar.gz "$HUGO_URL" || { echo "Failed to download Hugo. Exiting."; exit 1; }
tar -xzf hugo.tar.gz || { echo "Failed to extract Hugo. Exiting."; exit 1; }
sudo mv hugo /usr/local/bin || { echo "Failed to move Hugo binary. Exiting."; exit 1; }
echo "Hugo successfully installed!"
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_"$VER"-arm.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_"$VER"-arm.tar.gz"
echo "Hugo Extended is not supported on armv7l, Installing Hugo standard"
sudo apt update
sudo apt install snapd
sudo snap install dart-sass
fi
cd /tmp/hugo/
tar -xzf /tmp/hugo/*.tar.gz
sudo mv /tmp/hugo/hugo /usr/local/bin
# Clean up
rm -rf /tmp/hugo
cd ~
exit 0