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"
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"