Install the fork's own three files, not upstream's seven

`just install` still wrote the stock session: /usr/bin/cosmic-session, the
cosmic.desktop entry, the systemd target, the mimeapps list and the dconf
profile. Every one of those is a file the distro's cosmic-session package
already owns, so running it replaced a working COSMIC install with this fork
and left no session to log into if the fork failed to start. What HyprCosmic
has actually been installing, by hand, is three files; this teaches the recipe
that.

The binary moves to $prefix/libexec/hyprcosmic for the reason the compositor
did in Patch D: the stock session has to keep working, because it is what you
use to fix this one. cosmic.desktop is replaced by hyprcosmic.desktop, which
adds a second entry to the greeter's menu rather than overwriting the first.

The four dropped files are not things this fork changes, and a HyprCosmic
session needs stock COSMIC present anyway -- the greeter, the portals and the
settings daemon all come from it -- so reading that package's copies costs
nothing and avoids a packaging conflict over files we have no opinion about.

Upstream's `sed` over DCONF_PROFILE is deliberately not carried across.
start-hyprcosmic searches /etc/dconf/profile and then XDG_DATA_DIRS and exports
the bare profile name only if it finds one; rewriting a prefix into it would
pin one location and defeat an administrator's /etc override. The script
already explains this at the point where it does the search.

Verified by staging into a rootdir: all three files come out byte-identical to
the copies currently installed on this machine, and install-assets.sh --check
still reports all 9 managed files matching.
This commit is contained in:
2026-08-10 16:41:05 +07:00
parent e6f8d560ab
commit b22fe1687d
+35 -15
View File
@@ -9,6 +9,12 @@ systemddir := usrdir / 'lib' / 'systemd' / 'user'
sessiondir := usrdir / 'share' / 'wayland-sessions'
applicationdir := usrdir / 'share' / 'applications'
# The fork's own binary directory. It stays out of bindir for the same reason
# the compositor does: the distro's cosmic-session owns /usr/bin/cosmic-session,
# and overwriting it would break the stock session -- the one you need to log
# into when this one will not start.
privdir := usrdir / 'libexec' / 'hyprcosmic'
default: build-release
build-debug *args:
@@ -29,26 +35,40 @@ clean-dist: clean
rm -rf .cargo vendor vendor.tar target
# Installs files into the system
#
# Three files, where upstream installs seven. The four that are gone are not
# oversights -- each is owned by the distro's own cosmic-session package, and
# writing them from here would make a HyprCosmic package conflict with it:
#
# data/start-cosmic -> /usr/bin/start-cosmic
# data/cosmic-session.target -> systemd user target
# data/cosmic-mimeapps.list -> the default-applications list
# data/dconf/profile/cosmic -> the dconf profile
#
# None of them are things this fork changes, and a HyprCosmic session needs
# stock COSMIC installed regardless, for the greeter, the portals and the
# settings daemon. So it reads that package's copies rather than shipping rival
# ones. `data/cosmic.desktop` is dropped for the same reason and replaced by
# hyprcosmic.desktop, which is what puts the second entry on the greeter's menu
# instead of overwriting the first.
#
# Upstream's `sed` over DCONF_PROFILE is deliberately not carried across.
# start-hyprcosmic searches /etc/dconf/profile and then XDG_DATA_DIRS for the
# profile and exports the bare name only if it finds one; rewriting a prefix
# into it would pin one location and break an administrator's /etc override.
# The script says so at the point where it does the search.
install:
echo {{ cosmic_dconf_profile }}
# main binary
install -Dm0755 {{ cargo-target-dir }}/release/cosmic-session {{ bindir }}/cosmic-session
install -Dm0755 {{ cargo-target-dir }}/release/cosmic-session {{ privdir }}/cosmic-session
# session start script
install -Dm0755 data/start-cosmic {{ bindir }}/start-cosmic
sed -i "s|DCONF_PROFILE=cosmic|DCONF_PROFILE={{ cosmic_dconf_profile }}|" {{ bindir }}/start-cosmic
install -Dm0755 data/start-hyprcosmic {{ bindir }}/start-hyprcosmic
# systemd target
install -Dm0644 data/cosmic-session.target {{ systemddir }}/cosmic-session.target
# session
install -Dm0644 data/cosmic.desktop {{ sessiondir }}/cosmic.desktop
# mimeapps
install -Dm0644 data/cosmic-mimeapps.list {{ applicationdir }}/cosmic-mimeapps.list
# dconf profile
install -Dm644 data/dconf/profile/cosmic {{ rootdir }}/{{ cosmic_dconf_profile }}
# session entry. Note that hyprcosmic.desktop names /usr/bin/start-hyprcosmic
# as an absolute Exec: a .desktop file has no way to interpolate a prefix,
# so building with prefix != /usr installs an entry that points at a path
# this recipe did not write.
install -Dm0644 data/hyprcosmic.desktop {{ sessiondir }}/hyprcosmic.desktop
# Vendor Cargo dependencies locally
vendor: