Added update option

This commit is contained in:
Nicholas George 2020-09-09 15:17:26 -05:00
parent 3b1bb41013
commit 5ab1fbb77c

View File

@ -14,12 +14,15 @@ fi
cd "$WORLDSINSTALL" cd "$WORLDSINSTALL"
main() { main() {
if [[ -f "$WORLDSDIR/.update.sh" ]]; then
rm "$WORLDSDIR/.update.sh"
fi
sel=$(zenity \ sel=$(zenity \
--list \ --list \
--title="$TITLE" \ --title="$TITLE" \
--window-icon="$WORLDSDIR/icon.png" \ --window-icon="$WORLDSDIR/icon.png" \
--width=300 \ --width=300 \
--height=300 \ --height=360 \
--cancel-label='Quit' \ --cancel-label='Quit' \
--radiolist \ --radiolist \
--text 'WorldsPlayer Linux' \ --text 'WorldsPlayer Linux' \
@ -33,6 +36,7 @@ main() {
FALSE 'Settings' \ FALSE 'Settings' \
FALSE 'Clear Cache' \ FALSE 'Clear Cache' \
FALSE 'Force Kill' \ FALSE 'Force Kill' \
FALSE 'Update' \
FALSE 'Open Github page' 2>/dev/null) FALSE 'Open Github page' 2>/dev/null)
case $sel in case $sel in
'Launch Worlds') 'Launch Worlds')
@ -56,6 +60,8 @@ main() {
'Force Kill' ) 'Force Kill' )
killw killw
main ;; main ;;
'Update' )
update ;;
'Open Github page' ) 'Open Github page' )
xdg-open "https://github.com/Vencorr/Worlds-LinuxScript" xdg-open "https://github.com/Vencorr/Worlds-LinuxScript"
main ;; main ;;
@ -230,6 +236,17 @@ cache () {
fi fi
} }
update () {
NEWLAUNCHFILE="https://raw.githubusercontent.com/Vencorr/Worlds-LinuxScript/master/launch.sh"
UPDATEFILE="$WORLDSDIR/.update.sh"
touch "$UPDATEFILE"
echo "wget -N -O\"$WORLDSDIR/launch.sh\" \"$NEWLAUNCHFILE\"" >> "$UPDATEFILE"
echo "chmod +x \"$WORLDSDIR/launch.sh\"" >> "$UPDATEFILE"
echo "\"$WORLDSDIR/launch.sh\"" >> "$UPDATEFILE"
chmod +x "$UPDATEFILE"
sh "$UPDATEFILE"
}
killw () { killw () {
killall WorldsPlayer.exe run.exe javaw.exe jrew.exe run.bat | zenity --progress --no-buttons --title="$TITLE - Killing Processes" --width=300 --height=50 --auto-close --auto-kill killall WorldsPlayer.exe run.exe javaw.exe jrew.exe run.bat | zenity --progress --no-buttons --title="$TITLE - Killing Processes" --width=300 --height=50 --auto-close --auto-kill
zenity --error --text="Killed all possible running processes of Worlds." --width=240 --height=40 --title="$TITLE - Kill" --window-icon="$WORLDSDIR/icon.png" zenity --error --text="Killed all possible running processes of Worlds." --width=240 --height=40 --title="$TITLE - Kill" --window-icon="$WORLDSDIR/icon.png"