From 00aa26d56569731e61f6f6b923af8150a24e11f2 Mon Sep 17 00:00:00 2001 From: Nicole George Date: Mon, 10 Feb 2020 00:09:45 -0600 Subject: [PATCH] Add Launch Script --- launch.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 launch.sh diff --git a/launch.sh b/launch.sh new file mode 100644 index 0000000..0c57a8d --- /dev/null +++ b/launch.sh @@ -0,0 +1,71 @@ +#!/bin/bash +export WORLDSDIR="$(dirname "$(readlink -f "$0")")" +export WINEPREFIX=$WORLDSDIR/prefix +export WORLDSINSTALL="$WINEPREFIX/drive_c/Program Files/Worlds/" +export WINEARCH=win32 +cd "$WORLDSINSTALL" +mkdir -p $WORLDSDIR/backups $WORLDSDIR/themes + +main() { + sel=$(zenity \ + --title="Worlds" \ + --window-icon="$WORLDSDIR/icon.png" \ + --width=360 \ + --height=280 \ + --cancel-label='Exit' \ + --list \ + --text 'WorldsPlayer Linux Wrapper' \ + --radiolist \ + --column '' \ + --column 'Options' \ + TRUE 'Start Worlds' \ + FALSE 'Open Worlds folder' \ + FALSE 'Edit worlds.ini' \ + FALSE 'Backup Worlds files' \ + FALSE 'Restore last backup' \ + FALSE 'Set theme' \ + FALSE 'Clear Cache' 2>/dev/null ) + case $sel in + 'Start Worlds') + /opt/Games/Worlds/proton/dist/bin/wine "$WORLDSINSTALL/run.exe" ;; + 'Open Worlds folder') + gio open "$WORLDSINSTALL" + main ;; + 'Edit worlds.ini') + xdg-open "$WORLDSINSTALL/worlds.ini" + main ;; + 'Backup Worlds files') + mkdir -p "$WORLDSDIR/backup" + bkup=$(zenity --file-selection --title="Select Backup folder to backup to" --directory --filename="$WORLDSDIR/backups/" --save) + echo "$WORLDSINSTALL/worlds.ini >> $bkup/worlds.ini" + cp -r "$WORLDSINSTALL/worlds.ini" "$bkup/worlds.ini" + echo "$WORLDSINSTALL/gamma.avatars >> $bkup/gamma.avatars" + cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars" + echo "$WORLDSINSTALL/gamma.worldsmarks >> $bkup/gamma.worldsmarks" + cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks" + main ;; + 'Restore last backup') + mkdir -p "$WORLDSDIR/backup" + rbkup=$(zenity --file-selection --title="Select Backup folder to restore from" --directory --filename="$WORLDSDIR/backups/") + echo "$rbkup/worlds.ini >> $WORLDSINSTALL/worlds.ini" + cp -r "$rbkup/worlds.ini" "$WORLDSINSTALL/worlds.ini" + echo "$rbkup/gamma.avatars >> $WORLDSINSTALL/gamma.avatars" + cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars" + echo "$rbkup/gamma.worldsmarks >> $WORLDSINSTALL/gamma.worldsmarks" + cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks" + main ;; + 'Set theme' ) + seltheme=$(zenity --file-selection --title="Select a theme folder" --directory --filename="$WORLDSDIR/themes/") + for i in $seltheme/*; + do FILENAME="$(basename $i)" + echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME" + ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME" + done + main ;; + 'Clear Cache') + rm -rf "$WORLDSINSTALL/cachedir" + main ;; + esac +} + +main