From bc6a90dac10ea78fcacbf28e076434d469f65a48 Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 21 Oct 2024 17:29:15 -0400 Subject: [PATCH 1/5] feat(client/linux): generate Debian package --- client/electron/app_paths.ts | 2 ++ client/electron/debian/after_install.sh | 17 +++++++++++++++++ client/electron/debian/after_remove.sh | 17 +++++++++++++++++ client/electron/electron-builder.json | 16 ++++++++++++++-- 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 client/electron/debian/after_install.sh create mode 100644 client/electron/debian/after_remove.sh diff --git a/client/electron/app_paths.ts b/client/electron/app_paths.ts index 4bbc4498bc..8808655647 100644 --- a/client/electron/app_paths.ts +++ b/client/electron/app_paths.ts @@ -22,6 +22,7 @@ const isWindows = os.platform() === 'win32'; /** * Get the unpacked asar folder path. * - For AppImage, `/tmp/.mount_OutlinXXXXXX/resources/app.asar.unpacked/` + * - For Debian, `/opt/Outline/resources/app.asar.unpacked` * - For Windows, `C:\Program Files (x86)\Outline\` * @returns A string representing the path of the unpacked asar folder. */ @@ -32,6 +33,7 @@ function unpackedAppPath() { /** * Get the parent directory path of the current application binary. * - For AppImage, `/tmp/.mount_OutlinXXXXX/resources/app.asar` + * - For Debian, `/opt/Outline/resources/app.asar` * - For Windows, `C:\Program Files (x86)\Outline\` * @returns A string representing the path of the application directory. */ diff --git a/client/electron/debian/after_install.sh b/client/electron/debian/after_install.sh new file mode 100644 index 0000000000..da62177e5e --- /dev/null +++ b/client/electron/debian/after_install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Copyright 2024 The Outline Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux diff --git a/client/electron/debian/after_remove.sh b/client/electron/debian/after_remove.sh new file mode 100644 index 0000000000..da62177e5e --- /dev/null +++ b/client/electron/debian/after_remove.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Copyright 2024 The Outline Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux diff --git a/client/electron/electron-builder.json b/client/electron/electron-builder.json index daff0bdff0..bbffc77ed3 100644 --- a/client/electron/electron-builder.json +++ b/client/electron/electron-builder.json @@ -7,6 +7,7 @@ "output": "output/client/electron/build" }, "extraMetadata": { + "name": "Outline", "main": "output/client/electron/index.js" }, "files": [ @@ -15,21 +16,32 @@ "output/client/electron", "!output/client/electron/build" ], + + "deb": { + "afterInstall": "client/electron/debian/after_install.sh", + "afterRemove": "client/electron/debian/after_remove.sh" + }, "linux": { "category": "Network", + "executableName": "Outline", "files": [ "client/electron/linux_proxy_controller/dist", "client/electron/icons/png", "client/output/build/linux" ], "icon": "client/electron/icons/png", - "target": { + "maintainer": "The Outline Authors", + "target": [{ "arch": [ "x64" ], "target": "AppImage" - } + }, { + "arch": "x64", + "target": "deb" + }] }, + "nsis": { "include": "client/electron/custom_install_steps.nsh", "perMachine": true From 2d24c95d2020aafd1d703821d876b509a493bdbb Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 21 Oct 2024 17:46:42 -0400 Subject: [PATCH 2/5] rename outline to outline-client --- client/electron/electron-builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/electron/electron-builder.json b/client/electron/electron-builder.json index bbffc77ed3..cf6960e244 100644 --- a/client/electron/electron-builder.json +++ b/client/electron/electron-builder.json @@ -7,7 +7,7 @@ "output": "output/client/electron/build" }, "extraMetadata": { - "name": "Outline", + "name": "outline-client", "main": "output/client/electron/index.js" }, "files": [ From 224bcc914418d150a03581e64e87467cac4a6df8 Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Tue, 22 Oct 2024 17:25:05 -0400 Subject: [PATCH 3/5] apply capabilitites to Outline executable --- client/electron/debian/after_install.sh | 10 ++++++++++ client/electron/debian/after_remove.sh | 17 ----------------- client/electron/electron-builder.json | 7 +++++-- 3 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 client/electron/debian/after_remove.sh diff --git a/client/electron/debian/after_install.sh b/client/electron/debian/after_install.sh index da62177e5e..a6a711a62a 100644 --- a/client/electron/debian/after_install.sh +++ b/client/electron/debian/after_install.sh @@ -14,4 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Dependencies: +# - libcap2-bin: setcap + set -eux + +readonly PREFIX=/opt/Outline + +# Grant specific capabilities so Outline can run without root permisssion +# - cap_net_admin: configure network interfaces, set up routing tables, etc. +# - cap_dac_override: modify network configuration files owned by root +/usr/sbin/setcap cap_net_admin,cap_dac_override+eip ${PREFIX}/Outline diff --git a/client/electron/debian/after_remove.sh b/client/electron/debian/after_remove.sh deleted file mode 100644 index da62177e5e..0000000000 --- a/client/electron/debian/after_remove.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Copyright 2024 The Outline Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eux diff --git a/client/electron/electron-builder.json b/client/electron/electron-builder.json index cf6960e244..5027e9580f 100644 --- a/client/electron/electron-builder.json +++ b/client/electron/electron-builder.json @@ -18,8 +18,11 @@ ], "deb": { - "afterInstall": "client/electron/debian/after_install.sh", - "afterRemove": "client/electron/debian/after_remove.sh" + "depends": [ + "gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3", + "libcap2-bin" + ], + "afterInstall": "client/electron/debian/after_install.sh" }, "linux": { "category": "Network", From 87d8b80f6c24543fb65350cc91e4b241107f06b4 Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Tue, 22 Oct 2024 17:38:16 -0400 Subject: [PATCH 4/5] simplify after install script --- client/electron/debian/after_install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/electron/debian/after_install.sh b/client/electron/debian/after_install.sh index a6a711a62a..f2a785aae1 100644 --- a/client/electron/debian/after_install.sh +++ b/client/electron/debian/after_install.sh @@ -19,9 +19,7 @@ set -eux -readonly PREFIX=/opt/Outline - # Grant specific capabilities so Outline can run without root permisssion # - cap_net_admin: configure network interfaces, set up routing tables, etc. # - cap_dac_override: modify network configuration files owned by root -/usr/sbin/setcap cap_net_admin,cap_dac_override+eip ${PREFIX}/Outline +/usr/sbin/setcap cap_net_admin,cap_dac_override+eip /opt/Outline/Outline From 113af606cb632907d171caa3337a306ec909f97d Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Fri, 1 Nov 2024 19:36:01 -0400 Subject: [PATCH 5/5] update maintainer to Jigsaw LLC --- client/electron/electron-builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/electron/electron-builder.json b/client/electron/electron-builder.json index 5027e9580f..af2651b054 100644 --- a/client/electron/electron-builder.json +++ b/client/electron/electron-builder.json @@ -33,7 +33,7 @@ "client/output/build/linux" ], "icon": "client/electron/icons/png", - "maintainer": "The Outline Authors", + "maintainer": "Jigsaw LLC", "target": [{ "arch": [ "x64"