Skip to content

Instantly share code, notes, and snippets.

@HBIDamian
Created May 10, 2024 19:56
Show Gist options
  • Save HBIDamian/a1ec84823848639ffec31dc2a9c0a0f5 to your computer and use it in GitHub Desktop.
Save HBIDamian/a1ec84823848639ffec31dc2a9c0a0f5 to your computer and use it in GitHub Desktop.
Me being lazy, I wrote this so I dont have to download it every time.
#!/bin/zsh
function Error {
echo -e "\e[91m[ERROR]\e[0m $1"
}
# function Success msg
function Success {
echo -e "\e[92m[SUCCESS]\e[0m $1"
}
# function Info msg
function Info {
echo -e "\e[96m[INFO]\e[0m $1"
}
# Set Downloads directory path
downloads_dir="$HOME/Downloads"
# URL for the installer
installer_url="https://github.com/Vencord/Installer/releases/latest/download/VencordInstaller.MacOs.zip"
# Download the installer
Info "Downloading installer..."
curl -LsSf -o "$downloads_dir/VencordInstaller.MacOs.zip" "$installer_url"
# Check if download was successful
if [ $? -ne 0 ]; then
Error "Failed to download the installer. Exiting."
exit 1
else
Success "Downloaded VencordInstaller.MacOs.zip."
fi
# Unzip the installer
Info "Unzipping installer..."
unzip -o -q "$downloads_dir/VencordInstaller.MacOs.zip" -d "$downloads_dir"
# Check if unzip was successful
if [ $? -ne 0 ]; then
Error "Failed to unzip the installer. Exiting."
exit 1
fi
# Run the installer
Info "Running installer..."
open "$downloads_dir/VencordInstaller.app"
# Wait for the installer to finish
while [ -n "$(pgrep -x "VencordInstaller")" ]; do
for c in ◀︎ ▼ ▶︎ ▲; do
stty -echo -icanon time 0 min 0
read -s -n 1 key
printf "\rWaiting for installer to close: \e[93m%s\e[0m" "$c"
sleep 0.1
done
done
stty sane
printf "\r\033[K"
Success "Installer has closed."
# Clean up downloaded files
Info "Cleaning up..."
# Check if the installer and zip file exist and output the appropriate message
for file in "$downloads_dir/VencordInstaller.app" "$downloads_dir/VencordInstaller.MacOs.zip"; do
if [ -e "$file" ]; then
rm -rf "$file"
if [ $? -ne 0 ]; then
Error "Failed to delete $file."
else
Success " - Deleted $file."
fi
else
Error "$file not found."
fi
done
Success "Installation complete. Exiting."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment