feat(kopiaui): support for AppArmor on Ubuntu 24.04 (#4318)

This commit is contained in:
Jarek Kowalski
2024-12-28 15:44:53 -08:00
committed by GitHub
parent 5a9cd33e55
commit 8adf978a98
5 changed files with 514 additions and 378 deletions

View File

@@ -123,6 +123,10 @@ MAYBE_XVFB=xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" --
endif
kopia-ui-test:
ifeq ($(GOOS)/$(GOARCH),linux/amd64)
# on Linux we run from installed location due to AppArmor requirement on Ubuntu 24.04
sudo apt-get install -y ./dist/kopia-ui/kopia-ui*_amd64.deb
endif
$(MAYBE_XVFB) $(MAKE) -C app e2e-test
# use this to test htmlui changes in full build of KopiaUI, this is rarely needed

11
app/kopia-ui.apparmor Normal file
View File

@@ -0,0 +1,11 @@
# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"
abi <abi/4.0>,
include <tunables/global>
profile kopia-ui "/opt/KopiaUI/kopia-ui" flags=(unconfined) {
userns,
include if exists <local/kopia-ui>
}

836
app/package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -110,6 +110,15 @@
},
"afterSign": "notarize.cjs"
},
"deb": {
"appArmorProfile": "kopia-ui.apparmor"
},
"rpm": {
"appArmorProfile": "kopia-ui.apparmor"
},
"AppImage": {
"appArmorProfile": "kopia-ui.apparmor"
},
"devDependencies": {
"@electron/notarize": "^2.5.0",
"@playwright/test": "^1.49.0",
@@ -117,7 +126,7 @@
"concurrently": "^9.1.0",
"dotenv": "^16.4.5",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"electron-builder": "^v26.0.0-alpha.8",
"electron-store": "^10.0.0",
"playwright": "^1.37.1",
"playwright-core": "^1.35.1"

View File

@@ -5,16 +5,18 @@ import path from 'path';
let electronApp
function getKopiaUIUnpackedDir() {
function getKopiaUIDir() {
switch (process.platform + "/" + process.arch) {
case "darwin/x64":
return path.resolve("../dist/kopia-ui/mac");
case "darwin/arm64":
return path.resolve("../dist/kopia-ui/mac-arm64");
case "linux/x64":
return path.resolve("../dist/kopia-ui/linux-unpacked");
// on Linux we must run from installed location due to AppArmor profile
return path.resolve("/opt/KopiaUI");
case "linux/arm64":
return path.resolve("../dist/kopia-ui/linux-arm64-unpacked");
// on Linux we must run from installed location due to AppArmor profile
return path.resolve("/opt/KopiaUI");
case "win32/x64":
return path.resolve("../dist/kopia-ui/win-unpacked");
default:
@@ -22,32 +24,32 @@ function getKopiaUIUnpackedDir() {
}
}
function getMainPath(unpackedDir) {
function getMainPath(kopiauiDir) {
switch (process.platform) {
case "darwin":
return path.join(unpackedDir, "KopiaUI.app", "Contents", "Resources", "app.asar", "public", "electron.js");
return path.join(kopiauiDir, "KopiaUI.app", "Contents", "Resources", "app.asar", "public", "electron.js");
default:
return path.join(unpackedDir, "resources", "app.asar", "public", "electron.js");
return path.join(kopiauiDir, "resources", "app.asar", "public", "electron.js");
}
}
function getExecutablePath(unpackedDir) {
function getExecutablePath(kopiauiDir) {
switch (process.platform) {
case "win32":
return path.join(unpackedDir, "KopiaUI.exe");
return path.join(kopiauiDir, "KopiaUI.exe");
case "darwin":
return path.join(unpackedDir, "KopiaUI.app", "Contents", "MacOS", "KopiaUI");
return path.join(kopiauiDir, "KopiaUI.app", "Contents", "MacOS", "KopiaUI");
default:
return path.join(unpackedDir, "kopia-ui");
return path.join(kopiauiDir, "kopia-ui");
}
}
test.beforeAll(async () => {
const unpackedDir = getKopiaUIUnpackedDir();
expect(unpackedDir).not.toBeNull();
const kopiauiDir = getKopiaUIDir();
expect(kopiauiDir).not.toBeNull();
const mainPath = getMainPath(unpackedDir);
const executablePath = getExecutablePath(unpackedDir);
const mainPath = getMainPath(kopiauiDir);
const executablePath = getExecutablePath(kopiauiDir);
console.log('main path', mainPath);
console.log('executable path', executablePath);