Skip to content
Closed
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
10 changes: 8 additions & 2 deletions docs/about/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sudo loginctl enable-linger $USER
Install the OpenShell snap from the Snap Store:

```shell
sudo snap install openshell --classic
sudo snap install openshell
```

The snap defines two apps: the `openshell` CLI and the `openshell.gateway`
Expand All @@ -89,6 +89,12 @@ stores its database at `$SNAP_COMMON/gateway.db` (typically
`/var/snap/openshell/common/gateway.db`). Create `$SNAP_COMMON/gateway.toml`
when you need to override gateway settings.

The snap CLI stores per-user config, data, and state under
`$SNAP_USER_COMMON/xdg-*`, typically `~/snap/openshell/common/xdg-*`.
Gateway registrations live under
`$SNAP_USER_COMMON/xdg-config/openshell/gateways/` instead of
`~/.config/openshell/gateways/`.

### Snap store installs

When installing from the Snap Store, snapd automatically connects the `home`,
Expand All @@ -108,7 +114,7 @@ manually.
When installing a locally built `.snap` file, no plugs are connected by default:

```shell
sudo snap install ./openshell_*.snap --dangerous --classic
sudo snap install ./openshell_*.snap --dangerous
sudo snap connect openshell:home
sudo snap connect openshell:network
sudo snap connect openshell:network-bind
Expand Down
8 changes: 8 additions & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ platforms:
apps:
openshell:
command: bin/openshell
environment:
XDG_CONFIG_HOME: "$SNAP_USER_COMMON/xdg-config"
XDG_DATA_HOME: "$SNAP_USER_COMMON/xdg-data"
XDG_STATE_HOME: "$SNAP_USER_COMMON/xdg-state"
Comment on lines +65 to +68

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any preference on these directories vs those from #1972?

plugs:
- home
- network
Expand All @@ -70,6 +74,10 @@ apps:
term:
command: bin/openshell term
desktop: meta/gui/term.desktop
environment:
XDG_CONFIG_HOME: "$SNAP_USER_COMMON/xdg-config"
XDG_DATA_HOME: "$SNAP_USER_COMMON/xdg-data"
XDG_STATE_HOME: "$SNAP_USER_COMMON/xdg-state"
plugs:
- home
- network
Expand Down
22 changes: 22 additions & 0 deletions tasks/scripts/test-packaging-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ assert_not_contains() {
fi
}

assert_occurrences() {
local file=$1
local expected=$2
local count=$3
local actual

actual=$(grep -F "$expected" "$file" | wc -l | tr -d '[:space:]')
if [[ "$actual" != "$count" ]]; then
echo "FAIL: ${file} expected ${count} occurrences of:" >&2
echo " ${expected}" >&2
echo "found ${actual}" >&2
exit 1
fi
}

assert_file_exists() {
local file=$1

Expand All @@ -39,9 +54,11 @@ assert_file_exists() {

service="${ROOT}/deploy/deb/openshell-gateway.service"
spec="${ROOT}/openshell.spec"
snapcraft="${ROOT}/snapcraft.yaml"

assert_file_exists "$service"
assert_file_exists "$spec"
assert_file_exists "$snapcraft"

assert_contains \
"$service" \
Expand All @@ -59,4 +76,9 @@ assert_contains \
'ExecStartPre=/usr/bin/openshell-gateway generate-certs --output-dir ${OPENSHELL_LOCAL_TLS_DIR} --server-san host.openshell.internal'
assert_not_contains "$spec" '%%S/openshell/tls'

assert_contains "$snapcraft" 'confinement: strict'
assert_occurrences "$snapcraft" 'XDG_CONFIG_HOME: "$SNAP_USER_COMMON/xdg-config"' 2
assert_occurrences "$snapcraft" 'XDG_DATA_HOME: "$SNAP_USER_COMMON/xdg-data"' 2
assert_occurrences "$snapcraft" 'XDG_STATE_HOME: "$SNAP_USER_COMMON/xdg-state"' 2
Comment on lines +80 to +82

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I asked in #1972 what is the purpose of testing something that we define ourselves?


echo "packaging asset tests passed"
Loading