Skip to content

Commit

Permalink
treewide: Packaging overhaul
Browse files Browse the repository at this point in the history
Running phrog as a proper greeter session under greetd is a rather
complex and delicate endeavour. It also differs in many subtle ways
across different distros.

So instead of trying to document this stuff, or provide examples, let's
just distribute fully-formed prescriptive configs for each distro. For
now this means Fedora and Alpine since I have the most familiarity with
them (and use them on a regular basis), but I want to pull Debian in
eventually, too.

On Alpine, the init.d script already has support for easily specifying a
separate config file, so we don't need to ship a separate init script.
So all a user needs to do here is drop a cfgfile= into their
/etc/conf.d/greetd.

On Fedora, a distinct phrog.service unit is introduced which conflicts
with greetd's default greetd.service. For now, the only difference this
service has to the default is a --config arg. Later, when we support
Plymouth flicker-free boot, it will also Conflict=plymouth-quit.service
to take over that process (just like gdm.service does).

This commit also introduces the use of gnome-session to run the phrog
shell. This ensures auxiliary services like the gsd-* daemons and an OSK
are present.

Since gnome-session is in place, we also use that to spawn phrog itself,
so a .desktop file is now shipped to handle that.

Rather than shipping a phrog-session wrapper script like Phosh does, we
just embed the necessary incantation into the greetd-phrog.toml, since
this is quite distro-specific a distinct copy of this file is maintained
in distro/<distro>. The example-config/phrog-session introduced recently
is deleted in favour of this new setup.

(Another reason why the phrog-session wrapper isn't desirable here is
that one cannot/shouldn't run the phrog greeter independently, as it
expectsto run under greetd and be supplied a GREETD_SOCK)

The README is updated and cleaned up a bit to reflect this work.

For now, I'm not interested in trying to explain how to get phrog
working on an unsupported distro, since a properly working setup
requires too many auxiliary bits (session + desktop files) and relies on
too many things that differ wildly across every. frigging. distro.
Instead, the README just directs interested folks to get in touch.

Signed-off-by: Sam Day <me@samcday.com>
  • Loading branch information
samcday committed Feb 2, 2025
1 parent 90a862d commit ce8c8b5
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 70 deletions.
4 changes: 4 additions & 0 deletions APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ build() {

package() {
install -Dm644 data/mobi.phosh.phrog.gschema.xml -t "$pkgdir"/usr/share/glib-2.0/schemas/
install -Dm644 data/phrog.session -t "$pkgdir"/usr/share/gnome-session/sessions/
install -Dm644 data/mobi.phosh.Phrog.desktop -t "$pkgdir"/usr/share/applications/
install -Dm644 dist/alpine/greetd-config.toml -t "$pkgdir"/etc/greetd/phrog.toml
install -d "$pkgdir"/usr/share/phrog/autostart
install -Dm755 target/release/phrog -t "$pkgdir"/usr/bin/
}

Expand Down
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,35 @@ It is the spiritual successor of [phog][].

<br clear="right"/>

## Installation
## Usage

* Alpine (v3.21+): `apk add greetd-phrog`
* Fedora ([COPR][]): `sudo dnf copr enable samcday/phrog && sudo dnf install phrog`
* Other: you must build from source, see the Development section below.
### Alpine/postmarketOS

## Running
```
apk add greetd-phrog
`phrog` is a [greetd][] "greeter". To use it, make sure your `/etc/greetd/config.toml` looks like this:
# Configure greetd to run phrog:
cat >> /etc/conf.d/greetd <<HERE
cfgfile="/etc/greetd/config.toml
HERE
rc-update add greetd
```
[default_session]
command = "systemd-cat --identifier=phrog phrog"
```

Then run greetd however your distro prefers you to, see the
[example-config](./example-config) directory for an example greetd config and
startup script that launches greetd in a way suitable for mobile use.

You can also test it outside greetd, nested in your favourite Wayland desktop environment:
### Fedora

```
phoc -S -E "phrog --fake"
# Phrog is not yet available in Fedora's repos
sudo dnf copr enable samcday/phrog
sudo dnf install phrog
sudo systemctl enable phrog
```

### Other

Want to use phrog on another distro? [Please get in touch.](#getting-help)

## Development

`libphosh` is required to build this project.
Expand All @@ -52,11 +56,22 @@ If `libphosh` is not packaged for your distro, you need to build Phosh+libphosh
Once `libphosh` is installed, building and running 🐸 should be as simple as:

```sh
# To run phrog without greetd, pass --fake
# You can "login" to any user with the password "0"
phoc -S -E "cargo run -- --fake"

phoc -S -E "cargo test"
```

## Getting help

Found a bug or want to request a feature? [Please file an issue!][issues]

You can also come chat in Matrix: [#phosh:talk.puri.sm][Matrix]

[phog]: https://gitlab.com/mobian1/phog
[Phosh]: https://gitlab.gnome.org/World/Phosh/phosh
[greetd]: https://sr.ht/~kennylevinsen/greetd/
[COPR]: https://copr.fedorainfracloud.org/coprs/samcday/phrog/
[issues]: /~https://github.com/samcday/phrog/issues
[Matrix]: https://matrix.to/#/#phosh:talk.puri.sm
6 changes: 6 additions & 0 deletions data/mobi.phosh.Phrog.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=Phrog
Comment=Greeter shell for greetd
Type=Application
Exec=phrog
NoDisplay=true
3 changes: 3 additions & 0 deletions data/phrog.session
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[GNOME Session]
Name=phrog
RequiredComponents=mobi.phosh.Phrog;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Power;sm.puri.OSK0;
10 changes: 10 additions & 0 deletions dist/alpine/greetd-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is a greetd config.toml preconfigured to run phrog.
# You can use it by adding the following line to /etc/conf.d/greetd:
# cfgfile="/etc/greetd/phrog.toml"

[terminal]
vt = 7

[default_session]
command = "dbus-run-session phoc -C /usr/share/phrog/phoc.ini -S -E 'gnome-session --autostart=/usr/share/phrog/autostart --session=phrog'"
user = "greetd"
5 changes: 5 additions & 0 deletions dist/fedora/greetd-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vt = 1

[default_session]
command = "systemd-cat --identifier=phrog phoc -S -E 'gnome-session --autostart=/usr/share/phrog/autostart --session=phrog'"
user = "greetd"
20 changes: 20 additions & 0 deletions dist/fedora/phrog.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Phrog greeter daemon
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty1.service
Conflicts=getty@tty1.service greetd.service gdm.service

[Service]
Type=simple
ExecStart=greetd --config=/etc/greetd/phrog.toml
IgnoreSIGPIPE=no
SendSIGHUP=yes
TimeoutStopSec=30s
KeyringMode=shared
Restart=always
RestartSec=1
StartLimitBurst=5
StartLimitInterval=30

[Install]
Alias=display-manager.service
45 changes: 0 additions & 45 deletions example-config/phrog-session

This file was deleted.

8 changes: 0 additions & 8 deletions example-config/phrog.toml

This file was deleted.

14 changes: 12 additions & 2 deletions phrog.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ Provides: greetd-%{name} = %{version}
%{cargo_license} > LICENSE.dependencies

%install
install -d %{buildroot}%{_datadir}/glib-2.0/schemas/
%{__install} -Dpm 0644 data/mobi.phosh.phrog.gschema.xml %{buildroot}%{_datadir}/glib-2.0/schemas/
%{__install} -Dpm 0644 data/phrog.session %{buildroot}%{_datadir}/gnome-session/sessions/
%{__install} -Dpm 0644 data/mobi.phosh.Phrog.desktop %{buildroot}%{_datadir}/applications/
%{__install} -Dpm 0644 dist/fedora/greetd-config.toml %{buildroot}%{_sysconfdir}/greetd/phrog.toml
%{__install} -Dpm 0644 dist/fedora/phrog.service %{buildroot}%{_unitdir}/
%{__install} -d %{buildroot}%{_datadir}/phrog/autostart
%cargo_install

%if %{with check}
Expand All @@ -49,8 +53,14 @@ install -d %{buildroot}%{_datadir}/glib-2.0/schemas/
%files
%license LICENSE
%doc README.md
%{_datadir}/glib-2.0/schemas/*
%{_bindir}/phrog
%{_datadir}/applications/mobi.phosh.Phrog.desktop
%{_datadir}/glib-2.0/schemas/mobi.phosh.phrog.gschema.xml
%{_datadir}/gnome-session/sessions/phrog.session
%{_datadir}/phrog
%{_datadir}/phrog/autostart
%config(noreplace) %{_sysconfdir}/greetd/phrog.toml
%{_unitdir}/phrog.service

%changelog
%autochangelog

0 comments on commit ce8c8b5

Please sign in to comment.