Update electron builds

This commit is contained in:
AlphaX-Qortal
2024-12-25 17:58:12 +01:00
parent 277bc3f9b7
commit a54b8e7774
12 changed files with 740 additions and 507 deletions

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Make necessary config and add Qortal Hub apt repo
# SCript to run HUB without sandbox
echo \'/opt/${productFilename}/qortal-hub\' --no-sandbox > '/opt/${productFilename}/run-hub'
chmod +x '/opt/${productFilename}/run-hub'
# Link to run-ui
ln -sf '/opt/${productFilename}/run-hub' '/usr/bin/${executable}'
# SUID chrome-sandbox for Electron 5+
sudo chown root '/opt/${productFilename}/chrome-sandbox' || true
sudo chmod 4755 '/opt/${productFilename}/chrome-sandbox' || true
update-mime-database /usr/share/mime || true
update-desktop-database /usr/share/applications || true
# Install curl if not installed on the system
if ! which curl; then sudo apt-get --yes install curl; fi
# Install apt repository source list if it does not exist
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep qortal-hub.list; then
curl -sS https://update.qortal-hub.org/qortal-hub.gpg | sudo apt-key add -
sudo rm -rf /usr/share/keyrings/qortal-hub.gpg
sudo apt-key export E191E7C3 | sudo gpg --dearmour -o /usr/share/keyrings/qortal-hub.gpg
sudo rm -rf /etc/apt/sources.list.d/qortal-hub.list
echo 'deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/qortal-hub.gpg] https://update.qortal-hub.org/ ./ ' | sudo tee /etc/apt/sources.list.d/qortal-hub.list
fi

View File

@@ -0,0 +1,39 @@
const path = require('path')
const shell = require("shelljs")
const runShellCommand = (appOutDir) => {
shell.exec(
`chmod 4755 ${path.join(appOutDir, "chrome-sandbox")}`,
function (code, stdout, stderr) {
console.log('runShellCommand ==> Exit code:', code)
if (stderr) {
console.log('runShellCommand ==> Program stderr:', stderr)
}
}
)
}
async function doLinux(context) {
console.log("Running doLinux ==> ")
const { targets, appOutDir } = context
targets.forEach(async target => {
if (!["appimage", "snap"].includes(target.name.toLowerCase())) {
await runShellCommand(appOutDir)
}
})
}
async function afterPack(context) {
console.log("Running AfterPack")
const electronPlatformName = context.electronPlatformName.toLowerCase()
if (electronPlatformName.includes("linux")) {
await doLinux(context)
}
}
module.exports = afterPack

View File

@@ -0,0 +1,21 @@
require('dotenv').config()
const { notarize } = require('@electron/notarize')
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context
if (electronPlatformName !== 'darwin') {
return
}
const appName = context.packager.appInfo.productFilename
return await notarize({
appBundleId: 'org.qortal.Qortal-Hub',
appPath: `${appOutDir}/${appName}.app`,
tool: "notarytool",
teamId: process.env.APPLETEAMID,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS
})
}

View File

@@ -0,0 +1,34 @@
#!/bin/bash
# Remove all conf made by Qortal Hub
# Remove apt repository source list when user uninstalls app
if grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep qortal-hub.list; then
sudo rm /etc/apt/sources.list.d/qortal-hub.list;
fi
# Get the root user
if [ $SUDO_USER ];
then getSudoUser=$SUDO_USER;
else getSudoUser=`whoami`;
fi
getDesktopEntry=/home/$getSudoUser/.config/autostart/qortal-hub.desktop;
# Remove desktop entry if exists
if [ -f $getDesktopEntry ]; then
sudo rm $getDesktopEntry;
fi
# App directory which contains all the config and settings files
appDirectory=/home/$getSudoUser/.config/qortal-hub/;
if [ -d $appDirectory ]; then
sudo rm -rf $appDirectory;
fi
# Delete the link to the binary
rm -f '/usr/bin/${executable}'
# Delete run-hub
rm -f '/opt/${productFilename}/run-hub'