42 lines
2.4 KiB
Shell
Executable file
42 lines
2.4 KiB
Shell
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: LGPL-3.0-only
|
|
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
#
|
|
# Installs nostro for every user of this machine: the system files nostrod needs (its user, its D-Bus and polkit
|
|
# policies, its systemd unit, the nostro command) and the net.catcrafts.Nostro Flatpak, system-wide. Run as root.
|
|
#
|
|
# install.sh the Flatpak from the system remote "catcrafts" (packaging/flatpak/net.catcrafts.Nostro.flatpakref
|
|
# sets it up: flatpak install --system net.catcrafts.Nostro.flatpakref)
|
|
# install.sh --repo DIR the Flatpak from a local repository, as flatpak-builder --repo=DIR makes one, for testing
|
|
#
|
|
# Running it again updates. packaging/arch/PKGBUILD installs the same files from a package; uninstall.sh removes them.
|
|
set -eu
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
|
|
repo=
|
|
if [ "${1:-}" = --repo ]; then
|
|
repo=$(cd "${2:?--repo needs a directory}" && pwd)
|
|
fi
|
|
|
|
install -Dm644 "$here/nostro.sysusers" /usr/lib/sysusers.d/nostro.conf
|
|
systemd-sysusers /usr/lib/sysusers.d/nostro.conf
|
|
install -Dm644 "$here/net.catcrafts.Nostro1.conf" /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf
|
|
install -Dm644 "$here/net.catcrafts.Nostro1.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service
|
|
install -Dm644 "$here/net.catcrafts.Nostro1.Checkout.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service
|
|
install -Dm644 "$here/net.catcrafts.Nostro1.policy" /usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy
|
|
install -Dm644 "$here/nostrod.service" /etc/systemd/system/nostrod.service
|
|
install -Dm755 "$here/nostro" /usr/local/bin/nostro
|
|
|
|
if [ -n "$repo" ]; then
|
|
# A local repository is unsigned: for a build of your own, never for one from elsewhere.
|
|
flatpak remote-add --system --if-not-exists --no-gpg-verify nostro-local "file://$repo"
|
|
flatpak install --system -y --noninteractive --or-update nostro-local net.catcrafts.Nostro//stable
|
|
else
|
|
flatpak install --system -y --noninteractive --or-update catcrafts net.catcrafts.Nostro//stable
|
|
fi
|
|
|
|
systemctl daemon-reload
|
|
busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig
|
|
# A nostrod already running keeps the old files until it ends; stop it, and the next call starts the new one.
|
|
systemctl try-restart nostrod.service
|
|
echo "nostro is installed: nostrod starts with the first call, such as 'nostro connectors add bunq'"
|