Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client/linux): generate Debian package #2255

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/electron/app_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand Down
25 changes: 25 additions & 0 deletions client/electron/debian/after_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/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.

# Dependencies:
# - libcap2-bin: setcap

set -eux

# 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 /opt/Outline/Outline
19 changes: 17 additions & 2 deletions client/electron/electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"output": "output/client/electron/build"
},
"extraMetadata": {
"name": "outline-client",
"main": "output/client/electron/index.js"
},
"files": [
Expand All @@ -15,21 +16,35 @@
"output/client/electron",
"!output/client/electron/build"
],

"deb": {
"depends": [
"gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add them as comments to the file? Ugh, it's JSON...

Copy link
Contributor Author

@jyyi1 jyyi1 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, JSON is bad. How about adding the field "_depends_comment": "there are electron required deps"? No, electron will complain about unknown fields.

"libcap2-bin"
],
"afterInstall": "client/electron/debian/after_install.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": "Jigsaw LLC",
"target": [{
"arch": [
"x64"
],
"target": "AppImage"
}
}, {
"arch": "x64",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we support arm as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, we also need to update Go compiler arguments for tun2socks. (And I don't have a ARM based machine to test) Could we add this later?

"target": "deb"
}]
},

"nsis": {
"include": "client/electron/custom_install_steps.nsh",
"perMachine": true
Expand Down
Loading