Update Launch
This commit is contained in:
parent
87da64f126
commit
293b06cb57
241
launch.sh
241
launch.sh
|
@ -3,17 +3,12 @@ export TITLE="Worlds Linux"
|
||||||
export WORLDSDIR="$(dirname "$(readlink -f "$0")")"
|
export WORLDSDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
export WINEPREFIX=$WORLDSDIR/prefix
|
export WINEPREFIX=$WORLDSDIR/prefix
|
||||||
export WORLDSINSTALL="$WINEPREFIX/drive_c/Program Files/Worlds/WorldsPlayer by Worlds.com"
|
export WORLDSINSTALL="$WINEPREFIX/drive_c/Program Files/Worlds/WorldsPlayer by Worlds.com"
|
||||||
|
export SETTHEME="DEFAULT"
|
||||||
|
|
||||||
mkdir -p $WORLDSDIR/backups $WORLDSDIR/themes
|
mkdir -p $WORLDSDIR/backups $WORLDSDIR/themes
|
||||||
|
|
||||||
if [ -f "$WORLDSDIR/wine.worldslinux" ]; then
|
if [ -f "$WORLDSDIR/wrldslinux" ]; then
|
||||||
export WINE=$(cat "$WORLDSDIR/wine.worldslinux")
|
source "$WORLDSDIR/wrldslinux"
|
||||||
fi
|
|
||||||
if [ -f "$WORLDSDIR/wineprefix.worldslinux" ]; then
|
|
||||||
export WINEPREFIX=$(cat "$WORLDSDIR/wineprefix.worldslinux")
|
|
||||||
fi
|
|
||||||
if [ -f "$WORLDSDIR/worlds.worldslinux" ]; then
|
|
||||||
export WORLDSINSTALL=$(cat "$WORLDSDIR/worlds.worldslinux")
|
|
||||||
fi
|
fi
|
||||||
cd "$WORLDSINSTALL"
|
cd "$WORLDSINSTALL"
|
||||||
|
|
||||||
|
@ -22,45 +17,45 @@ main() {
|
||||||
--list \
|
--list \
|
||||||
--title="$TITLE" \
|
--title="$TITLE" \
|
||||||
--window-icon="$WORLDSDIR/icon.png" \
|
--window-icon="$WORLDSDIR/icon.png" \
|
||||||
--width=300 \
|
--width=320 \
|
||||||
--height=340 \
|
--height=280 \
|
||||||
--cancel-label='Quit' \
|
--cancel-label='Quit' \
|
||||||
--list \
|
--radiolist \
|
||||||
--text 'WorldsPlayer Linux' \
|
--text 'WorldsPlayer Linux' \
|
||||||
|
--column '' \
|
||||||
--column 'Options' \
|
--column 'Options' \
|
||||||
--hide-header \
|
--hide-header \
|
||||||
'Launch Worlds' \
|
TRUE 'Launch Worlds' \
|
||||||
'Open Logger' \
|
FALSE 'Launch Worlds with Logger' \
|
||||||
'Open Worlds folder' \
|
FALSE 'Open Worlds folder' \
|
||||||
'Edit worlds.ini' \
|
FALSE 'Settings' \
|
||||||
'Backup Worlds files' \
|
FALSE 'Clear Cache' \
|
||||||
'Restore from backup' \
|
FALSE 'Force Kill' \
|
||||||
'Set theme' \
|
FALSE 'Open Github page' 2>/dev/null)
|
||||||
'Settings' \
|
|
||||||
'Clear Cache' \
|
|
||||||
'FORCE KILL' 2>/dev/null)
|
|
||||||
case $sel in
|
case $sel in
|
||||||
'Launch Worlds')
|
'Launch Worlds')
|
||||||
launch ;;
|
launch ;;
|
||||||
'Open Logger')
|
'Launch Worlds with Logger')
|
||||||
logger ;;
|
launch && tail -F "$WORLDSINSTALL/Gamma.Log.open" | zenity --text-info --auto-scroll --height=480 --width=768 --title="$TITLE - Log" --window-icon="$WORLDSDIR/icon.png" --text="Gamma.Log.open" ;;
|
||||||
'Open Worlds folder')
|
'Open Worlds folder')
|
||||||
folder ;;
|
gio open "$WORLDSINSTALL" ;;
|
||||||
'Edit worlds.ini')
|
|
||||||
ini ;;
|
|
||||||
'Backup Worlds files')
|
|
||||||
backup ;;
|
|
||||||
'Restore from backup')
|
|
||||||
restore ;;
|
|
||||||
'Set theme' )
|
|
||||||
theme ;;
|
|
||||||
'Settings' )
|
'Settings' )
|
||||||
settings ;;
|
settings
|
||||||
|
main ;;
|
||||||
'Clear Cache')
|
'Clear Cache')
|
||||||
cache ;;
|
cache
|
||||||
'FORCE KILL' )
|
main ;;
|
||||||
kill ;;
|
'Force Kill' )
|
||||||
|
killw
|
||||||
|
main ;;
|
||||||
|
'Open Github page' )
|
||||||
|
xdg-open "https://github.com/Vencorr/Worlds-LinuxScript"
|
||||||
|
main ;;
|
||||||
esac
|
esac
|
||||||
|
if [ "$?" != 0 ]
|
||||||
|
then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
launch () {
|
launch () {
|
||||||
|
@ -72,23 +67,111 @@ launch () {
|
||||||
elif [ -f "$WORLDSINSTALL/$WORLDSOLD" ]; then
|
elif [ -f "$WORLDSINSTALL/$WORLDSOLD" ]; then
|
||||||
$WINE "$WORLDSINSTALL/$WORLDSOLD"
|
$WINE "$WORLDSINSTALL/$WORLDSOLD"
|
||||||
else
|
else
|
||||||
$WINE "$WORLDSINSTALL/$WORLDSLEGACY"
|
$WINE cmd /c "$WORLDSINSTALL/$WORLDSLEGACY"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
logger () {
|
settings () {
|
||||||
tail -F "$WORLDSINSTALL/Gamma.Log.open" | zenity --text-info --auto-scroll --height=400 --width=500 --title="$TITLE - Log" --window-icon="$WORLDSDIR/icon.png" --text="Gamma.Log.open"
|
SETSEL=$(zenity --list --title="$TITLE - Settings" --text="Settings for Worlds Linux" --column='Option' --column='Value' --cancel-label="Back" --width=540 --height=360 --window-icon="$WORLDSDIR/icon.png" \
|
||||||
main
|
"Wine Location" "$WINE" \
|
||||||
}
|
"Prefix Location" "$WINEPREFIX" \
|
||||||
|
"Worlds Location" "$WORLDSINSTALL" \
|
||||||
folder () {
|
"Edit worlds.ini" "" \
|
||||||
gio open "$WORLDSINSTALL"
|
"Wine Configuration" "" \
|
||||||
main
|
"Set Theme" "$SETTHEME" \
|
||||||
}
|
"Install Theme" "" \
|
||||||
|
"Backup" "" \
|
||||||
ini () {
|
"Restore" "" \
|
||||||
|
2>/dev/null)
|
||||||
|
case $SETSEL in
|
||||||
|
'Wine Location')
|
||||||
|
WINESEL=$(zenity --entry --title="$WTITLE - Wine Binary Location" --text="Path to wine binary" --entry-text="$WINE" --window-icon="$WORLDSDIR/icon.png")
|
||||||
|
if [[ ! $? -eq 1 ]]; then
|
||||||
|
export WINE=$WINESEL
|
||||||
|
fi
|
||||||
|
settings ;;
|
||||||
|
'Prefix Location')
|
||||||
|
PREFSEL=$(zenity --entry --title="$WTITLE - Wine Prefix Location" --text="Path to Wine Prefix." --entry-text="$WINEPREFIX" --window-icon="$WORLDSDIR/icon.png")
|
||||||
|
if [[ ! $? -eq 1 ]]; then
|
||||||
|
export WINEPREFIX=$PREFSEL
|
||||||
|
fi
|
||||||
|
settings ;;
|
||||||
|
'Worlds Location')
|
||||||
|
WORLDSEL=$(zenity --entry --title="$WTITLE - Worlds Location" --text="Path to Worlds Folder" --entry-text="$WORLDSINSTALL" --window-icon="$WORLDSDIR/icon.png")
|
||||||
|
if [[ ! $? -eq 1 ]]; then
|
||||||
|
export WORLDSINSTALL=$WORLDSEL
|
||||||
|
fi
|
||||||
|
settings ;;
|
||||||
|
'Edit worlds.ini')
|
||||||
xdg-open "$WORLDSINSTALL/worlds.ini"
|
xdg-open "$WORLDSINSTALL/worlds.ini"
|
||||||
main
|
settings ;;
|
||||||
|
'Wine Configuration')
|
||||||
|
"$WINE"cfg
|
||||||
|
settings ;;
|
||||||
|
'Set Theme')
|
||||||
|
theme
|
||||||
|
settings ;;
|
||||||
|
'Backup')
|
||||||
|
backup
|
||||||
|
settings ;;
|
||||||
|
'Restore')
|
||||||
|
restore
|
||||||
|
settings ;;
|
||||||
|
esac
|
||||||
|
echo "# Configuration for Worlds on Linux." > "$WORLDSDIR/wrldslinux"
|
||||||
|
echo "export WINE=\"$WINE\"" >> "$WORLDSDIR/wrldslinux"
|
||||||
|
echo "export WINEPREFIX=\"$WINEPREFIX\"" >> "$WORLDSDIR/wrldslinux"
|
||||||
|
echo "export WORLDSINSTALL=\"$WORLDSINSTALL\"" >> "$WORLDSDIR/wrldslinux"
|
||||||
|
echo "export SETTHEME=\"$SETTHEME\"" >> "$WORLDSDIR/wrldslinux"
|
||||||
|
echo "source \"$WORLDSDIR/wlrdscmd\"" >> "$WORLDSDIR/wrldslinux"
|
||||||
|
}
|
||||||
|
|
||||||
|
theme () {
|
||||||
|
declare -a acceptimg=(
|
||||||
|
"actb.gif"
|
||||||
|
"actm.gif"
|
||||||
|
"actt.gif"
|
||||||
|
"back.gif"
|
||||||
|
"changeav.gif"
|
||||||
|
"drive.gif"
|
||||||
|
"dyrwtq.gif"
|
||||||
|
"explore.gif"
|
||||||
|
"friends.gif"
|
||||||
|
"hangong.gif"
|
||||||
|
"mfriends.gif"
|
||||||
|
"moreinfo.gif"
|
||||||
|
"notavail.gif"
|
||||||
|
"opnscrnc.gif"
|
||||||
|
"override.ini"
|
||||||
|
"pwc.gif"
|
||||||
|
"quit.gif"
|
||||||
|
"rtpanel.gif"
|
||||||
|
)
|
||||||
|
declare -A map
|
||||||
|
for key in "${!acceptimg[@]}"; do map[${acceptimg[$key]}]="$key"; done
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p "$WORLDSDIR/themes"
|
||||||
|
cd "$WORLDSDIR/themes"
|
||||||
|
# Due to some bug, this won't even accept a directory despite the option being defined. Instead using text entry.
|
||||||
|
# seltheme=$(zenity --file-selection --directory --title="Select a theme folder" --window-icon="$WORLDSDIR/icon.png")
|
||||||
|
seltheme=$(zenity --entry --title="$WTITLE - Worlds Theme" --text="Enter a theme directory." --entry-text="$WORLDSDIR/themes/" --window-icon="$WORLDSDIR/icon.png")
|
||||||
|
if [[ ! $? -eq 1 ]]; then
|
||||||
|
rename 'y/A-Z/a-z/' "$seltheme/*"
|
||||||
|
for i in $seltheme/*;
|
||||||
|
do FILENAME="$(basename $i)"
|
||||||
|
if [[ -n "${map[$i]}" ]]; then
|
||||||
|
echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME"
|
||||||
|
ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
export SETTHEME="$(basename $seltheme)"
|
||||||
|
zenity --info --text="Successfully set theme to $(basename $seltheme)." --width=240 --height=40 --title="$TITLE - Theme" --window-icon="$WORLDSDIR/icon.png"
|
||||||
|
else
|
||||||
|
zenity --error --text="Couldn't set $(basename $seltheme). Does it exist?" --width=240 --height=40 --title="$TITLE - Theme" --window-icon="$WORLDSDIR/icon.png"
|
||||||
|
fi
|
||||||
|
cd "$WORLDSINSTALL"
|
||||||
|
settings
|
||||||
}
|
}
|
||||||
|
|
||||||
backup () {
|
backup () {
|
||||||
|
@ -99,12 +182,11 @@ backup () {
|
||||||
cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars"
|
cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars"
|
||||||
cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks"
|
cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks"
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
zenity --error --text="Could not successfully backup files." --width=240 --height=40 --title="$TITLE - Backup" --window-icon="$WORLDSDIR/icon.png"
|
zenity --error --text="Could not backup files." --width=240 --height=40 --title="$TITLE - Backup" --window-icon="$WORLDSDIR/icon.png"
|
||||||
else
|
else
|
||||||
zenity --info --text="Personal world files successfully backed up." --width=240 --height=40 --title="$TITLE - Backup" --window-icon="$WORLDSDIR/icon.png"
|
zenity --info --text="Personal world files successfully backed up." --width=240 --height=40 --title="$TITLE - Backup" --window-icon="$WORLDSDIR/icon.png"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
main
|
|
||||||
}
|
}
|
||||||
|
|
||||||
restore () {
|
restore () {
|
||||||
|
@ -115,64 +197,17 @@ restore () {
|
||||||
cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars"
|
cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars"
|
||||||
cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks"
|
cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks"
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
zenity --error --text="Could not successfully restore files." --width=240 --height=40 --title="$TITLE - Restore" --window-icon="$WORLDSDIR/icon.png"
|
zenity --error --text="Could not restore files." --width=240 --height=40 --title="$TITLE - Restore" --window-icon="$WORLDSDIR/icon.png"
|
||||||
else
|
else
|
||||||
zenity --info --text="Personal world files successfully restored." --width=240 --height=40 --title="$TITLE - Restore" --window-icon="$WORLDSDIR/icon.png"
|
zenity --info --text="Personal world files successfully restored." --width=240 --height=40 --title="$TITLE - Restore" --window-icon="$WORLDSDIR/icon.png"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
main
|
|
||||||
}
|
|
||||||
|
|
||||||
theme () {
|
|
||||||
mkdir -p "$WORLDSDIR/themes"
|
|
||||||
seltheme=$(zenity --file-selection --title="Select a theme folder" --directory --filename="$WORLDSDIR/themes/" --window-icon="$WORLDSDIR/icon.png")
|
|
||||||
if [[ ! $? -eq 1 ]]; then
|
|
||||||
for i in $seltheme/*;
|
|
||||||
do FILENAME="$(basename $i)"
|
|
||||||
echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME"
|
|
||||||
ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME"
|
|
||||||
done
|
|
||||||
zenity --info --text="Successfully set theme to $(basename $seltheme)." --width=240 --height=40 --title="$TITLE - Theme" --window-icon="$WORLDSDIR/icon.png"
|
|
||||||
fi
|
|
||||||
main
|
|
||||||
}
|
|
||||||
|
|
||||||
settings () {
|
|
||||||
SETSEL=$(zenity --list --title="$TITLE - Settings" --text="Settings for Worlds Linux" --column='Option' --column='Value' --cancel-label="Back" --width=300 --height=300 --window-icon="$WORLDSDIR/icon.png" \
|
|
||||||
"Wine Location" "$WINE" \
|
|
||||||
"Prefix Location" "$WINEPREFIX" \
|
|
||||||
"Worlds Location" "$WORLDSINSTALL" \
|
|
||||||
2>/dev/null)
|
|
||||||
case $SETSEL in
|
|
||||||
'Wine Location')
|
|
||||||
WINESEL=$(zenity --entry --title="$WTITLE - Wine Binary Location" --text="Path to wine binary" --entry-text="$WINE" --window-icon="$WORLDSDIR/icon.png")
|
|
||||||
if [[ ! $? -eq 1 ]]; then
|
|
||||||
export WINE=$WINESEL
|
|
||||||
echo "$WINESEL" > "$WORLDSDIR/wine.worldslinux"
|
|
||||||
fi
|
|
||||||
settings ;;
|
|
||||||
'Prefix Location')
|
|
||||||
PREFSEL=$(zenity --entry --title="$WTITLE - Wine Prefix Location" --text="Path to Wine Prefix." --entry-text="$WINEPREFIX" --window-icon="$WORLDSDIR/icon.png")
|
|
||||||
if [[ ! $? -eq 1 ]]; then
|
|
||||||
export WINEPREFIX=$PREFSEL
|
|
||||||
echo "$PREFSEL" > "$WORLDSDIR/wineprefix.worldslinux"
|
|
||||||
fi
|
|
||||||
settings ;;
|
|
||||||
'Worlds Location')
|
|
||||||
WORLDSEL=$(zenity --entry --title="$WTITLE - Worlds Location" --text="Path to Worlds Folder" --entry-text="$WORLDSINSTALL" --window-icon="$WORLDSDIR/icon.png")
|
|
||||||
if [[ ! $? -eq 1 ]]; then
|
|
||||||
export WORLDSINSTALL=$WORLDSEL
|
|
||||||
echo "$WORLDSEL" > "$WORLDSDIR/worlds.worldslinux"
|
|
||||||
fi
|
|
||||||
settings ;;
|
|
||||||
esac
|
|
||||||
main
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cache () {
|
cache () {
|
||||||
CDSIZE=$(du -sh "$WORLDSINSTALL/cachedir" | cut -f1)
|
CDSIZE=$(du -sh "$WORLDSINSTALL/cachedir" | cut -f1)
|
||||||
if [ -d "$WORLDSINSTALL/cachedir" ]; then
|
if [ -d "$WORLDSINSTALL/cachedir" ]; then
|
||||||
rm -rf "$WORLDSINSTALL/cachedir"
|
rm -rf "$WORLDSINSTALL/cachedir" | zenity --progress --no-buttons --text="Removing cachedir..." -title="$TITLE - Removing Cachedir" --window-icon="$WORLDSDIR/icon.png" --auto-close --auto-kill
|
||||||
if [ ! -d "$WORLDSINSTALL/cachedir" ]; then
|
if [ ! -d "$WORLDSINSTALL/cachedir" ]; then
|
||||||
zenity --info --text="$CDSIZE were successfully cleared." --width=240 --height=40 --title="$TITLE - Cachedir" --window-icon="$WORLDSDIR/icon.png"
|
zenity --info --text="$CDSIZE were successfully cleared." --width=240 --height=40 --title="$TITLE - Cachedir" --window-icon="$WORLDSDIR/icon.png"
|
||||||
else
|
else
|
||||||
|
@ -181,13 +216,11 @@ cache () {
|
||||||
else
|
else
|
||||||
zenity --error --text="Cachedir doesn't exist! Was it already cleared?" --width=240 --height=40 --title="$TITLE - Cachedir" --window-icon="$WORLDSDIR/icon.png"
|
zenity --error --text="Cachedir doesn't exist! Was it already cleared?" --width=240 --height=40 --title="$TITLE - Cachedir" --window-icon="$WORLDSDIR/icon.png"
|
||||||
fi
|
fi
|
||||||
main
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kill () {
|
killw () {
|
||||||
killall WorldsPlayer.exe run.exe javaw.exe jrew.exe
|
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"
|
||||||
main
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
Loading…
Reference in New Issue
Block a user