make installer self-contained
This lets players run the installer without manually installing .NET 5, which was causing a lot of support requests.
This commit is contained in:
parent
bf5a9b8762
commit
181508084b
|
@ -3,12 +3,15 @@
|
||||||
##########
|
##########
|
||||||
## Constants
|
## Constants
|
||||||
##########
|
##########
|
||||||
|
# paths
|
||||||
gamePath="/home/pathoschild/Stardew Valley"
|
gamePath="/home/pathoschild/Stardew Valley"
|
||||||
bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup")
|
bundleModNames=("ConsoleCommands" "ErrorHandler" "SaveBackup")
|
||||||
|
|
||||||
|
# build configuration
|
||||||
buildConfig="Release"
|
buildConfig="Release"
|
||||||
folders=("unix" "windows")
|
folders=("linux" "macOS" "windows")
|
||||||
declare -A runtimes=(["unix"]="linux-x64" ["windows"]="win-x64")
|
declare -A runtimes=(["linux"]="linux-x64" ["macOS"]="osx-x64" ["windows"]="win-x64")
|
||||||
declare -A msBuildPlatformNames=(["unix"]="Unix" ["windows"]="Windows_NT")
|
declare -A msBuildPlatformNames=(["linux"]="Unix" ["macOS"]="OSX" ["windows"]="Windows_NT")
|
||||||
|
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
@ -44,7 +47,7 @@ for folder in ${folders[@]}; do
|
||||||
|
|
||||||
echo "Compiling installer for $folder..."
|
echo "Compiling installer for $folder..."
|
||||||
echo "----------------------"
|
echo "----------------------"
|
||||||
dotnet publish src/SMAPI.Installer --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false"
|
dotnet publish src/SMAPI.Installer --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@ -75,29 +78,32 @@ for folder in ${folders[@]}; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# copy base installer files
|
# copy base installer files
|
||||||
cp "$installAssets/unix-install.sh" "$packagePath/install on Linux.sh"
|
for name in "install on Linux.sh" "install on macOS.command" "install on Windows.bat" "README.txt"; do
|
||||||
cp "$installAssets/unix-install.sh" "$packagePath/install on macOS.command"
|
cp "$installAssets/$name" "$packagePath/$name"
|
||||||
cp "$installAssets/windows-install.bat" "$packagePath/install on Windows.bat"
|
done
|
||||||
cp "$installAssets/README.txt" "$packagePath/README.txt"
|
|
||||||
|
|
||||||
# copy per-platform files
|
# copy per-platform files
|
||||||
for folder in ${folders[@]}; do
|
for folder in ${folders[@]}; do
|
||||||
runtime=${runtimes[$folder]}
|
runtime=${runtimes[$folder]}
|
||||||
|
|
||||||
# get paths
|
# get paths
|
||||||
installBin="src/SMAPI.Installer/bin/$buildConfig/$runtime"
|
smapiBin="src/SMAPI/bin/$buildConfig/$runtime/publish"
|
||||||
smapiBin="src/SMAPI/bin/$buildConfig/$runtime"
|
|
||||||
internalPath="$packagePath/internal/$folder"
|
internalPath="$packagePath/internal/$folder"
|
||||||
bundlePath="$internalPath/bundle"
|
bundlePath="$internalPath/bundle"
|
||||||
|
|
||||||
# runtime config for installer
|
# installer files
|
||||||
cp "$installBin/SMAPI.Installer.runtimeconfig.json" "$internalPath/SMAPI.Installer.runtimeconfig.json"
|
cp -r "src/SMAPI.Installer/bin/$buildConfig/$runtime/publish"/* "$internalPath"
|
||||||
|
rm -rf "$internalPath/ref"
|
||||||
|
rm -rf "$internalPath/assets"
|
||||||
|
|
||||||
# runtime config for SMAPI
|
# runtime config for SMAPI
|
||||||
cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json"
|
if [ $folder == "linux" ] || [ $folder == "macOS" ]; then
|
||||||
|
cp "$installAssets/runtimeconfig.unix.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json"
|
||||||
|
else
|
||||||
|
cp "$installAssets/runtimeconfig.$folder.json" "$bundlePath/StardewModdingAPI.runtimeconfig.json"
|
||||||
|
fi
|
||||||
|
|
||||||
# installer DLL
|
# installer DLL config
|
||||||
cp "$installBin/SMAPI.Installer.dll" "$internalPath/SMAPI.Installer.dll"
|
|
||||||
if [ $folder == "windows" ]; then
|
if [ $folder == "windows" ]; then
|
||||||
cp "$installAssets/windows-exe-config.xml" "$packagePath/internal/windows/install.exe.config"
|
cp "$installAssets/windows-exe-config.xml" "$packagePath/internal/windows/install.exe.config"
|
||||||
fi
|
fi
|
||||||
|
@ -121,7 +127,7 @@ for folder in ${folders[@]}; do
|
||||||
|
|
||||||
cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json"
|
cp "$smapiBin/SMAPI.config.json" "$bundlePath/smapi-internal/config.json"
|
||||||
cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json"
|
cp "$smapiBin/SMAPI.metadata.json" "$bundlePath/smapi-internal/metadata.json"
|
||||||
if [ $folder == "unix" ]; then
|
if [ $folder == "linux" ] || [ $folder == "macOS" ]; then
|
||||||
cp "$installAssets/unix-launcher.sh" "$bundlePath/unix-launcher.sh"
|
cp "$installAssets/unix-launcher.sh" "$bundlePath/unix-launcher.sh"
|
||||||
cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll"
|
cp "$smapiBin/System.Runtime.Caching.dll" "$bundlePath/smapi-internal/System.Runtime.Caching.dll"
|
||||||
else
|
else
|
||||||
|
@ -138,7 +144,7 @@ for folder in ${folders[@]}; do
|
||||||
|
|
||||||
# copy bundled mods
|
# copy bundled mods
|
||||||
for modName in ${bundleModNames[@]}; do
|
for modName in ${bundleModNames[@]}; do
|
||||||
fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime"
|
fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish"
|
||||||
targetPath="$bundlePath/Mods/$modName"
|
targetPath="$bundlePath/Mods/$modName"
|
||||||
|
|
||||||
mkdir "$targetPath" --parents
|
mkdir "$targetPath" --parents
|
||||||
|
@ -190,7 +196,6 @@ fi
|
||||||
mv "$packagePath" "bin/SMAPI $version installer"
|
mv "$packagePath" "bin/SMAPI $version installer"
|
||||||
mv "$packageDevPath" "bin/SMAPI $version installer for developers"
|
mv "$packageDevPath" "bin/SMAPI $version installer for developers"
|
||||||
|
|
||||||
|
|
||||||
# package files
|
# package files
|
||||||
pushd bin > /dev/null
|
pushd bin > /dev/null
|
||||||
zip -9 "SMAPI $version installer.zip" "SMAPI $version installer" --recurse-paths --quiet
|
zip -9 "SMAPI $version installer.zip" "SMAPI $version installer" --recurse-paths --quiet
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
# Release notes
|
# Release notes
|
||||||
## Upcoming version
|
## Upcoming version
|
||||||
|
* For players:
|
||||||
|
* You no longer need .NET 5 to run the SMAPI installer.
|
||||||
|
|
||||||
* For SMAPI maintainers:
|
* For SMAPI maintainers:
|
||||||
* Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them.
|
* Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them.
|
||||||
|
|
||||||
|
|
|
@ -14,22 +14,27 @@
|
||||||
SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separately.
|
SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separately.
|
||||||
|
|
||||||
|
|
||||||
Player's guide
|
Automated install
|
||||||
--------------------------------
|
--------------------------------
|
||||||
See https://stardewvalleywiki.com/Modding:Player_Guide for help installing SMAPI, adding mods, etc.
|
See https://stardewvalleywiki.com/Modding:Player_Guide for help installing SMAPI, adding mods, etc.
|
||||||
|
|
||||||
|
|
||||||
Manual install
|
Manual install
|
||||||
--------------------------------
|
--------------------------------
|
||||||
THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead.
|
THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See the instructions above instead.
|
||||||
If you really want to install SMAPI manually, here's how.
|
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
|
1. Unzip "internal/windows/install.dat" (on Windows) or "internal/unix/install.dat" (on Linux or
|
||||||
Linux/macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent
|
macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent
|
||||||
confusion.
|
confusion.
|
||||||
|
|
||||||
2. Copy the files from the folder you just unzipped into your game folder. The
|
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.
|
`StardewModdingAPI.exe` file should be right next to the game's executable.
|
||||||
3.
|
|
||||||
|
3. Copy `Stardew Valley.deps.json` in the game folder, and rename the copy to
|
||||||
|
`StardewModdingAPI.deps.json`.
|
||||||
|
|
||||||
|
4.
|
||||||
- Windows only: if you use Steam, see the install guide above to enable achievements and
|
- 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.
|
overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods.
|
||||||
|
|
||||||
|
@ -38,8 +43,5 @@ If you really want to install SMAPI manually, here's how.
|
||||||
play with mods.
|
play with mods.
|
||||||
|
|
||||||
When installing on Linux or macOS:
|
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.)
|
|
||||||
- To configure the color scheme, edit the `smapi-internal/config.json` file and see instructions
|
- To configure the color scheme, edit the `smapi-internal/config.json` file and see instructions
|
||||||
there for the 'ColorScheme' setting.
|
there for the 'ColorScheme' setting.
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "`dirname "$0"`"
|
||||||
|
internal/linux/SMAPI.Installer
|
|
@ -12,36 +12,6 @@ if %ERRORLEVEL% EQU 0 (
|
||||||
exit
|
exit
|
||||||
)
|
)
|
||||||
|
|
||||||
REM make sure .NET 5 is installed
|
|
||||||
SET hasNet5=1
|
|
||||||
WHERE dotnet /q
|
|
||||||
if !ERRORLEVEL! NEQ 0 (
|
|
||||||
SET hasNet5=0
|
|
||||||
) else (
|
|
||||||
dotnet --info | findstr /C:"Microsoft.WindowsDesktop.App 5." 1>nul
|
|
||||||
if !ERRORLEVEL! NEQ 0 (
|
|
||||||
SET hasNet5=0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if "%hasNet5%" == "0" (
|
|
||||||
echo Oops! You don't have the required .NET version installed.
|
|
||||||
echo.
|
|
||||||
echo To install it:
|
|
||||||
echo 1. Go to https://dotnet.microsoft.com/download/dotnet/5.0/runtime
|
|
||||||
|
|
||||||
if "%PROCESSOR_ARCHITECTURE%" == "ARM64" (
|
|
||||||
echo 2. Under "Run desktop apps", click "Download Arm64".
|
|
||||||
) else (
|
|
||||||
echo 2. Under "Run desktop apps", click "Download x64".
|
|
||||||
)
|
|
||||||
|
|
||||||
echo 3. Run the downloaded installer.
|
|
||||||
echo 4. Restart your computer.
|
|
||||||
echo.
|
|
||||||
pause
|
|
||||||
exit
|
|
||||||
)
|
|
||||||
|
|
||||||
REM make sure an antivirus hasn't deleted the installer DLL
|
REM make sure an antivirus hasn't deleted the installer DLL
|
||||||
if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" (
|
if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" (
|
||||||
echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it.
|
echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it.
|
||||||
|
@ -50,9 +20,16 @@ if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" (
|
||||||
pause
|
pause
|
||||||
exit
|
exit
|
||||||
)
|
)
|
||||||
|
if not exist %installerDir%"internal\windows\SMAPI.Installer.exe" (
|
||||||
|
echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it.
|
||||||
|
echo Missing file: %installerDir%internal\windows\SMAPI.Installer.exe
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
exit
|
||||||
|
)
|
||||||
|
|
||||||
REM start installer
|
REM start installer
|
||||||
dotnet internal\windows\SMAPI.Installer.dll
|
internal\windows\SMAPI.Installer.exe
|
||||||
|
|
||||||
REM keep window open if it failed
|
REM keep window open if it failed
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
if %ERRORLEVEL% NEQ 0 (
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
|
xattr -r -d com.apple.quarantine internal
|
||||||
|
internal/macOS/SMAPI.Installer
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Move to script's directory
|
|
||||||
cd "`dirname "$0"`"
|
|
||||||
|
|
||||||
# make sure .NET 5 is installed
|
|
||||||
if ! command -v dotnet >/dev/null 2>&1; then
|
|
||||||
echo "Oops! You must have .NET 5 installed to use SMAPI: https://dotnet.microsoft.com/download";
|
|
||||||
read
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# run installer
|
|
||||||
dotnet internal/unix/SMAPI.Installer.dll
|
|
Loading…
Reference in New Issue