Skip to content

Commit 837cd37

Browse files
committed
feat: setup for initial-setup session
1 parent 31c3343 commit 837cd37

18 files changed

+392
-508
lines changed

Cargo.lock

Lines changed: 235 additions & 231 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ itoa = "1.0.15"
2727
lazy_static = "1"
2828
num-derive = "0.4.2"
2929
num-traits = "0.2.19"
30+
pwd = "1.4.0"
3031
pwhash = "1.0.0"
3132
regex = "1"
3233
ron = "0.10.1"
3334
rust-embed = "8"
34-
rustix = { version = "1.0.7", features = ["process"]}
35+
rustix = { version = "1.0.7", features = ["process"] }
3536
secure-string = "0.3.0"
3637
serde = { version = "1.0.219", features = ["derive"] }
3738
slab = "0.4.9"
@@ -86,15 +87,18 @@ wgpu = ["libcosmic/wgpu"]
8687
inherits = "release"
8788
debug = true
8889

90+
[profile.release]
91+
lto = "thin"
92+
8993
[workspace]
9094
members = ["geonames"]
9195

9296
[patch."https://github.com/smithay/client-toolkit.git"]
9397
sctk = { package = "smithay-client-toolkit", version = "=0.19.2" }
9498

95-
# [patch.'https://github.com/pop-os/cosmic-protocols']
96-
# cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "67df697" }
97-
# cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "67df697" }
99+
[patch.'https://github.com/pop-os/cosmic-protocols']
100+
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "178eb0b" }
101+
cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "178eb0b" }
98102

99103
# [patch.'https://github.com/pop-os/libcosmic.git']
100104
# libcosmic = { path = "../libcosmic" }

debian/cosmic-initial-setup.postinst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
set -eu
3+
getent passwd cosmic-initial-setup >/dev/null || adduser --system --force-badname --quiet \
4+
--home /run/cosmic-initial-setup/ --no-create-home --shell /bin/bash cosmic-initial-setup
5+
#DEBHELPER#
6+
exit 0

debian/cosmic-initial-setup.postrm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
if [ "$1" = "purge" ] ; then
4+
if getent passwd cosmic-initial-setup >/dev/null && which deluser >/dev/null 2>&1; then
5+
deluser --system cosmic-initial-setup || echo "Could not remove cosmic-initial-setup user."
6+
fi
7+
fi
8+
#DEBHELPER#
9+
exit 0

debian/rules

100644100755
File mode changed.

justfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
1010
bin-src := cargo-target-dir / 'release' / name
1111
bin-dst := base-dir / 'bin' / name
1212

13+
polkit-rules-src := 'res' / '20-cosmic-initial-setup.rules'
14+
polkit-rules-dst := base-dir / 'share' / 'polkit-1' / 'rules.d' / '20-cosmic-initial-setup.rules'
15+
16+
desktop-entry := APPID + '.desktop'
17+
desktop-src := 'res' / desktop-entry
18+
desktop-dst := base-dir / 'share' / 'applications' / desktop-entry
19+
20+
autostart-entry := APPID + '.Autostart.desktop'
21+
autostart-src := 'res' / autostart-entry
22+
autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry
23+
1324
# Default recipe which runs `just build-release`
1425
default: build-release
1526

@@ -56,10 +67,13 @@ run *args:
5667
# Installs files
5768
install:
5869
install -Dm0755 {{bin-src}} {{bin-dst}}
70+
install -Dm0644 {{desktop-src}} {{desktop-dst}}
71+
install -Dm0644 {{autostart-src}} {{autostart-dst}}
72+
install -Dm0644 {{polkit-rules-src}} {{polkit-rules-dst}}
5973

6074
# Uninstalls installed files
6175
uninstall:
62-
rm {{bin-dst}}
76+
rm {{bin-dst}} {{desktop-dst}} {{polkit-rules-dst}}
6377

6478
# Vendor dependencies locally
6579
vendor:

res/20-cosmic-initial-setup.rules

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
2+
//
3+
// DO NOT EDIT THIS FILE, it will be overwritten on update.
4+
//
5+
// Allow the cosmic-initial-setup user to do certain actions without
6+
// being interrupted by password dialogs
7+
8+
polkit.addRule(function(action, subject) {
9+
if (subject.user !== 'cosmic-initial-setup')
10+
return undefined;
11+
12+
var actionMatches = (action.id.indexOf('org.freedesktop.hostname1.') === 0 ||
13+
action.id.indexOf('org.freedesktop.NetworkManager.') === 0 ||
14+
action.id.indexOf('org.freedesktop.locale1.') === 0 ||
15+
action.id.indexOf('org.freedesktop.accounts.') === 0 ||
16+
action.id.indexOf('org.freedesktop.timedate1.') === 0 ||
17+
action.id.indexOf('org.freedesktop.realmd.') === 0 ||
18+
action.id.indexOf('com.endlessm.ParentalControls.') === 0 ||
19+
action.id.indexOf('org.fedoraproject.thirdparty.') === 0);
20+
21+
if (actionMatches) {
22+
if (subject.local)
23+
return 'yes';
24+
else
25+
return 'auth_admin';
26+
}
27+
28+
return undefined;
29+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=COSMIC Initial Setup
4+
Exec=cosmic-initial-Setup
5+
ExecCondition=unless-exists ./config/cosmic-initial-setup-done
6+
NoDisplay=true
7+
OnlyShowIn=COSMIC
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Desktop Entry]
2+
Name=Initial Setup
3+
Icon=preferences-system
4+
Exec=cosmic-initial-setup
5+
Terminal=false
6+
Type=Application
7+
StartupNotify=true
8+
Categories=COSMIC;System
9+
OnlyShowIn=COSMIC
10+
NoDisplay=true
11+
X-GNOME-HiddenUnderSystemd=@systemd_hidden@
12+
StartupWMClass=com.system76.CosmicInitialSetup

src/getent.rs

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)