238 lines
7.3 KiB
Bash
Executable file
238 lines
7.3 KiB
Bash
Executable file
#!/bin/bash
|
|
if [ "$EUID" -ne 0 ]
|
|
then echo "run FE2TY using admin perms."
|
|
exit
|
|
fi
|
|
|
|
if [ ! -f /bin/git ]
|
|
then echo "install git before running."
|
|
exit
|
|
fi
|
|
|
|
if [ ! -f /bin/jq ]
|
|
then echo "install jq before running."
|
|
exit
|
|
fi
|
|
|
|
if [ ! -f /bin/zenity ]
|
|
then echo "install Zenity before running."
|
|
exit
|
|
fi
|
|
|
|
# By RSCC
|
|
## Unlicense
|
|
|
|
main() {
|
|
OPT=$(zenity --list \
|
|
--title="Choose an option" \
|
|
--column="option" \
|
|
"Install TyrianOS" \
|
|
"Revert TyrianOS installation")
|
|
case "$OPT" in
|
|
"Install TyrianOS") ty.install ;;
|
|
"Revert TyrianOS installation") ty.revert ;;
|
|
*) echo "OK!" ;;
|
|
esac
|
|
}
|
|
|
|
clonesection() {
|
|
cd "$HOME" || exit 1
|
|
mkdir -v "$HOME"/87F9W3845GFG5R894OSEG || true
|
|
pushd "$HOME"/87F9W3845GFG5R894OSEG || exit 1
|
|
git clone https://github.com/Icycoide/TyrianOS || limsg.quit s 2 e "Failed to clone"
|
|
pushd TyrianOS/ || exit
|
|
limsg s 2 i "Installing skeleton to all users..."
|
|
echo "40"
|
|
echo "# Installing skeleton to all users"
|
|
cp -vr system_files/etc/skel/* /var/home/*/
|
|
limsg s 2 i "Installing skeleton to all users (hidden)..."
|
|
echo "60"
|
|
echo "# Installing hidden skeleton to all users"
|
|
cp -vr system_files/etc/skel/.* /var/home/*/
|
|
popd || exit 1
|
|
popd || exit 1
|
|
}
|
|
|
|
ty.install() {
|
|
zenity --question --text="By pressing enter, you agree that this tool is not considered an official tool to install TyrianOS and should only be used as a last resort from an existing Fedora installation. Therefore, the creators of this script have absolutely no responsibility in the case of something happening, as it is very experimental. Do you really wish to proceed?" || exit 1
|
|
(
|
|
limsg s 1 i "Getting current deployment origin ref and backing up..."
|
|
echo "0"
|
|
echo "# Backing up current deployment origin ref"
|
|
rpm-ostree status --booted --json | jq -r '.deployments[] | select(.booted) | ."container-image-reference"' > /etc/FE2TY-BURR.txt || limsg.quit s 1 e "Command failed. Do you have permission to write to /etc/ ?"
|
|
limsg s 2 i "Cloning to temporary directory..."
|
|
echo "20"
|
|
echo "# Cloning TyrianOS source to temporary directory"
|
|
clonesection
|
|
limsg s 2 i "Removing temporary directory again..."
|
|
echo "75"
|
|
echo "# Removing temporary directory"
|
|
rm -rv 87F9W3845GFG5R894OSEG
|
|
limsg s 3 i "Switching OS base..."
|
|
echo "90"
|
|
echo "# Rebasing to TyrianOS..."
|
|
rpm-ostree rebase ostree-unverified-registry:ghcr.io/icycoide/tyrianos:latest
|
|
echo "100"
|
|
echo "# Click OK to reboot"
|
|
) |
|
|
zenity --progress \
|
|
--title="FE2TY - Installing TyrianOS" \
|
|
--text="Starting process..." \
|
|
--percentage=0
|
|
limsg s 4 i "Calling to reboot..."
|
|
pkexec reboot
|
|
}
|
|
|
|
ty.revert() {
|
|
zenity --question --text="You are about to revert to the OS base installed before TyrianOS. Do you really wish to proceed?" || exit 1
|
|
(
|
|
limsg s 1 i "Looking for backed up remote reference file..."
|
|
echo "33"
|
|
echo "# Searching for original remote ref"
|
|
cat /etc/FE2TY-BURR.txt || limsg.quit s 1 e "The backed up ref could not be found."
|
|
# shellcheck disable=SC2155
|
|
export REF_BACKUP=$(cat /etc/FE2TY-BURR.txt)
|
|
limsg s 2 i "Attempting rebase..."
|
|
echo "66"
|
|
echo "# Attempting rebase"
|
|
rpm-ostree rebase "$REF_BACKUP" || limsg.quit s 2 e "Could not rebase back to original ref"
|
|
limsg s 3 i "Force deploying image..."
|
|
echo "90"
|
|
echo "# Force deploying image"
|
|
ostree admin deploy "$REF_BACKUP" || limsg s 3 w "Unable to force the deployment of the original ref, but it might still have succeeded regardless."
|
|
echo "99"
|
|
echo "# Rebooting..."
|
|
) |
|
|
zenity --progress \
|
|
--title="FE2TY - Reverting TyrianOS installation" \
|
|
--text="Starting process..." \
|
|
--percentage=0
|
|
reboot
|
|
}
|
|
|
|
function installer.colours() {
|
|
# Reset
|
|
Color_Off='\033[0m' # Text Reset
|
|
|
|
# Regular Colors
|
|
export Black='\033[0;30m' # Black
|
|
export Red='\033[0;31m' # Red
|
|
export Green='\033[0;32m' # Green
|
|
export Yellow='\033[0;33m' # Yellow
|
|
export Blue='\033[0;34m' # Blue
|
|
export Purple='\033[0;35m' # Purple
|
|
export Cyan='\033[0;36m' # Cyan
|
|
export White='\033[0;37m' # White
|
|
|
|
# Bold
|
|
export BBlack='\033[1;30m' # Black
|
|
export BRed='\033[1;31m' # Red
|
|
export BGreen='\033[1;32m' # Green
|
|
export BYellow='\033[1;33m' # Yellow
|
|
export BBlue='\033[1;34m' # Blue
|
|
export BPurple='\033[1;35m' # Purple
|
|
export BCyan='\033[1;36m' # Cyan
|
|
export BWhite='\033[1;37m' # White
|
|
|
|
# Underline
|
|
export UBlack='\033[4;30m' # Black
|
|
export URed='\033[4;31m' # Red
|
|
export UGreen='\033[4;32m' # Green
|
|
export UYellow='\033[4;33m' # Yellow
|
|
export UBlue='\033[4;34m' # Blue
|
|
export UPurple='\033[4;35m' # Purple
|
|
export UCyan='\033[4;36m' # Cyan
|
|
export UWhite='\033[4;37m' # White
|
|
|
|
# Background
|
|
export On_Black='\033[40m' # Black
|
|
export On_Red='\033[41m' # Red
|
|
export On_Green='\033[42m' # Green
|
|
export On_Yellow='\033[43m' # Yellow
|
|
export On_Blue='\033[44m' # Blue
|
|
export On_Purple='\033[45m' # Purple
|
|
export On_Cyan='\033[46m' # Cyan
|
|
export On_White='\033[47m' # White
|
|
|
|
# High Intensity
|
|
export IBlack='\033[0;90m' # Black
|
|
export IRed='\033[0;91m' # Red
|
|
export IGreen='\033[0;92m' # Green
|
|
export IYellow='\033[0;93m' # Yellow
|
|
export IBlue='\033[0;94m' # Blue
|
|
export IPurple='\033[0;95m' # Purple
|
|
export ICyan='\033[0;96m' # Cyan
|
|
export IWhite='\033[0;97m' # White
|
|
|
|
# Bold High Intensity
|
|
export BIBlack='\033[1;90m' # Black
|
|
export BIRed='\033[1;91m' # Red
|
|
export BIGreen='\033[1;92m' # Green
|
|
export BIYellow='\033[1;93m' # Yellow
|
|
export BIBlue='\033[1;94m' # Blue
|
|
export BIPurple='\033[1;95m' # Purple
|
|
export BICyan='\033[1;96m' # Cyan
|
|
export BIWhite='\033[1;97m' # White
|
|
|
|
# High Intensity backgrounds
|
|
export On_IBlack='\033[0;100m' # Black
|
|
export On_IRed='\033[0;101m' # Red
|
|
export On_IGreen='\033[0;102m' # Green
|
|
export On_IYellow='\033[0;103m' # Yellow
|
|
export On_IBlue='\033[0;104m' # Blue
|
|
export On_IPurple='\033[0;105m' # Purple
|
|
export On_ICyan='\033[0;106m' # Cyan
|
|
export On_IWhite='\033[0;107m' # White
|
|
echo -e "${Purple}[i] The colour variables have been set.${Color_Off}"
|
|
}
|
|
|
|
|
|
limsg() {
|
|
export CHECKUSERINPUT
|
|
case $1 in
|
|
s)
|
|
lmsg_one="STAGE"
|
|
;;
|
|
|
|
esac
|
|
lmsg_two=$2
|
|
case $3 in
|
|
i)
|
|
lmsg_three="${BBlue}INFO"
|
|
;;
|
|
w)
|
|
lmsg_three="${BYellow}WARN"
|
|
;;
|
|
e)
|
|
lmsg_three="${BRed}ERRR"
|
|
;;
|
|
*)
|
|
lmsg_three=$3
|
|
;;
|
|
esac
|
|
echo -e "[FE2TY(LiMSG)/${BCyan}${lmsg_one} ${lmsg_two}${Color_Off}/${lmsg_three}${Color_Off}]: $4"
|
|
export ADD
|
|
}
|
|
|
|
limsg.quit() {
|
|
case $1 in
|
|
s)
|
|
lmsg_one="STAGE"
|
|
;;
|
|
|
|
esac
|
|
lmsg_two=$2
|
|
case $3 in
|
|
e)
|
|
lmsg_three="${BRed}ERRR"
|
|
;;
|
|
*)
|
|
lmsg_three=$3
|
|
;;
|
|
esac
|
|
zenity --error --text="$4"
|
|
exit 1
|
|
}
|
|
|
|
installer.colours
|
|
main "$1"
|