chore: fixed macos update script
This commit is contained in:
parent
eb6c40f92a
commit
44082462b7
6 changed files with 35 additions and 46 deletions
|
|
@ -8,22 +8,42 @@ rm -rf "$EXTRACT_DIR"
|
||||||
mkdir -p "$EXTRACT_DIR"
|
mkdir -p "$EXTRACT_DIR"
|
||||||
|
|
||||||
# Mount the DMG
|
# Mount the DMG
|
||||||
hdiutil attach "$INSTALLER_PATH" -mountpoint "$EXTRACT_DIR/mounted_dmg" -nobrowse -quiet
|
MOUNT_POINT="$EXTRACT_DIR/mounted_dmg"
|
||||||
|
hdiutil attach "$INSTALLER_PATH" -mountpoint "$MOUNT_POINT"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to mount DMG"
|
echo "Failed to mount DMG"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the app to /Applications
|
# Check if the application exists in the mounted DMG
|
||||||
cp -R "$EXTRACT_DIR/mounted_dmg/AmneziaVPN.app" /Applications/
|
if [ ! -d "$MOUNT_POINT/AmneziaVPN.app" ]; then
|
||||||
if [ $? -ne 0 ]; then
|
echo "Error: AmneziaVPN.app not found in the mounted DMG."
|
||||||
echo "Failed to copy AmneziaVPN.app to /Applications"
|
hdiutil detach "$MOUNT_POINT" #-quiet
|
||||||
hdiutil detach "$EXTRACT_DIR/mounted_dmg" -quiet
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
echo "Running AmneziaVPN.app from the mounted DMG..."
|
||||||
|
open "$MOUNT_POINT/AmneziaVPN.app"
|
||||||
|
|
||||||
|
# Get the PID of the app launched from the DMG
|
||||||
|
APP_PATH="$MOUNT_POINT/AmneziaVPN.app"
|
||||||
|
PID=$(pgrep -f "$APP_PATH")
|
||||||
|
|
||||||
|
if [ -z "$PID" ]; then
|
||||||
|
echo "Failed to retrieve PID for AmneziaVPN.app"
|
||||||
|
hdiutil detach "$MOUNT_POINT"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for the specific PID to exit
|
||||||
|
echo "Waiting for AmneziaVPN.app to exit..."
|
||||||
|
while kill -0 "$PID" 2>/dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
# Unmount the DMG
|
# Unmount the DMG
|
||||||
hdiutil detach "$EXTRACT_DIR/mounted_dmg" -quiet
|
hdiutil detach "$EXTRACT_DIR/mounted_dmg"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to unmount DMG"
|
echo "Failed to unmount DMG"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -147,14 +147,13 @@ void UpdateController::runInstaller()
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
QString t = installerPath;
|
|
||||||
|
|
||||||
#if defined(Q_OS_WINDOWS)
|
#if defined(Q_OS_WINDOWS)
|
||||||
runWindowsInstaller(t);
|
runWindowsInstaller(installerPath);
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
runMacInstaller(t);
|
runMacInstaller(installerPath);
|
||||||
#elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
#elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||||
runLinuxInstaller(t);
|
runLinuxInstaller(installerPath);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError
|
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,6 @@ DrawerType2 {
|
||||||
expandedContent: Item {
|
expandedContent: Item {
|
||||||
implicitHeight: root.expandedHeight
|
implicitHeight: root.expandedHeight
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root
|
|
||||||
enabled: !GC.isMobile()
|
|
||||||
function onOpened() {
|
|
||||||
focusItem.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Header2TextType {
|
Header2TextType {
|
||||||
id: header
|
id: header
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
@ -32,6 +24,7 @@ DrawerType2 {
|
||||||
anchors.topMargin: 16
|
anchors.topMargin: 16
|
||||||
anchors.rightMargin: 16
|
anchors.rightMargin: 16
|
||||||
anchors.leftMargin: 16
|
anchors.leftMargin: 16
|
||||||
|
anchors.bottomMargin: 16
|
||||||
|
|
||||||
text: UpdateController.headerText
|
text: UpdateController.headerText
|
||||||
}
|
}
|
||||||
|
|
@ -46,9 +39,10 @@ DrawerType2 {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 48
|
anchors.topMargin: 16
|
||||||
anchors.rightMargin: 16
|
anchors.rightMargin: 16
|
||||||
anchors.leftMargin: 16
|
anchors.leftMargin: 16
|
||||||
|
anchors.bottomMargin: 16
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
enabled: parent.hoveredLink
|
enabled: parent.hoveredLink
|
||||||
|
|
@ -64,17 +58,11 @@ DrawerType2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
|
||||||
id: focusItem
|
|
||||||
KeyNavigation.tab: updateButton
|
|
||||||
}
|
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
id: updateButton
|
id: updateButton
|
||||||
anchors.bottom: skipButton.top
|
anchors.bottom: skipButton.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 16
|
|
||||||
anchors.bottomMargin: 8
|
anchors.bottomMargin: 8
|
||||||
anchors.rightMargin: 16
|
anchors.rightMargin: 16
|
||||||
anchors.leftMargin: 16
|
anchors.leftMargin: 16
|
||||||
|
|
@ -87,8 +75,6 @@ DrawerType2 {
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
root.close()
|
root.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyNavigation.tab: skipButton
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
|
|
@ -107,13 +93,11 @@ DrawerType2 {
|
||||||
textColor: "#D7D8DB"
|
textColor: "#D7D8DB"
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
|
|
||||||
text: qsTr("Skip this version")
|
text: qsTr("Skip")
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
root.close()
|
root.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyNavigation.tab: focusItem
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,5 @@ class IpcInterface
|
||||||
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
||||||
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
||||||
SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) );
|
SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) );
|
||||||
|
|
||||||
SLOT( int mountDmg(const QString &path, bool mount) );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -368,14 +368,3 @@ bool IpcServer::enablePeerTraffic(const QJsonObject &configStr)
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IpcServer::mountDmg(const QString &path, bool mount)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_MACOS
|
|
||||||
qDebug() << path;
|
|
||||||
auto res = QProcess::execute(QString("sudo hdiutil %1 %2").arg(mount ? "attach" : "unmount", path));
|
|
||||||
qDebug() << res;
|
|
||||||
return res;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -38,7 +38,6 @@ public:
|
||||||
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
||||||
virtual bool disableKillSwitch() override;
|
virtual bool disableKillSwitch() override;
|
||||||
virtual bool updateResolvers(const QString &ifname, const QList<QHostAddress> &resolvers) override;
|
virtual bool updateResolvers(const QString &ifname, const QList<QHostAddress> &resolvers) override;
|
||||||
virtual int mountDmg(const QString &path, bool mount) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_localpid = 0;
|
int m_localpid = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue