aboutsummaryrefslogtreecommitdiff
path: root/distribution/macos
diff options
context:
space:
mode:
authorMary <mary@mary.zone>2023-02-25 12:30:48 +0100
committerGitHub <noreply@github.com>2023-02-25 12:30:48 +0100
commitf663a5cd38e0ac0191f5859ed5bc25f5a7a9a907 (patch)
tree9616ee5265310589315c37baf80905eebf77875e /distribution/macos
parentf7c2e867f4e0c9067c0c88f58b5df4cef6ee4399 (diff)
macos: Add updater support (#4464)
This is a very basic updater but should be enough for now. --------- Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Diffstat (limited to 'distribution/macos')
-rwxr-xr-xdistribution/macos/create_app_bundle.sh1
-rwxr-xr-xdistribution/macos/create_macos_release.sh2
-rwxr-xr-xdistribution/macos/updater.sh39
3 files changed, 41 insertions, 1 deletions
diff --git a/distribution/macos/create_app_bundle.sh b/distribution/macos/create_app_bundle.sh
index 8076303c..b62f3491 100755
--- a/distribution/macos/create_app_bundle.sh
+++ b/distribution/macos/create_app_bundle.sh
@@ -24,6 +24,7 @@ cp $PUBLISH_DIRECTORY/*.dylib $APP_BUNDLE_DIRECTORY/Contents/Frameworks
# Then resources
cp Info.plist $APP_BUNDLE_DIRECTORY/Contents
cp Ryujinx.icns $APP_BUNDLE_DIRECTORY/Contents/Resources/Ryujinx.icns
+cp updater.sh $APP_BUNDLE_DIRECTORY/Contents/Resources/updater.sh
cp -r $PUBLISH_DIRECTORY/THIRDPARTY.md $APP_BUNDLE_DIRECTORY/Contents/Resources
echo -n "APPL????" > $APP_BUNDLE_DIRECTORY/Contents/PkgInfo
diff --git a/distribution/macos/create_macos_release.sh b/distribution/macos/create_macos_release.sh
index 545baf20..d979ec8f 100755
--- a/distribution/macos/create_macos_release.sh
+++ b/distribution/macos/create_macos_release.sh
@@ -27,7 +27,7 @@ EXECUTABLE_SUB_PATH=Contents/MacOS/Ryujinx
rm -rf $TEMP_DIRECTORY
mkdir -p $TEMP_DIRECTORY
-DOTNET_COMMON_ARGS="-p:DebugType=embedded -p:Version=$VERSION -p:SourceRevisionId=$SOURCE_REVISION_ID -p:ExtraDefineConstants=DISABLE_UPDATER --self-contained true"
+DOTNET_COMMON_ARGS="-p:DebugType=embedded -p:Version=$VERSION -p:SourceRevisionId=$SOURCE_REVISION_ID --self-contained true"
dotnet restore
dotnet build -c Release Ryujinx.Ava
diff --git a/distribution/macos/updater.sh b/distribution/macos/updater.sh
new file mode 100755
index 00000000..b60ac34d
--- /dev/null
+++ b/distribution/macos/updater.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+
+INSTALL_DIRECTORY=$1
+NEW_APP_DIRECTORY=$2
+APP_PID=$3
+APP_ARGUMENTS="${@:4}"
+
+error_handler() {
+ local lineno="$1"
+
+ script="""
+ set alertTitle to \"Ryujinx - Updater error\"
+ set alertMessage to \"An error occurred during Ryujinx update (updater.sh:$lineno)\n\nPlease download the update manually from our website if the problem persists.\"
+ display dialog alertMessage with icon caution with title alertTitle buttons {\"Open Download Page\", \"Exit\"}
+ set the button_pressed to the button returned of the result
+
+ if the button_pressed is \"Open Download Page\" then
+ open location \"https://ryujinx.org/download\"
+ end if
+ """
+
+ osascript -e "$script"
+ exit 1
+}
+
+trap 'error_handler ${LINENO}' ERR
+
+# Wait for Ryujinx to exit
+# NOTE: in case no fds are open, lsof could be returning with a process still living.
+# We wait 1s and assume the process stopped after that
+lsof -p $APP_PID +r 1 &>/dev/null
+sleep 1
+
+# Now replace and reopen.
+rm -rf "$INSTALL_DIRECTORY"
+mv "$NEW_APP_DIRECTORY" "$INSTALL_DIRECTORY"
+open -a "$INSTALL_DIRECTORY" --args "$APP_ARGUMENTS"