From 3dc344054a701379528ca5de256210ce232c8cc3 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 2 Apr 2021 20:35:02 -0400 Subject: don't overwrite .bin.osx file unnecessarily to avoid resetting file permissions (#768) --- src/SMAPI.Installer/assets/unix-launcher.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index 1d97d487..93bf58d8 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -37,8 +37,13 @@ if [ "$UNAME" == "Darwin" ]; then ln -s /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib libgdiplus.dylib fi + # create bin file + # Note: don't overwrite if it's identical, to avoid resetting permission flags + if [ ! -x StardewModdingAPI.bin.osx ] || ! cmp StardewValley.bin.osx StardewModdingAPI.bin.osx >/dev/null 2>&1; then + cp -p StardewValley.bin.osx StardewModdingAPI.bin.osx + fi + # launch SMAPI - cp StardewValley.bin.osx StardewModdingAPI.bin.osx open -a Terminal ./StardewModdingAPI.bin.osx "$@" else # choose launcher -- cgit From 222183c651c5b5d9e402db1b8009e2e0a0681b06 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 4 Apr 2021 11:37:11 -0400 Subject: standardize spelling of 'macOS' --- src/SMAPI.Installer/assets/README.txt | 9 +++++---- src/SMAPI.Installer/assets/unix-install.sh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/README.txt b/src/SMAPI.Installer/assets/README.txt index 0da49a46..c3a7e271 100644 --- a/src/SMAPI.Installer/assets/README.txt +++ b/src/SMAPI.Installer/assets/README.txt @@ -24,19 +24,20 @@ Manual install THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead. If you really want to install SMAPI manually, here's how. -1. Unzip "internal/windows-install.dat" (on Windows) or "internal/unix-install.dat" (on Linux/Mac). - You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent confusion. +1. Unzip "internal/windows-install.dat" (on Windows) or "internal/unix-install.dat" (on + Linux/macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent + confusion. 2. Copy the files from the folder you just unzipped into your game folder. The `StardewModdingAPI.exe` file should be right next to the game's executable. 3. - Windows only: if you use Steam, see the install guide above to enable achievements and overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods. - - Linux/Mac only: rename the "StardewValley" file (no extension) to "StardewValley-original", and + - Linux/macOS only: rename the "StardewValley" file (no extension) to "StardewValley-original", and "StardewModdingAPI" (no extension) to "StardewValley". Now just launch the game as usual to play with mods. -When installing on Linux or Mac: +When installing on Linux or macOS: - Make sure Mono is installed (normally the installer checks for you). While it's not required, many mods won't work correctly without it. (Specifically, mods which load PNG images may crash or freeze the game.) diff --git a/src/SMAPI.Installer/assets/unix-install.sh b/src/SMAPI.Installer/assets/unix-install.sh index 6d0c86ce..311c5469 100644 --- a/src/SMAPI.Installer/assets/unix-install.sh +++ b/src/SMAPI.Installer/assets/unix-install.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Run the SMAPI installer through Mono on Linux or Mac. +# Run the SMAPI installer through Mono on Linux or macOS. # Move to script's directory cd "`dirname "$0"`" -- cgit From ec9914efad9e4ba46d49337b473b79bcdfd20d1f Mon Sep 17 00:00:00 2001 From: kuesji koesnu Date: Sun, 2 May 2021 17:37:08 +0300 Subject: launcher strict sandbox fix on linux i added a check for is found terminal is executable. game will launch with standart exec if found terminal is not exist or executable. ( fix for issue #775 ) --- src/SMAPI.Installer/assets/unix-launcher.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index 93bf58d8..0046e716 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -80,8 +80,14 @@ else export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" fi - # run in selected terminal and account for quirks - case $LAUNCHTERM in + + if [ ! -x $LAUNCHTERM ]; then + echo "looks like found no terminal available for launch. maybe in sandbox or misconfigured system? fallbacking to execution without terminal" + export TERM="xterm" + exec $LAUNCHER $@ + else + # run in selected terminal and account for quirks + case $LAUNCHTERM in terminal|termite) # LAUNCHTERM consumes only one argument after -e # options containing space characters are unsupported @@ -110,5 +116,6 @@ else if [ $? -eq 127 ]; then exec $LAUNCHER --no-terminal "$@" fi - esac + esac + fi fi -- cgit From bc9b5a84f0ecbf563d5f682f8ed38e50e7e675fc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 2 May 2021 18:07:05 -0400 Subject: use POSIX command directly in Linux launcher --- src/SMAPI.Installer/assets/unix-launcher.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index 0046e716..7611dfcd 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -59,17 +59,9 @@ else fi export LAUNCHER - # get cross-distro version of POSIX command - COMMAND="" - if command -v command 2>/dev/null; then - COMMAND="command -v" - elif type type 2>/dev/null; then - COMMAND="type -p" - fi - # select terminal (prefer xterm for best compatibility, then known supported terminals) for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator; do - if $COMMAND "$terminal" 2>/dev/null; then + if command -v "$terminal" 2>/dev/null; then export LAUNCHTERM=$terminal break; fi @@ -77,7 +69,7 @@ else # find the true shell behind x-terminal-emulator if [ "$LAUNCHTERM" = "x-terminal-emulator" ]; then - export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" + export LAUNCHTERM="$(basename "$(readlink -f $(command -v x-terminal-emulator))")" fi -- cgit From b8b120b759f292da8b6583831de2894fe44a0012 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 2 May 2021 18:11:58 -0400 Subject: rename variables in Linux launcher for clarity --- src/SMAPI.Installer/assets/unix-launcher.sh | 78 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index 7611dfcd..e0a106cb 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -46,68 +46,68 @@ if [ "$UNAME" == "Darwin" ]; then # launch SMAPI open -a Terminal ./StardewModdingAPI.bin.osx "$@" else - # choose launcher - LAUNCHER="" + # choose binary file to launch + LAUNCH_FILE="" if [ "$ARCH" == "x86_64" ]; then ln -sf mcs.bin.x86_64 mcs cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 - LAUNCHER="./StardewModdingAPI.bin.x86_64" + LAUNCH_FILE="./StardewModdingAPI.bin.x86_64" else ln -sf mcs.bin.x86 mcs cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 - LAUNCHER="./StardewModdingAPI.bin.x86" + LAUNCH_FILE="./StardewModdingAPI.bin.x86" fi - export LAUNCHER + export LAUNCH_FILE # select terminal (prefer xterm for best compatibility, then known supported terminals) for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator; do if command -v "$terminal" 2>/dev/null; then - export LAUNCHTERM=$terminal + export TERMINAL_NAME=$terminal break; fi done # find the true shell behind x-terminal-emulator - if [ "$LAUNCHTERM" = "x-terminal-emulator" ]; then - export LAUNCHTERM="$(basename "$(readlink -f $(command -v x-terminal-emulator))")" + if [ "$TERMINAL_NAME" = "x-terminal-emulator" ]; then + export TERMINAL_NAME="$(basename "$(readlink -f $(command -v x-terminal-emulator))")" fi - if [ ! -x $LAUNCHTERM ]; then + if [ ! -x $TERMINAL_NAME ]; then echo "looks like found no terminal available for launch. maybe in sandbox or misconfigured system? fallbacking to execution without terminal" export TERM="xterm" - exec $LAUNCHER $@ + exec $LAUNCH_FILE $@ else # run in selected terminal and account for quirks - case $LAUNCHTERM in - terminal|termite) - # LAUNCHTERM consumes only one argument after -e - # options containing space characters are unsupported - exec $LAUNCHTERM -e "env TERM=xterm $LAUNCHER $@" - ;; - xterm|konsole|alacritty) - # LAUNCHTERM consumes all arguments after -e - exec $LAUNCHTERM -e env TERM=xterm $LAUNCHER "$@" - ;; - terminator|xfce4-terminal|mate-terminal) - # LAUNCHTERM consumes all arguments after -x - exec $LAUNCHTERM -x env TERM=xterm $LAUNCHER "$@" - ;; - gnome-terminal) - # LAUNCHTERM consumes all arguments after -- - exec $LAUNCHTERM -- env TERM=xterm $LAUNCHER "$@" - ;; - kitty) - # LAUNCHTERM consumes all trailing arguments - exec $LAUNCHTERM env TERM=xterm $LAUNCHER "$@" - ;; - *) - # If we don't know the terminal, just try to run it in the current shell. - env TERM=xterm $LAUNCHER "$@" - # if THAT fails, launch with no output - if [ $? -eq 127 ]; then - exec $LAUNCHER --no-terminal "$@" - fi + case $TERMINAL_NAME in + terminal|termite) + # consumes only one argument after -e + # options containing space characters are unsupported + exec $TERMINAL_NAME -e "env TERM=xterm $LAUNCH_FILE $@" + ;; + xterm|konsole|alacritty) + # consumes all arguments after -e + exec $TERMINAL_NAME -e env TERM=xterm $LAUNCH_FILE "$@" + ;; + terminator|xfce4-terminal|mate-terminal) + # consumes all arguments after -x + exec $TERMINAL_NAME -x env TERM=xterm $LAUNCH_FILE "$@" + ;; + gnome-terminal) + # consumes all arguments after -- + exec $TERMINAL_NAME -- env TERM=xterm $LAUNCH_FILE "$@" + ;; + kitty) + # consumes all trailing arguments + exec $TERMINAL_NAME env TERM=xterm $LAUNCH_FILE "$@" + ;; + *) + # If we don't know the terminal, just try to run it in the current shell. + env TERM=xterm $LAUNCH_FILE "$@" + # if THAT fails, launch with no output + if [ $? -eq 127 ]; then + exec $LAUNCH_FILE --no-terminal "$@" + fi esac fi fi -- cgit From 0f27d6f4c18812d90e51b10c05bfa1a69953c721 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 2 May 2021 18:26:02 -0400 Subject: fix new executable check in Linux launcher, update release notes (#775) --- src/SMAPI.Installer/assets/unix-launcher.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/SMAPI.Installer/assets') diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index e0a106cb..a33c0d7f 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -72,42 +72,51 @@ else export TERMINAL_NAME="$(basename "$(readlink -f $(command -v x-terminal-emulator))")" fi - - if [ ! -x $TERMINAL_NAME ]; then - echo "looks like found no terminal available for launch. maybe in sandbox or misconfigured system? fallbacking to execution without terminal" - export TERM="xterm" - exec $LAUNCH_FILE $@ - else - # run in selected terminal and account for quirks + # run in selected terminal and account for quirks + export TERMINAL_PATH="$(command -v $TERMINAL_NAME)" + if [ -x $TERMINAL_PATH ]; then case $TERMINAL_NAME in terminal|termite) # consumes only one argument after -e # options containing space characters are unsupported exec $TERMINAL_NAME -e "env TERM=xterm $LAUNCH_FILE $@" ;; + xterm|konsole|alacritty) # consumes all arguments after -e exec $TERMINAL_NAME -e env TERM=xterm $LAUNCH_FILE "$@" ;; + terminator|xfce4-terminal|mate-terminal) # consumes all arguments after -x exec $TERMINAL_NAME -x env TERM=xterm $LAUNCH_FILE "$@" ;; + gnome-terminal) # consumes all arguments after -- exec $TERMINAL_NAME -- env TERM=xterm $LAUNCH_FILE "$@" ;; + kitty) # consumes all trailing arguments exec $TERMINAL_NAME env TERM=xterm $LAUNCH_FILE "$@" ;; + *) # If we don't know the terminal, just try to run it in the current shell. + # If THAT fails, launch with no output. env TERM=xterm $LAUNCH_FILE "$@" - # if THAT fails, launch with no output if [ $? -eq 127 ]; then exec $LAUNCH_FILE --no-terminal "$@" fi esac + + ## terminal isn't executable; fallback to current shell or no terminal + else + echo "The '$TERMINAL_NAME' terminal isn't executable. SMAPI might be running in a sandbox or the system might be misconfigured? Falling back to current shell." + env TERM=xterm $LAUNCH_FILE "$@" + if [ $? -eq 127 ]; then + exec $LAUNCH_FILE --no-terminal "$@" + fi fi fi -- cgit