From dc26f3e0d789a717e0653576e83a61836d3575cb Mon Sep 17 00:00:00 2001 From: RisedSky Date: Sat, 5 Dec 2020 18:21:41 +0100 Subject: [PATCH 1/3] Create PVEDiscordDarkUpdate.sh Permit to update the python file --- PVEDiscordDarkUpdate.sh | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 PVEDiscordDarkUpdate.sh diff --git a/PVEDiscordDarkUpdate.sh b/PVEDiscordDarkUpdate.sh new file mode 100644 index 0000000..2c30ae2 --- /dev/null +++ b/PVEDiscordDarkUpdate.sh @@ -0,0 +1,73 @@ +#!/bin/bash +#Script by RisedSky to allow users to update their python script of ProxmoxDiscordDark +#Created : 05/12/2020 + + +currentuser=`whoami | grep 'root'` +default="\e[39m" +green="\e[32m" +red="\e[91m" +yellow="\e[93m" + +clear +echo -ne "Verifying that you're root to prevent perm errors \r" +sleep 1 +if [ -z "$currentuser" ] +then + echo -ne "Verifying that you're root to prevent perm errors$red [ERROR] $default \r" + echo -ne "\nYou are not root !" + exit 1 +fi + +echo -ne "Verifying that you're root to prevent perm errors$green [OK] $default \r" +echo -ne '\n' + +sleep 1 +echo -ne '\n' + +sleep 1 +echo -ne '# (0%) Checking the latestversion\r' +latestversion=`curl -s "https://api.github.com/repos/Weilbyte/PVEDiscordDark/releases/latest" | awk -F '"' '/tag_name/{print $4}'` +echo -ne '####################### (100%) Checking the latestversion\r' +sleep 1 +echo -ne '\n' + +file="./currentversion.txt" +currentversion="" +if [ ! -f "$file" ] +then + echo "$latestversion" > "$file" + currentversion="$latestversion" +else + currentversion=`cat $file` +fi + +echo "Your version : $currentversion" +echo "Latest version : $latestversion" + +if [ ! "$currentversion" = "$latestversion" ] +then + #Not up tp date + read -p "$(echo -e $yellow)[Warning] Your version is different, would you like to update ? $(echo -e $default)[y/n]" -n 1 -r + echo "" # (optional) move to a new line + if [[ $REPLY =~ ^[YyOo]$ ]] + then + echo -ne "Downloading...\n" + wget -O "PVEDiscordDark.py" "https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.py" + echo "$latestversion" > $file + read -p "$(echo -e $yellow)[Warning] Start the updated script ? $(echo -e $default)[y/n]" -n 1 -r + echo "" # (optional) move to a new line + if [[ $REPLY =~ ^[YyOo]$ ]] + then + python3 PVEDiscordDark.py + exit 0 + fi + else + echo -ne "Exiting...\n" + exit 0 + fi +else + #Up to date + echo -e "$green""You have the latest version of the script ! $default" + exit 0 +fi From 688ba998a20559c3cf513aeebc37d6be5a8b79fc Mon Sep 17 00:00:00 2001 From: RisedSky Date: Fri, 11 Dec 2020 08:59:21 +0100 Subject: [PATCH 2/3] Changes. --- UtilityUpdater.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 UtilityUpdater.sh diff --git a/UtilityUpdater.sh b/UtilityUpdater.sh new file mode 100644 index 0000000..a9c85fa --- /dev/null +++ b/UtilityUpdater.sh @@ -0,0 +1,73 @@ +#!/bin/bash +#Script by RisedSky to allow users to update their python script of ProxmoxDiscordDark +#Created : 05/12/2020 + + +currentuser=`whoami | grep 'root'` +default="\e[39m" +green="\e[32m" +red="\e[91m" +yellow="\e[93m" + +clear +echo -ne "Verifying that you're root to prevent perm errors \r" +sleep 1 +if [ -z "$currentuser" ] +then + echo -ne "Verifying that you're root to prevent perm errors$red [ERROR] $default \r" + echo -ne "\nYou are not root !" + exit 1 +fi + +echo -ne "Verifying that you're root to prevent perm errors$green [OK] $default \r" +echo -ne '\n' + +sleep 1 +echo -ne '\n' + +sleep 1 +echo -ne '# (0%) Checking the latestversion\r' +latestversion=`curl -s "https://api.github.com/repos/Weilbyte/PVEDiscordDark/releases/latest" | awk -F '"' '/tag_name/{print $4}'` +echo -ne '####################### (100%) Checking the latestversion\r' +sleep 1 +echo -ne '\n' + +file="./currentversion.txt" +currentversion="" +if [ ! -f "$file" ] +then + echo "$latestversion" > "$file" + currentversion="$latestversion" +else + currentversion=`cat $file` +fi + +echo "Your version : $currentversion" +echo "Latest version : $latestversion" + +if [ ! "$currentversion" = "$latestversion" ] +then + #Not up tp date + read -p "$(echo -e $yellow)[Warning] Your version is different, would you like to update ? $(echo -e $default)[y/n]" -n 1 -r + echo "" # (optional) move to a new line + if [[ $REPLY =~ ^[YyOo]$ ]] + then + echo -ne "Downloading...\n" + wget -O "PVEDiscordDark.py" "https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.py" + echo "$latestversion" > $file + read -p "$(echo -e $yellow)[Warning] Start the updated script ? $(echo -e $default)[y/n]" -n 1 -r + echo "" # (optional) move to a new line + if [[ $REPLY =~ ^[YyOo]$ ]] + then + python3 PVEDiscordDark.py + exit 0 + fi + else + echo -ne "Exiting...\n" + exit 0 + fi +else + #Up to date + echo -e "$green""You have the latest version of the script ! $default" + exit 0 +fi \ No newline at end of file From 0522a936d209c08e36fd1c0939532750774e413c Mon Sep 17 00:00:00 2001 From: RisedSky Date: Sat, 12 Dec 2020 21:59:10 +0100 Subject: [PATCH 3/3] Delete PVEDiscordDarkUpdate.sh --- PVEDiscordDarkUpdate.sh | 73 ----------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 PVEDiscordDarkUpdate.sh diff --git a/PVEDiscordDarkUpdate.sh b/PVEDiscordDarkUpdate.sh deleted file mode 100644 index 2c30ae2..0000000 --- a/PVEDiscordDarkUpdate.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -#Script by RisedSky to allow users to update their python script of ProxmoxDiscordDark -#Created : 05/12/2020 - - -currentuser=`whoami | grep 'root'` -default="\e[39m" -green="\e[32m" -red="\e[91m" -yellow="\e[93m" - -clear -echo -ne "Verifying that you're root to prevent perm errors \r" -sleep 1 -if [ -z "$currentuser" ] -then - echo -ne "Verifying that you're root to prevent perm errors$red [ERROR] $default \r" - echo -ne "\nYou are not root !" - exit 1 -fi - -echo -ne "Verifying that you're root to prevent perm errors$green [OK] $default \r" -echo -ne '\n' - -sleep 1 -echo -ne '\n' - -sleep 1 -echo -ne '# (0%) Checking the latestversion\r' -latestversion=`curl -s "https://api.github.com/repos/Weilbyte/PVEDiscordDark/releases/latest" | awk -F '"' '/tag_name/{print $4}'` -echo -ne '####################### (100%) Checking the latestversion\r' -sleep 1 -echo -ne '\n' - -file="./currentversion.txt" -currentversion="" -if [ ! -f "$file" ] -then - echo "$latestversion" > "$file" - currentversion="$latestversion" -else - currentversion=`cat $file` -fi - -echo "Your version : $currentversion" -echo "Latest version : $latestversion" - -if [ ! "$currentversion" = "$latestversion" ] -then - #Not up tp date - read -p "$(echo -e $yellow)[Warning] Your version is different, would you like to update ? $(echo -e $default)[y/n]" -n 1 -r - echo "" # (optional) move to a new line - if [[ $REPLY =~ ^[YyOo]$ ]] - then - echo -ne "Downloading...\n" - wget -O "PVEDiscordDark.py" "https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.py" - echo "$latestversion" > $file - read -p "$(echo -e $yellow)[Warning] Start the updated script ? $(echo -e $default)[y/n]" -n 1 -r - echo "" # (optional) move to a new line - if [[ $REPLY =~ ^[YyOo]$ ]] - then - python3 PVEDiscordDark.py - exit 0 - fi - else - echo -ne "Exiting...\n" - exit 0 - fi -else - #Up to date - echo -e "$green""You have the latest version of the script ! $default" - exit 0 -fi