update(script): simplify (#126)
Some checks are pending
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
PhoenixAceVFX 2025-01-25 16:31:53 -05:00 committed by GitHub
parent 74e91905fe
commit de1b74f6c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 26 deletions

View file

@ -189,8 +189,7 @@ Linux
- [AUR](https://aur.archlinux.org/packages?O=0&K=equicord) - [AUR](https://aur.archlinux.org/packages?O=0&K=equicord)
```shell ```shell
sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)" sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)"
``` ```
## Installing Equicord Devbuild ## Installing Equicord Devbuild
### Dependencies ### Dependencies

View file

@ -1,55 +1,50 @@
#!/bin/sh #!/bin/sh
# Exit immediately if a command exits with a non-zero status
set -e set -e
# Check if the script is run as root # Constants
INSTALLER_PATH="$HOME/.equilotl"
GITHUB_URL="https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux"
# Check for root
if [ "$(id -u)" -eq 0 ]; then if [ "$(id -u)" -eq 0 ]; then
echo "Run this script as a normal user, not root!" echo "Run me as a normal user, not root!"
exit 1 exit 1
fi fi
# Define variables download_installer() {
installer_path="$HOME/.equilotl" curl -sSL "$GITHUB_URL" --output "$INSTALLER_PATH"
github_url="https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux" chmod +x "$INSTALLER_PATH"
}
# Inform user about the update check
echo "Checking if the installer needs updating..." echo "Checking if the installer needs updating..."
# Fetch the latest modified date from the server if [ -f "$INSTALLER_PATH" ]; then
latest_modified=$(curl -sI "$github_url" | grep -i "last-modified" | cut -d' ' -f2-) latest_modified=$(curl -sI "$GITHUB_URL" | grep -i "last-modified" | cut -d' ' -f2-)
local_modified=$(stat -c "%y" "$INSTALLER_PATH" | cut -d' ' -f1-2)
# Check if the installer exists locally
if [ -f "$installer_path" ]; then
# Get the local file's last modified date
local_modified=$(stat -c "%y" "$installer_path" | cut -d' ' -f1-2)
# Compare the local file's date with the server's latest modified date
if [ "$local_modified" = "$latest_modified" ]; then if [ "$local_modified" = "$latest_modified" ]; then
echo "The installer is up-to-date." echo "The installer is up-to-date."
else else
echo "The installer is outdated. Downloading the latest version..." echo "The installer is outdated. Downloading the latest version..."
curl -sSL "$github_url" --output "$installer_path" download_installer
chmod +x "$installer_path"
fi fi
else else
echo "Installer not found. Downloading it..." echo "Installer not found. Downloading it..."
curl -sSL "$github_url" --output "$installer_path" download_installer
chmod +x "$installer_path"
fi fi
# Check for sudo or doas availability to run the installer with elevated privileges # Try to run the installer with sudo or doas
if command -v sudo >/dev/null; then if command -v sudo >/dev/null; then
echo "Running installer with sudo..." echo "Running installer with sudo..."
sudo "$installer_path" sudo "$INSTALLER_PATH"
elif command -v doas >/dev/null; then elif command -v doas >/dev/null; then
echo "Running installer with doas..." echo "Running installer with doas..."
doas "$installer_path" doas "$INSTALLER_PATH"
else else
echo "Neither sudo nor doas were found. Please install one to proceed." echo "Neither sudo nor doas were found. Please install one to proceed."
exit 1 exit 1
fi fi
# Provide script attribution # Credits
echo "Original script forked from Vencord" echo "Original script forked from Vencord"
echo "Modified by PhoenixAceVFX & Crxaw for Equicord Updater" echo "Modified by PhoenixAceVFX & Crxaw for Equicord Updater"