diff --git a/launch.sh b/launch.sh index 56398e5..f00bb91 100755 --- a/launch.sh +++ b/launch.sh @@ -14,12 +14,15 @@ fi cd "$WORLDSINSTALL" main() { + if [[ -f "$WORLDSDIR/.update.sh" ]]; then + rm "$WORLDSDIR/.update.sh" + fi sel=$(zenity \ --list \ --title="$TITLE" \ --window-icon="$WORLDSDIR/icon.png" \ --width=300 \ - --height=300 \ + --height=360 \ --cancel-label='Quit' \ --radiolist \ --text 'WorldsPlayer Linux' \ @@ -33,6 +36,7 @@ main() { FALSE 'Settings' \ FALSE 'Clear Cache' \ FALSE 'Force Kill' \ + FALSE 'Update' \ FALSE 'Open Github page' 2>/dev/null) case $sel in 'Launch Worlds') @@ -56,6 +60,8 @@ main() { 'Force Kill' ) killw main ;; + 'Update' ) + update ;; 'Open Github page' ) xdg-open "https://github.com/Vencorr/Worlds-LinuxScript" main ;; @@ -230,6 +236,17 @@ cache () { 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 () { 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"