mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Add macOS arm64.
This commit is contained in:
parent
e1955592c5
commit
66325ccc45
@ -16,6 +16,7 @@ namespace Remotely.Agent.Services
|
||||
{
|
||||
public class UpdaterMac : IUpdater
|
||||
{
|
||||
private readonly string _achitecture = RuntimeInformation.OSArchitecture.ToString().ToLower();
|
||||
private readonly SemaphoreSlim _checkForUpdatesLock = new SemaphoreSlim(1, 1);
|
||||
private readonly ConfigService _configService;
|
||||
private readonly IWebClientEx _webClientEx;
|
||||
@ -64,7 +65,7 @@ namespace Remotely.Agent.Services
|
||||
var connectionInfo = _configService.GetConnectionInfo();
|
||||
var serverUrl = _configService.GetConnectionInfo().Host;
|
||||
|
||||
var fileUrl = serverUrl + $"/Content/Remotely-MacOS-x64.zip";
|
||||
var fileUrl = serverUrl + $"/Content/Remotely-MacOS-{_achitecture}.zip";
|
||||
|
||||
var lastEtag = string.Empty;
|
||||
|
||||
@ -128,11 +129,11 @@ namespace Remotely.Agent.Services
|
||||
var installerPath = Path.Combine(Path.GetTempPath(), "RemotelyUpdate.sh");
|
||||
|
||||
await _webClientEx.DownloadFileTaskAsync(
|
||||
serverUrl + $"/API/ClientDownloads/{connectionInfo.OrganizationID}/MacOSInstaller-x64",
|
||||
serverUrl + $"/API/ClientDownloads/{connectionInfo.OrganizationID}/MacOSInstaller-{_achitecture}",
|
||||
installerPath);
|
||||
|
||||
await _webClientEx.DownloadFileTaskAsync(
|
||||
serverUrl + $"/API/AgentUpdate/DownloadPackage/macos-x64/{downloadId}",
|
||||
serverUrl + $"/API/AgentUpdate/DownloadPackage/macos-{_achitecture}/{downloadId}",
|
||||
zipPath);
|
||||
|
||||
(await WebRequest.CreateHttp(serverUrl + $"/api/AgentUpdate/ClearDownload/{downloadId}").GetResponseAsync()).Dispose();
|
||||
|
||||
@ -55,6 +55,11 @@ namespace Remotely.Server.API
|
||||
var filePath = Path.Combine(_hostEnv.WebRootPath, "Content", "MacOS-x64", "Remotely_Desktop");
|
||||
return await GetDesktopFile(filePath);
|
||||
}
|
||||
case "MacOS-arm64":
|
||||
{
|
||||
var filePath = Path.Combine(_hostEnv.WebRootPath, "Content", "MacOS-arm64", "Remotely_Desktop");
|
||||
return await GetDesktopFile(filePath);
|
||||
}
|
||||
default:
|
||||
return NotFound();
|
||||
}
|
||||
@ -86,6 +91,11 @@ namespace Remotely.Server.API
|
||||
var filePath = Path.Combine(_hostEnv.WebRootPath, "Content", "MacOS-x64", "Remotely_Desktop");
|
||||
return await GetDesktopFile(filePath);
|
||||
}
|
||||
case "MacOS-arm64":
|
||||
{
|
||||
var filePath = Path.Combine(_hostEnv.WebRootPath, "Content", "MacOS-arm64", "Remotely_Desktop");
|
||||
return await GetDesktopFile(filePath);
|
||||
}
|
||||
default:
|
||||
return NotFound();
|
||||
}
|
||||
@ -186,6 +196,12 @@ namespace Remotely.Server.API
|
||||
{
|
||||
var fileName = "Install-MacOS-x64.sh";
|
||||
|
||||
return await GetBashInstaller(fileName, organizationId);
|
||||
}
|
||||
case "MacOSInstaller-arm64":
|
||||
{
|
||||
var fileName = "Install-MacOS-arm64.sh";
|
||||
|
||||
return await GetBashInstaller(fileName, organizationId);
|
||||
}
|
||||
default:
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
<div class="col-sm-6 mb-3">
|
||||
<strong>macOS (Catalina)</strong>
|
||||
<p>
|
||||
<a target="_blank" href="/api/ClientDownloads/Desktop/MacOS-x64/@_organizationId">macOS Executable</a>
|
||||
<a target="_blank" href="/api/ClientDownloads/Desktop/MacOS-x64/@_organizationId">macOS x64 Executable</a>
|
||||
<a target="_blank" href="/api/ClientDownloads/Desktop/MacOS-arm64/@_organizationId">macOS arm64 Executable</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -175,9 +176,13 @@
|
||||
<div class="col-sm-6 mb-3">
|
||||
<strong>macOS x64 (Catalina)</strong>
|
||||
<p>
|
||||
<a target="_blank" href="/API/ClientDownloads/MacOSInstaller-x64">macOS ZSH Installer</a>
|
||||
<a target="_blank" href="/API/ClientDownloads/MacOSInstaller-x64">macOS x64 Bash Installer</a>
|
||||
<br />
|
||||
<a target="_blank" href="/Content/Remotely-MacOS-x64.zip">macOS Files Only</a>
|
||||
<a target="_blank" href="/Content/Remotely-MacOS-x64.zip">macOS x64 Files Only</a>
|
||||
<br />
|
||||
<a target="_blank" href="/API/ClientDownloads/MacOSInstaller-arm64">macOS arm64 Bash Installer</a>
|
||||
<br />
|
||||
<a target="_blank" href="/Content/Remotely-MacOS-arm64.zip">macOS arm64 Files Only</a>
|
||||
</p>
|
||||
<p>
|
||||
<div class="small">Example Install:</div>
|
||||
|
||||
93
Server/wwwroot/Content/Install-MacOS-arm64.sh
Normal file
93
Server/wwwroot/Content/Install-MacOS-arm64.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
HostName=
|
||||
Organization=
|
||||
GUID="$(uuidgen)"
|
||||
UpdatePackagePath=""
|
||||
|
||||
Args=( "$@" )
|
||||
ArgLength=${#Args[@]}
|
||||
|
||||
for (( i=0; i<${ArgLength}; i+=2 ));
|
||||
do
|
||||
if [ "${Args[$i]}" = "--uninstall" ]; then
|
||||
launchctl unload -w /Library/LaunchDaemons/remotely-agent.plist
|
||||
rm -r -f /usr/local/bin/Remotely/
|
||||
rm -f /Library/LaunchDaemons/remotely-agent.plist
|
||||
exit
|
||||
elif [ "${Args[$i]}" = "--path" ]; then
|
||||
UpdatePackagePath="${Args[$i+1]}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Install Homebrew
|
||||
su - $SUDO_USER -c '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
|
||||
su - $SUDO_USER -c "brew update"
|
||||
|
||||
# Install .NET Runtime
|
||||
su - $SUDO_USER -c "brew install --cask dotnet"
|
||||
|
||||
# Install dependency for System.Drawing.Common
|
||||
su - $SUDO_USER -c "brew install mono-libgdiplus"
|
||||
|
||||
# Install other dependencies
|
||||
su - $SUDO_USER -c "brew install curl"
|
||||
su - $SUDO_USER -c "brew install jq"
|
||||
|
||||
|
||||
if [ -f "/usr/local/bin/Remotely/ConnectionInfo.json" ]; then
|
||||
GUID=`cat "/usr/local/bin/Remotely/ConnectionInfo.json" | jq -r '.DeviceID'`
|
||||
fi
|
||||
|
||||
rm -r -f /Applications/Remotely
|
||||
rm -f /Library/LaunchDaemons/remotely-agent.plist
|
||||
|
||||
mkdir -p /usr/local/bin/Remotely/
|
||||
chmod -R 755 /usr/local/bin/Remotely/
|
||||
cd /usr/local/bin/Remotely/
|
||||
|
||||
if [ -z "$UpdatePackagePath" ]; then
|
||||
echo "Downloading client..." >> /tmp/Remotely_Install.log
|
||||
curl $HostName/Content/Remotely-MacOS-arm64.zip --output /usr/local/bin/Remotely/Remotely-MacOS-arm64.zip
|
||||
else
|
||||
echo "Copying install files..." >> /tmp/Remotely_Install.log
|
||||
cp "$UpdatePackagePath" /usr/local/bin/Remotely/Remotely-MacOS-arm64.zip
|
||||
rm -f "$UpdatePackagePath"
|
||||
fi
|
||||
|
||||
unzip -o ./Remotely-MacOS-arm64.zip
|
||||
rm -f ./Remotely-MacOS-arm64.zip
|
||||
|
||||
|
||||
connectionInfo="{
|
||||
\"DeviceID\":\"$GUID\",
|
||||
\"Host\":\"$HostName\",
|
||||
\"OrganizationID\": \"$Organization\",
|
||||
\"ServerVerificationToken\":\"\"
|
||||
}"
|
||||
|
||||
echo "$connectionInfo" > ./ConnectionInfo.json
|
||||
|
||||
curl --head $HostName/Content/Remotely-MacOS-arm64.zip | grep -i "etag" | cut -d' ' -f 2 > ./etag.txt
|
||||
|
||||
|
||||
plistFile="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
|
||||
<plist version=\"1.0\">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.translucency.remotely-agent</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/dotnet</string>
|
||||
<string>/usr/local/bin/Remotely/Remotely_Agent.dll</string>
|
||||
</array>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>"
|
||||
echo "$plistFile" > "/Library/LaunchDaemons/remotely-agent.plist"
|
||||
|
||||
launchctl load -w /Library/LaunchDaemons/remotely-agent.plist
|
||||
launchctl kickstart -k system/com.translucency.remotely-agent
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/zsh
|
||||
#!/bin/bash
|
||||
|
||||
HostName=
|
||||
Organization=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user