diff --git a/build/linux/AppRun b/build/linux/AppRun new file mode 100755 index 0000000..75fe553 --- /dev/null +++ b/build/linux/AppRun @@ -0,0 +1,96 @@ +#!/bin/bash + +# modified AppRun script from https://github.com/develar/app-builder/blob/master/pkg/package-format/appimage/templates/AppRun.sh + +set -e + +if [ ! -z "$DEBUG" ] ; then + env + set -x +fi + +THIS="$0" +# http://stackoverflow.com/questions/3190818/ +args=("$@") +NUMBER_OF_ARGS="$#" + +if [ -z "$APPDIR" ] ; then + # Find the AppDir. It is the directory that contains AppRun. + # This assumes that this script resides inside the AppDir or a subdirectory. + # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR + path="$(dirname "$(readlink -f "${THIS}")")" + while [[ "$path" != "" && ! -e "$path/$1" ]]; do + path=${path%/*} + done + APPDIR="$path" +fi + +export PATH="${APPDIR}:${APPDIR}/usr/sbin:${PATH}" +export XDG_DATA_DIRS="./share/:/usr/share/gnome:/usr/local/share/:/usr/share/:${XDG_DATA_DIRS}" +export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}" +export XDG_DATA_DIRS="${APPDIR}"/usr/share/:"${XDG_DATA_DIRS}":/usr/share/gnome/:/usr/local/share/:/usr/share/ +export GSETTINGS_SCHEMA_DIR="${APPDIR}/usr/share/glib-2.0/schemas:${GSETTINGS_SCHEMA_DIR}" + +BIN="$APPDIR/HelloPear" + +if [ -z "$APPIMAGE_EXIT_AFTER_INSTALL" ] ; then + trap atexit EXIT +fi + +isEulaAccepted=1 + +atexit() +{ + if [ $isEulaAccepted == 1 ] ; then + if [ $NUMBER_OF_ARGS -eq 0 ] ; then + exec "$BIN" --no-sandbox + else + exec "$BIN" --no-sandbox "${args[@]}" + fi + fi +} + +error() +{ + if [ -x /usr/bin/zenity ] ; then + LD_LIBRARY_PATH="" zenity --error --text "${1}" 2>/dev/null + elif [ -x /usr/bin/kdialog ] ; then + LD_LIBRARY_PATH="" kdialog --msgbox "${1}" 2>/dev/null + elif [ -x /usr/bin/Xdialog ] ; then + LD_LIBRARY_PATH="" Xdialog --msgbox "${1}" 2>/dev/null + else + echo "${1}" + fi + exit 1 +} + +yesno() +{ + TITLE=$1 + TEXT=$2 + if [ -x /usr/bin/zenity ] ; then + LD_LIBRARY_PATH="" zenity --question --title="$TITLE" --text="$TEXT" 2>/dev/null || exit 0 + elif [ -x /usr/bin/kdialog ] ; then + LD_LIBRARY_PATH="" kdialog --title "$TITLE" --yesno "$TEXT" || exit 0 + elif [ -x /usr/bin/Xdialog ] ; then + LD_LIBRARY_PATH="" Xdialog --title "$TITLE" --clear --yesno "$TEXT" 10 80 || exit 0 + else + echo "zenity, kdialog, Xdialog missing. Skipping ${THIS}." + exit 0 + fi +} + +check_dep() +{ + DEP=$1 + if [ -z $(which "$DEP") ] ; then + echo "$DEP is missing. Skipping ${THIS}." + exit 0 + fi +} + +if [ -z "$APPIMAGE" ] ; then + APPIMAGE="$APPDIR/AppRun" + # not running from within an AppImage; hence using the AppRun for Exec= +fi + diff --git a/electron/main.js b/electron/main.js index 397a3b5..2edeae0 100644 --- a/electron/main.js +++ b/electron/main.js @@ -17,7 +17,8 @@ const appName = productName ?? name const cmd = command( appName, flag('--storage', 'pass custom storage to pear-runtime'), - flag('--no-updates', 'start without OTA updates') + flag('--no-updates', 'start without OTA updates'), + flag('--no-sandbox', 'disable Chromium sandboxing') ) cmd.parse(app.isPackaged ? process.argv.slice(1) : process.argv.slice(2)) diff --git a/forge.config.js b/forge.config.js index b7df6d1..bcce836 100644 --- a/forge.config.js +++ b/forge.config.js @@ -22,7 +22,17 @@ if (process.env.MAC_CODESIGN_IDENTITY) { module.exports = { packagerConfig, - + hooks: { + packageAfterCopy: async (forgeConfig, buildPath) => { + if (process.platform === 'linux') { + const path = await import('path') + const fs = await import('fs') + const customAppRun = path.resolve('build', 'linux', 'AppRun') + const targetPath = path.join(buildPath, '..', '..', 'AppRun') + fs.copyFileSync(customAppRun, targetPath) + } + } + }, makers: [ { name: '@electron-forge/maker-dmg', @@ -30,7 +40,7 @@ module.exports = { config: {} }, { - name: '@forkprince/electron-forge-maker-appimage', + name: 'electron-forge-maker-appimage', platforms: ['linux'] } ], diff --git a/package-lock.json b/package-lock.json index 5e98814..598ef18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "paparam": "^1.10.0", - "pear-runtime": "^0.4.2", + "pear-runtime": "^0.4.3", "which-runtime": "^1.3.2" }, "devDependencies": { @@ -3672,9 +3672,9 @@ } }, "node_modules/compact-encoding": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/compact-encoding/-/compact-encoding-2.18.0.tgz", - "integrity": "sha512-goACAOlhMI2xo5jGOMUDfOLnGdRE1jGfyZ+zie8N5114nHrbPIqf6GLUtzbLof6DSyrERlYRm3EcBplte5LcQw==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/compact-encoding/-/compact-encoding-2.19.0.tgz", + "integrity": "sha512-bPQlzwxgzsuOp0wB6G9TVoZ2tGFANJckQfM10xLKUS2fbLe+fFZG6Gi1wYehcMMTcjvtil8oOJSsToMOlCSu4g==", "license": "Apache-2.0", "dependencies": { "b4a": "^1.3.0" @@ -4078,9 +4078,9 @@ } }, "node_modules/dht-rpc": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/dht-rpc/-/dht-rpc-6.26.0.tgz", - "integrity": "sha512-EpeQIt4L29wH0SqlCj4QZsl3fmeY5RXFFJLeeIB1K/FZaV5gv0Dl160WwV9WCqlBWpTP8Aow5zYhPXqj+Cw+3w==", + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/dht-rpc/-/dht-rpc-6.26.3.tgz", + "integrity": "sha512-KuLfRv/hecUHipQcTXHpVv4/N4Jhpww5sLdsrn3Edm5oHwzK9SgNV34hNt7a2aVZCOcG5SfP4AvcQ7pI+y9YNg==", "license": "MIT", "dependencies": { "adaptive-timeout": "^1.0.1", @@ -6106,13 +6106,15 @@ } }, "node_modules/hyperblobs": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/hyperblobs/-/hyperblobs-2.8.0.tgz", - "integrity": "sha512-s9txNdHAdDMZjOn7B5nPOKXcUe/IGnzgWYhczAQs3TxEAcXFoXTBAtBd0HjorLa0pfvcSgq+v61cW2Chr4LACA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/hyperblobs/-/hyperblobs-2.9.0.tgz", + "integrity": "sha512-kbJV2+QvXIcFejqOj2UgSjeeHMjWqP1n083vcI+j4E93MhV3oVV2L8/6X+K/id/KQrUmngPTzNTHHXKlkb1CEA==", "license": "Apache-2.0", "dependencies": { "b4a": "^1.6.1", "bare-events": "^2.5.0", + "compact-encoding": "^2.18.0", + "hypercore-crypto": "^3.6.1", "hypercore-errors": "^1.1.1", "mutexify": "^1.4.0", "speedometer": "^1.1.0", @@ -6120,9 +6122,9 @@ } }, "node_modules/hypercore": { - "version": "11.24.0", - "resolved": "https://registry.npmjs.org/hypercore/-/hypercore-11.24.0.tgz", - "integrity": "sha512-c0zP5KJLTNAsamqMsv9Esi6kOrvq5WRgozoU5c9gauXTioEmIP4ur2aA4wiMmYhFa2LRvQL92kythJozPWMOdQ==", + "version": "11.26.0", + "resolved": "https://registry.npmjs.org/hypercore/-/hypercore-11.26.0.tgz", + "integrity": "sha512-Ak3WiTl8vDaoGX9VNRuiyTQGs6AD56sKBFJtlVgt1798JfbePWaO5J4wSH74tfvSUPigi6FkOUiJSpvId7AqPA==", "license": "MIT", "dependencies": { "@hyperswarm/secret-stream": "^6.0.0", @@ -6230,13 +6232,13 @@ } }, "node_modules/hyperdrive": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/hyperdrive/-/hyperdrive-13.2.1.tgz", - "integrity": "sha512-LYX/4h3sPOuQ4lGPLf9glHXreutwsl9yWyR1wXmemw6m6W/qFgRRxa6fPGNVVVLZ4v7mDfOJYgEpgRpdMSbNvg==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/hyperdrive/-/hyperdrive-13.3.0.tgz", + "integrity": "sha512-6FQXLE4gARRdrlDck0oeAm0Rz0QRi1x2QWP/FdVCAqlAjHjvHfCMf3M+CeO6HcAyI8GuFN3C9HJm80ytR2dzSg==", "license": "Apache-2.0", "dependencies": { "hyperbee": "^2.11.1", - "hyperblobs": "^2.3.0", + "hyperblobs": "^2.9.0", "hypercore": "^11.0.0", "hypercore-errors": "^1.0.0", "is-options": "^1.0.2", @@ -6250,13 +6252,13 @@ } }, "node_modules/hyperschema": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/hyperschema/-/hyperschema-1.19.1.tgz", - "integrity": "sha512-w8oYEK8j+R418dLhDhhXX6yww5BUg7ye2l3VZ7wE7A5BTUjKHX2F4bzp8r9D1MCMkKa8BvqezpOHQIHhwLbiQw==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/hyperschema/-/hyperschema-1.20.1.tgz", + "integrity": "sha512-7gnvaTNUs8FqdrU3NNE6nzhOneGyDlUlpROu9YFlHA61fE8ppKKf2gLZjZjsx/enNt+VFN4ITxy8ijypfyWBLw==", "license": "Apache-2.0", "dependencies": { "bare-fs": "^4.0.1", - "compact-encoding": "^2.15.0", + "compact-encoding": "^2.19.0", "generate-object-property": "^2.0.0", "generate-string": "^1.0.1" } @@ -6271,9 +6273,9 @@ } }, "node_modules/hyperswarm": { - "version": "4.16.0", - "resolved": "https://registry.npmjs.org/hyperswarm/-/hyperswarm-4.16.0.tgz", - "integrity": "sha512-f86RsI1qP/nbBTv4wYxOhu1JnWvGZgiC1w69aRFn0xGSavLMWjvbbVspVApOnRjiPKpYVVGACXdrvEOrL3rHdw==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/hyperswarm/-/hyperswarm-4.17.0.tgz", + "integrity": "sha512-oe86sK961Ueg7rvDN/veFwG8xH+Iv6vObPhGDkPJcDVxk/NduW41ZhAcVDnHzRbm7S0eLU7WaDUvehOYoKSpRQ==", "license": "MIT", "dependencies": { "b4a": "^1.3.1", @@ -7608,13 +7610,14 @@ } }, "node_modules/mirror-drive": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/mirror-drive/-/mirror-drive-1.12.0.tgz", - "integrity": "sha512-ASoYsRul+fzGT8rzgEEiinKCLZYd/03nclngLim6Gwm97n8jPMHbhIXgBlnkcqeASKsCnTIm3w9hxR6OBbRW4Q==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/mirror-drive/-/mirror-drive-1.13.0.tgz", + "integrity": "sha512-dwf2eIaeFgzv03hfW4aCQ/smNIGuxbsnNRrdGAGIyS70Hp0lbOoHXce2V34hGCoxmzn7jeLA4bHJiWlfKOu2Sg==", "license": "Apache-2.0", "dependencies": { "bare-events": "^2.8.2", "binary-stream-equals": "^1.0.0", + "rabin-stream": "^2.0.0", "same-data": "^1.0.0", "speedometer": "^1.1.0", "streamx": "^2.22.1", @@ -8313,14 +8316,25 @@ } }, "node_modules/pear-runtime": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/pear-runtime/-/pear-runtime-0.4.2.tgz", - "integrity": "sha512-FmBJZkZ78Y2itlosoo1oWZ4K4mQd7o5qJ7hPQLJPvH7Yv0/z4EdJF+8FKg3FwFFc/Y5HobaF94j+qmx3Wr41dA==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/pear-runtime/-/pear-runtime-0.4.3.tgz", + "integrity": "sha512-bqSOWcC3akmZodMKL+SZYXeZPAfWN3IfRlKrZ/40DkVjLwIsXyrq01mbE/sKbXh5npu2J2HQyoOJHE7d0UoHIg==", "license": "Apache-2.0", "dependencies": { - "bare-fs": "^4.5.3", "bare-path": "^3.0.0", "bare-sidecar": "^0.3.0", + "pear-runtime-updater": "^1.0.0", + "ready-resource": "^1.2.0" + } + }, + "node_modules/pear-runtime-updater": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pear-runtime-updater/-/pear-runtime-updater-1.0.0.tgz", + "integrity": "sha512-hRE3YH2T5YtypgJwfexQDWYvH0aE/y8ztTZVT17wYUOWDsBvRGloH77pAO1sdnBKxcXA2tUVcwYY2/fDs+B8fw==", + "license": "Apache-2.0", + "dependencies": { + "bare-fs": "^4.5.3", + "bare-path": "^3.0.0", "corestore": "^7.8.0", "fs-native-extensions": "^1.4.5", "hypercore-id-encoding": "^1.3.0", @@ -8593,6 +8607,25 @@ "quickbit-native": "^2.2.0" } }, + "node_modules/rabin-native": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rabin-native/-/rabin-native-2.0.0.tgz", + "integrity": "sha512-x1BlYdIWh+nk9G0scvxyscrYiDPJ7vQZepqqPlVUSInIko1Zxooi8cm6lzBghEGI9aN3DXiunC8FXLgy6kke3Q==", + "license": "Apache-2.0", + "dependencies": { + "require-addon": "^1.1.0" + } + }, + "node_modules/rabin-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rabin-stream/-/rabin-stream-2.0.0.tgz", + "integrity": "sha512-EzS2Ig/qsMBSk1PahC0O0IPdRZe3bspHHLWChhqW1feKz+J46tlVL3g4wWr4lrQdXGzABIMsOhvdT6bjXYMuUw==", + "license": "Apache-2.0", + "dependencies": { + "rabin-native": "^2.0.0", + "streamx": "^2.23.0" + } + }, "node_modules/rache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/rache/-/rache-1.0.0.tgz", diff --git a/package.json b/package.json index 01ee104..01c473b 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,9 @@ "@electron-forge/maker-dmg": "^7.11.1", "@electron-forge/maker-rpm": "^7.11.1", "@electron-forge/maker-zip": "^7.11.1", - "@forkprince/electron-forge-maker-appimage": "^1.0.11", + "app-builder-lib": "^26.8.1", "electron": "^40.2.1", + "electron-forge-maker-appimage": "^26.8.1", "electron-forge-plugin-prune-prebuilds": "^1.0.0", "electron-forge-plugin-universal-prebuilds": "^1.0.0", "lunte": "^1.6.0",