Skip to content

Commit

Permalink
Create scripts to easily upgrade Phoenix
Browse files Browse the repository at this point in the history
Signed-off-by: celenity <[email protected]>
  • Loading branch information
celenityy committed Dec 16, 2024
1 parent 57ab540 commit 2d6a69b
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 0 deletions.
68 changes: 68 additions & 0 deletions upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

## Colours
blue='\e[1;34m';
brown='\e[0;33m';
coloroff='\e[0m'; # Colour off
cyan='\e[1;36m';
gray='\e[1;30m';
green='\e[0;32m';
purple='\e[0;35m';
red='\e[1;31m';

## Download and run upgrade script
upgrade_phoenix() {
wget -nv $1
echo
echo
sudo bash $2
}

## Downloaded files save in /tmp
cd /tmp

## Scripts are here
URL="https://phoenix.celenity.dev/upgrade_scripts"

## Scripts file
SCRIPT=("arch_upgrade_paru.sh"
"arch_upgrade_yay.sh"
"fedora_upgrade.sh"
"macos_upgrade.sh")

echo -e "${purple}Thank you for upgrading to the 'New' Phoenix!${coloroff}";
echo -e "";
echo -e "${brown}To begin, please choose your paltform.${coloroff}";
echo -e "${brown}Your options are:${coloroff}";
echo -e "${cyan}arch${coloroff} - ${green}Arch Linux (AUR)${coloroff}";
echo -e "${blue}fedora${coloroff} - ${green}Fedora Linux${coloroff}";
echo -e "${gray}macOS${coloroff} - ${green}macOS${coloroff}";
read -p 'Enter your selection: ' DISTRO

case ${DISTRO} in

"arch" | "Arch" | "ARCH")
echo -e "";
echo -e "${brown}Please choose your AUR helper.${coloroff}";
echo -e "${brown}Your options are:${coloroff}";
echo -e "${blue}paru${coloroff} - ${green}Paru${coloroff}";
echo -e "${red}yay${coloroff} - ${green}Yay (Yet Another Yogurt)${coloroff}";
read -p 'Enter your selection: ' HELPER
case ${HELPER} in
"paru" | "Paru" | "PARU")
upgrade_phoenix ${URL}/${SCRIPT[0]} ${SCRIPT[0]}
;;
"yay" | "Yay" | "YAY")
upgrade_phoenix ${URL}/${SCRIPT[1]} ${SCRIPT[1]}
;;
esac
;;

"fedora"| "Fedora" | "FEDORA")
upgrade_phoenix ${URL}/${SCRIPT[3]} ${SCRIPT[3]}
;;

"macOS" | "macos" | "MacOS" | "MACOS")
upgrade_phoenix ${URL}/${SCRIPT[4]} ${SCRIPT[4]}
;;
esac
47 changes: 47 additions & 0 deletions upgrade_scripts/arch_upgrade_paru.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /usr/bin/env bash


## Functions
echo_red_text() {
echo -e "\033[31m$1\033[0m"
}

echo_green_text() {
echo -e "\033[32m$1\033[0m"
}

error_fn() {
echo
echo -e "\033[31mSomething went wrong! The script failed.\033[0m"
echo -e "\033[31mPlease report this (with the output message) to https://phoenix.celenity.dev/issues\033[0m"
echo
exit 1
}


## Upgrade Phoenix
echo_green_text "Removing legacy phoenix.cfg..."
sudo rm -f /usr/lib/firefox/phoenix.cfg || error_fn
echo

echo_green_text "Removing legacy phoenix.js..."
sudo rm -f /etc/firefox/defaults/pref/phoenix.js || error_fn
echo

echo_green_text "Removing legacy mozilla.cfg if installed..."
sudo rm -f /usr/lib/firefox/mozilla.cfg || error_fn
echo

echo_green_text "Removing legacy local-settings.js if installed..."
sudo rm -f /usr/lib/firefox/defaults/pref/local-settings.js || error_fn
echo

echo_green_text "Uninstalling legacy phoenix-policies..."
paru -Rcns phoenix-policies || error_fn
echo

echo_green_text "Installing phoenix-arch from the AUR..."
paru -S phoenix-arch || error_fn
echo

echo_green_text "Thank you for upgrading Phoenix! Enjoy :)"
47 changes: 47 additions & 0 deletions upgrade_scripts/arch_upgrade_yay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /usr/bin/env bash


## Functions
echo_red_text() {
echo -e "\033[31m$1\033[0m"
}

echo_green_text() {
echo -e "\033[32m$1\033[0m"
}

error_fn() {
echo
echo -e "\033[31mSomething went wrong! The script failed.\033[0m"
echo -e "\033[31mPlease report this (with the output message) to https://phoenix.celenity.dev/issues\033[0m"
echo
exit 1
}


## Upgrade Phoenix
echo_green_text "Removing legacy phoenix.cfg..."
sudo rm -f /usr/lib/firefox/phoenix.cfg || error_fn
echo

echo_green_text "Removing legacy phoenix.js..."
sudo rm -f /etc/firefox/defaults/pref/phoenix.js || error_fn
echo

echo_green_text "Removing legacy mozilla.cfg if installed..."
sudo rm -f /usr/lib/firefox/mozilla.cfg || error_fn
echo

echo_green_text "Removing legacy local-settings.js if installed..."
sudo rm -f /usr/lib/firefox/defaults/pref/local-settings.js || error_fn
echo

echo_green_text "Uninstalling legacy phoenix-policies..."
yay -Rcns phoenix-policies || error_fn
echo

echo_green_text "Installing phoenix-arch from the AUR..."
yay -S phoenix-arch || error_fn
echo

echo_green_text "Thank you for upgrading Phoenix! Enjoy :)"
59 changes: 59 additions & 0 deletions upgrade_scripts/fedora_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /usr/bin/env bash


## Functions
echo_red_text() {
echo -e "\033[31m$1\033[0m"
}

echo_green_text() {
echo -e "\033[32m$1\033[0m"
}

error_fn() {
echo
echo -e "\033[31mSomething went wrong! The script failed.\033[0m"
echo -e "\033[31mPlease report this (with the output message) to https://phoenix.celenity.dev/issues\033[0m"
echo
exit 1
}


## Upgrade Phoenix
echo_green_text "Removing legacy phoenix.cfg..."
sudo rm -f /usr/lib64/firefox/phoenix.cfg || error_fn
echo

echo_green_text "Removing legacy phoenix.js..."
sudo rm -f /etc/firefox/defaults/pref/phoenix.js || error_fn
echo

echo_green_text "Removing legacy mozilla.cfg if installed..."
sudo rm -f /usr/lib64/firefox/mozilla.cfg || error_fn
echo

echo_green_text "Removing legacy local-settings.js if installed..."
sudo rm -f /usr/lib64/firefox/defaults/pref/local-settings.js || error_fn
echo

echo_green_text "Uninstalling legacy phoenix-policies..."
sudo dnf remove phoenix-policies || error_fn
echo

echo_green_text "Removing legacy Phoenix-Policies COPR Repo..."
sudo dnf copr remove celenity/phoenix-policies || error_fn
echo

echo_green_text "Adding celenity's COPR Repo to DNF..."
sudo dnf copr enable celenity/copr || error_fn
echo

echo_green_text "Updating DNF cache..."
sudo dnf update --refresh || error_fn
echo

echo_green_text "Installing phoenix package..."
sudo dnf install phoenix || error_fn
echo

echo_green_text "Thank you for upgrading Phoenix! Enjoy :)"
75 changes: 75 additions & 0 deletions upgrade_scripts/macos_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#! /usr/bin/env bash


## Functions
echo_red_text() {
echo -e "\033[31m$1\033[0m"
}

echo_green_text() {
echo -e "\033[32m$1\033[0m"
}

error_fn() {
echo
echo -e "\033[31mSomething went wrong! The script failed.\033[0m"
echo -e "\033[31mPlease report this (with the output message) to https://phoenix.celenity.dev/issues\033[0m"
echo
exit 1
}


## Upgrade Phoenix
echo_green_text "Removing legacy phoenix.cfg..."
sudo rm -f /Applications/Firefox.app/Contents/Resources/phoenix.cfg || error_fn
echo

echo_green_text "Removing legacy phoenix.js..."
sudo rm -f /Applications/Firefox.app/Contents/Resources/defaults/pref/phoenix.js || error_fn
echo

echo_green_text "Removing legacy mozilla.cfg if installed..."
sudo rm -f /Applications/Firefox.app/Contents/Resources/mozilla.cfg || error_fn
echo

echo_green_text "Removing legacy local-settings.js if installed..."
sudo rm -f /Applications/Firefox.app/Contents/Resources/defaults/pref/local-settings.js || error_fn
echo

echo_green_text "Unloading ~/Library/LaunchAgents/com.user.updatepoliciesphoenix.plist..."
sudo launchctl unload -w ~/Library/LaunchAgents/com.user.updatepoliciesphoenix.plist || error_fn
echo

echo_green_text "Removing ~/Library/LaunchAgents/com.user.updatepoliciesphoenix.plist..."
sudo rm -f ~/Library/LaunchAgents/com.user.updatepoliciesphoenix.plist || error_fn
echo

echo_green_text "Removing /usr/local/sbin/update_policies_phoenix.sh..."
sudo rm -f /usr/local/sbin/update_policies_phoenix.sh || error_fn
echo

echo_green_text "Removing legacy policies.json..."
sudo rm -f /Applications/Firefox.app/Contents/Resources/distribution/policies.json || error_fn
echo

echo_green_text "Uninstalling legacy phoenix-policies..."
brew uninstall phoenix-policies || error_fn
echo

echo_green_text "Removing legacy Phoenix-Policies-macOS Tap from Homebrew if installed..."
brew untap celenity/Phoenix-Policies-macOS || error_fn
echo

echo_green_text "Adding celenity's Tap to Homebrew..."
brew tap celenity/tap https://codeberg.org/celenity/tap || error_fn
echo

echo_green_text "Updating Homebrew cache..."
brew update || error_fn
echo

echo_green_text "Installing phoenix package..."
brew install phoenix-osx || error_fn
echo

echo_green_text "Thank you for upgrading Phoenix! Enjoy :)"

0 comments on commit 2d6a69b

Please sign in to comment.