From 0e38362989840c1a69dd8dce43a06ed06699ed50 Mon Sep 17 00:00:00 2001 From: taca Date: Sun, 13 May 2018 16:40:59 +0200 Subject: [PATCH] nosh 1.37 release * various issues have been fixed by using 1.38 source changes --- .SRCINFO | 20 +- PKGBUILD | 31 +- README.md | 11 +- archnosh.changelog | 4 + gnome-maps.service.linux | 16 + gnome-weather-application.service.linux | 16 + misc.patch | 1030 +++++++++++++++++++++++++++++++ os_version.do | 27 + per-user-exec.patch | 48 -- uscheduled.service | 14 + uscheduled.socket | 14 + watchman.service | 17 + watchman.socket | 12 + 13 files changed, 1203 insertions(+), 57 deletions(-) create mode 100644 gnome-maps.service.linux create mode 100644 gnome-weather-application.service.linux create mode 100644 misc.patch create mode 100755 os_version.do delete mode 100644 per-user-exec.patch create mode 100644 uscheduled.service create mode 100644 uscheduled.socket create mode 100644 watchman.service create mode 100644 watchman.socket diff --git a/.SRCINFO b/.SRCINFO index 3ab89d9..88334f1 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -18,6 +18,14 @@ pkgbase = nosh source = staging.patch source = maintenance-scripts.patch source = scriptletbuilder.sh + source = misc.patch + source = os_version.do + source = gnome-maps.service.linux + source = gnome-weather-application.service.linux + source = watchman.service + source = watchman.socket + source = uscheduled.service + source = uscheduled.socket source = nosh-bundles.install source = nosh-run-busybox-mdev.install source = nosh-run-debian-desktop-base.install @@ -38,8 +46,16 @@ pkgbase = nosh source = nosh-service-management.install sha256sums = a8bfe55b9f3e61097c1dfaa23c8d5ea0c39e1dc1ddf0b669133c1d7723911c93 sha256sums = e7fc3022780a179a0da293b0da4094deef770cb6f4572b39c6bec4e38752f0d5 - sha256sums = 02529c958ba5e1051d735cdf5721ae9bb127eeffffb51c753c799d47dfd5163f + sha256sums = 8f2a1ba80ac5a6a912579a70454bc843d551db22bd1ef7e6dda9124167a7fa00 sha256sums = 907d92546845ab087be38515fcbd04bec68b68a250534063695e73646241454c + sha256sums = fd07dd551ad82a813bcd50d91f0395e26dbae93e36f76ac21c2439683ab777a6 + sha256sums = 156a4251a0acb56ff999a543563c91a6268294da92e45c030bbad8719d9b425b + sha256sums = 12e480b923b4828dc30907fa0e4deffbf68d1eff2da672fb7933f0bf5a829c93 + sha256sums = 65a81acca6504d4bf0843b59d7f70228499f84d79e13d68968eacdba7b9e60f8 + sha256sums = ed18d04556bdf208a4a69ff866d49bdf65129639b32f15a4aab5193477bb8f37 + sha256sums = 944e8a7a4662ce8e3ebccf64db792407e0ac5e16fb91324513e37bc042c7d56f + sha256sums = 37fcde3d74c70e92ee7b606fd50cdffbd45a70a7348745cf5756b762b3602aab + sha256sums = bda8c7717fd71ee49c8d99e0fc0c595068d7e9bc7dc9aa9dda9d2840e9ef04cb sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP @@ -97,8 +113,6 @@ pkgname = nosh-ucspi-tcp-shims pkgname = nosh-kbd-shims -pkgname = nosh-logrotate-shims - pkgname = nosh-bundles pkgname = nosh-run-system-manager diff --git a/PKGBUILD b/PKGBUILD index 6933cd9..cc3cac9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -93,7 +93,14 @@ source=("https://jdebp.eu/Repository/freebsd/nosh-$pkgver.tar.gz" "staging.patch" "maintenance-scripts.patch" "scriptletbuilder.sh" - "per-user-exec.patch" + "misc.patch" + "os_version.do" + "gnome-maps.service.linux" + "gnome-weather-application.service.linux" + "watchman.service" + "watchman.socket" + "uscheduled.service" + "uscheduled.socket" "nosh-bundles.install" "nosh-run-busybox-mdev.install" @@ -120,8 +127,15 @@ sha256sums=( 'e7fc3022780a179a0da293b0da4094deef770cb6f4572b39c6bec4e38752f0d5' # staging.patch '8f2a1ba80ac5a6a912579a70454bc843d551db22bd1ef7e6dda9124167a7fa00' # maintenance-scripts.patch '907d92546845ab087be38515fcbd04bec68b68a250534063695e73646241454c' # scriptletbuilder.sh - '7d52bb895ecffb721712fe76c6a57351c744f9ef96a5fa2521133e609f52c942' # per-user-exec.patch - + 'fd07dd551ad82a813bcd50d91f0395e26dbae93e36f76ac21c2439683ab777a6' # misc.patch + '156a4251a0acb56ff999a543563c91a6268294da92e45c030bbad8719d9b425b' # os_version.do + '12e480b923b4828dc30907fa0e4deffbf68d1eff2da672fb7933f0bf5a829c93' # gnome-maps.service.linux + '65a81acca6504d4bf0843b59d7f70228499f84d79e13d68968eacdba7b9e60f8' # gnome-weather-application.service.linux + 'ed18d04556bdf208a4a69ff866d49bdf65129639b32f15a4aab5193477bb8f37' # watchman.service + '944e8a7a4662ce8e3ebccf64db792407e0ac5e16fb91324513e37bc042c7d56f' # watchman.socket + '37fcde3d74c70e92ee7b606fd50cdffbd45a70a7348745cf5756b762b3602aab' # uscheduled.service + 'bda8c7717fd71ee49c8d99e0fc0c595068d7e9bc7dc9aa9dda9d2840e9ef04cb' # uscheduled.socket + 'SKIP' # nosh-bundles.install 'SKIP' # nosh-run-busybox-mdev.install 'SKIP' # nosh-run-debian-desktop-base.install @@ -162,7 +176,10 @@ prepare() { sed -i 's@usr/local/lib@usr/lib@g' nosh-run-via-systemd.post_install.extra nosh-run-via-systemd.post_upgrade.extra cd "${srcdir}" patch -p1 -i "${srcdir}"/maintenance-scripts.patch - patch -p1 -i "${srcdir}"/per-user-exec.patch + patch -p1 -i "${srcdir}"/misc.patch + + # add 1.38 backported os_version, needed at build time + install -v -m 755 "${srcdir}"/os_version.do "${srcdir}"/source/ } build() { @@ -303,6 +320,12 @@ _package() { pkgdesc="Service bundles" depends+=( 'nosh-common' 'nosh-service-management>=1.37' 'nosh-exec>=1.37' 'nosh-terminal-management>=1.22' 'shadow' ) install="nosh-bundles.install" + install -D -v -m 444 "${srcdir}"/gnome-maps.service.linux "${pkgdir}"/etc/system-control/convert/per-user/gnome-maps.service + install -v -m 444 "${srcdir}"/gnome-weather-application.service.linux "${pkgdir}"/etc/system-control/convert/per-user/gnome-weather-application.service + install -v -m 444 "${srcdir}"/watchman.service "${pkgdir}"/etc/system-control/convert/per-user/ + install -v -m 444 "${srcdir}"/watchman.socket "${pkgdir}"/etc/system-control/convert/per-user/ + install -v -m 444 "${srcdir}"/uscheduled.service "${pkgdir}"/etc/system-control/convert/per-user/ + install -v -m 444 "${srcdir}"/uscheduled.socket "${pkgdir}"/etc/system-control/convert/per-user/ ;; nosh-run-system-manager) pkgdesc="Run the nosh system manager" diff --git a/README.md b/README.md index 4777097..faeb7fd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The packaging here closely follows the [Debian packaging](https://jdebp.eu/Softw With caution! Installing some of the nosh packages provided here can profoundly change the way your system bootstraps and runs services. -Furthermore, the packages have so far been tested locally on virtual machines with minimum installs of early 2017 Archlinux releases and on a personal laptop, where they *do* work for the most part but tailoring to your system will be necessary. +Furthermore, the packages have so far been tested locally on virtual machines with minimum installs of early 2018 Archlinux releases and on a personal laptop, where they *do* work for the most part but tailoring to your system will be necessary. *Caveat emptor.* @@ -40,7 +40,7 @@ The make dependencies are the following and require [AUR](https://wiki.archlinux For [package building](https://wiki.archlinux.org/index.php/Arch_Build_System) in general, ensure the [base-devel](https://www.archlinux.org/groups/x86_64/base-devel/) package is installed. -#### Build the packages +#### Build and install the packages Put the files in a directory and run: @@ -50,6 +50,13 @@ You can then install the generated packages with: # pacman -U +N.B.: due to a change in dbus-daemon behaviour and since nosh-1.37, the `nosh-service-management` package needs to override the `dbus-daemon-launch-helper` binary from the `core/dbus` Archlinux package with its own. While the Debian package uses the `dpkg-divert` mechanism, no similar method appears to exist on Arch (suggestions welcome). + +The Archnosh package currently overwrites `/usr/lib/dbus-1.0/dbus-daemon-launch-helper`. This has two consequences: + +* one must use the `--force` option when installing with pacman to avoid a file collision error +* `nosh-service-management` now competes with `core/dbus` and must be reinstalled when the latter is updated. + ### Running nosh diff --git a/archnosh.changelog b/archnosh.changelog index 7873902..933f2eb 100644 --- a/archnosh.changelog +++ b/archnosh.changelog @@ -1,3 +1,7 @@ +1.37-1 +* backported 1.38 fixes +* dbus-daemon is non-cooperative, nosh-service-management has to override dbus-daemon-launch-helper and be installed with `pacman --force`, core/dbus now competes with this package (no dpkg-divert equivalent found for Arch) + 1.36-1 * added nosh-freebsd-shims package diff --git a/gnome-maps.service.linux b/gnome-maps.service.linux new file mode 100644 index 0000000..5f3a6f4 --- /dev/null +++ b/gnome-maps.service.linux @@ -0,0 +1,16 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=GNOME maps for %u + +[Service] +Type=dbus +# The fact that the GNOME Maps server requires an X display at startup is a bug. +EnvironmentDirectory=../../../common/env +EnvironmentDirectory=env +ExecStart=/usr/share/gnome-maps/org.gnome.Weather.Application --gapplication-service +Restart=on-abort + +[Install] diff --git a/gnome-weather-application.service.linux b/gnome-weather-application.service.linux new file mode 100644 index 0000000..d81c312 --- /dev/null +++ b/gnome-weather-application.service.linux @@ -0,0 +1,16 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=GNOME weather application for %u + +[Service] +Type=dbus +# The fact that the GNOME Weather Application server requires an X display at startup is a bug. +EnvironmentDirectory=../../../common/env +EnvironmentDirectory=env +ExecStart=/usr/share/org.gnome.Weather/org.gnome.Weather.Application --gapplication-service +Restart=on-abort + +[Install] diff --git a/misc.patch b/misc.patch new file mode 100644 index 0000000..2bf9845 --- /dev/null +++ b/misc.patch @@ -0,0 +1,1030 @@ +diff --git a/source/convert/dbus-services.do b/source/convert/dbus-services.do +new file mode 100755 +index 0000000..c435cfc +--- /dev/null ++++ b/source/convert/dbus-services.do +@@ -0,0 +1,136 @@ ++#!/bin/sh -e ++## ************************************************************************** ++## For copyright and licensing terms, see the file named COPYING. ++## ************************************************************************** ++# vim: set filetype=sh: ++# ++# Convert the Desktop Bus system-wide services. ++# This is invoked by all.do . ++# ++ ++case "`uname`" in ++Linux) ++ redo-ifchange rc.conf ++ ++ # This gets us *only* the configuration variables, safely. ++ read_rc() { clearenv read-conf rc.conf printenv "$1" ; } ++ ++ case "`read_rc os_version`" in ++ arch:*) g=dbus ;; ++ debian:*) g=messagebus ;; ++ gentoo:*) g=messagebus ;; ++ centos:*) g=dbus ;; ++ rhel:*) g=dbus ;; ++ *) echo 1>&2 "$0: Do not know the message bus group for your system." ; exec false ;; ++ esac ++ ;; ++*BSD) g=messagebus ;; ++*) echo 1>&2 "$0: Do not know the message bus group for your system." ; exec false ;; ++esac ++ ++sr="/var/sv/" ++lr="/var/local/sv/" ++e="--no-systemd-quirks --escape-instance --bundle-root" ++ ++allow_dbus_bus_activation() { ++ rm -f -- "$1/service/down" ++ install -d -m 0750 -- "$1/supervise" ++ test -p "$1/supervise/control" || mkfifo -m 0600 -- "$1/supervise/control" ++ setfacl -m "g:${g}:rx" "$1/supervise/" || setfacl -m "group:${g}:rx::allow" "$1/supervise/" || : ++ setfacl -m "g:${g}:w" "$1/supervise/control" || setfacl -m "group:${g}:wp::allow" "$1/supervise/control" || : ++} ++ ++link_service_to_logger_service() { ++ rm -f -- "${lr}/$1/log" ++ ln -s -- "../$2" "${lr}/$1/log" ++ rm -f -- "${lr}/$1/wants/log" "${lr}/$1/after/log" ++ ln -s -- "../log" "${lr}/$1/wants/log" ++ ln -s -- "../log" "${lr}/$1/after/log" ++} ++ ++redo-ifchange -- "${sr}/" ++allow_dbus_bus_activation "${sr}/cyclog@dbus" ++ ++# Make .service source files for all system-wide Desktop Bus service definitions. ++# Then make service bundles from those. ++for p in /usr/local/share /usr/share /share ++do ++ if ! test -e "$p" ++ then ++ redo-ifcreate "$p" ++ continue ++ fi ++ redo-ifchange "$p" ++ test -d "$p" || continue ++ d="$p/dbus-1/system-services" ++ if ! test -e "$d" ++ then ++ redo-ifcreate "$d" ++ continue ++ fi ++ redo-ifchange "$d" ++ test -d "$d" || continue ++ ++ find "$d/" -maxdepth 1 -name '*.service' -type f -print | ++ while read -r i ++ do ++ basename "${i}" .service ++ done ++done | ++awk '!x[$0]++' | ++while read -r i ++do ++ test \! -d "${sr}/$i/" || continue ++ case "${i}" in ++ org.freedesktop.systemd[0-9]*) continue ;; # blacklisted ++ org.freedesktop.network[0-9]*) continue ;; # blacklisted ++ org.freedesktop.resolve[0-9]*) continue ;; # blacklisted ++ esac ++ redo-ifchange -- "dbus/$i.service" ++ printf "dbus/%s\n" "$i" >> "$3" ++ if test -L "${lr}/$i" ++ then ++ redo-ifchange -- "${lr}/$i" ++ continue ++ fi ++ system-control convert-systemd-units $e "${lr}/" "./dbus/$i.service" ++ install -d -m 0755 -- "${lr}/$i/service/env" ++ link_service_to_logger_service "$i" "../../sv/cyclog@dbus" ++ system-control preset "$i.service" ++ allow_dbus_bus_activation "${lr}/$i" ++ printf "/var/local/sv/%s\n" "$i" >> "$3" ++done ++ ++# Make .service source files for all per-user Desktop Bus service definitions. ++# Per-user configuration import deals with making the actual service bundles. ++for p in /usr/local/share /usr/share /share ++do ++ if ! test -e "$p" ++ then ++ redo-ifcreate "$p" ++ continue ++ fi ++ redo-ifchange "$p" ++ test -d "$p" || continue ++ d="$p/dbus-1/services" ++ if ! test -e "$d" ++ then ++ redo-ifcreate "$d" ++ continue ++ fi ++ redo-ifchange "$d" ++ test -d "$d" || continue ++ ++ find "$d/" -maxdepth 1 -name '*.service' -type f -print | ++ while read -r i ++ do ++ basename "${i}" ++ done ++done | ++awk '!x[$0]++' | ++while read -r i ++do ++ printf "per-user/dbus/%s\n" "$i" ++ printf "per-user/dbus/%s\n" "$i" >> "$3" ++done | ++xargs -r -- redo-ifchange -- +diff --git a/source/convert/java-home.do b/source/convert/java-home.do +index 2acaff7..c47eff1 100755 +--- a/source/convert/java-home.do ++++ b/source/convert/java-home.do +@@ -9,7 +9,7 @@ + # + + # These get us *only* the configuration variables, safely. +-read_rc() { clearenv read-conf rc.conf "`which printenv`" "$1" ; } ++read_rc() { clearenv read-conf rc.conf printenv "$1" ; } + + redo-ifchange rc.conf general-services + +@@ -201,23 +201,34 @@ default_home() { + + list_jvms | nl -p >> "$3" + +-l="/usr/local/etc/system-control/local-java-services" +-if ! test -e "${l}" ++if ! test -d /usr/local/etc + then +- cat >>"${l}" <<-EOT +- # Local services that need JAVA_HOME configured by external configuration import. +- # +- # Lines are of the form: +- # default_home service-name +- # specific_home service-name version-list type-list manufacturer-list +- # +- # Empty lists match everything. +- # versions are 1.6, 1.7, 1.8, and so on. +- # types are native and foreign. +- # manufacturers are openjdk, gnu, sun, and oracle. +- +- EOT +-fi ++ redo-ifcreate /usr/local/etc ++elif ! test -d /usr/local/etc/system-control ++then ++ redo-ifchange /usr/local/etc ++ redo-ifcreate /usr/local/etc/system-control ++else ++ redo-ifchange /usr/local/etc /usr/local/etc/system-control ++ ++ l="/usr/local/etc/system-control/local-java-services" ++ if ! test -e "${l}" ++ then ++ cat >>"${l}" <<-EOT ++ # Local services that need JAVA_HOME configured by external configuration import. ++ # ++ # Lines are of the form: ++ # default_home service-name ++ # specific_home service-name version-list type-list manufacturer-list ++ # ++ # Empty lists match everything. ++ # versions are 1.6, 1.7, 1.8, and so on. ++ # types are native and foreign. ++ # manufacturers are openjdk, gnu, sun, and oracle. ++ ++ EOT ++ fi + +-redo-ifchange "${l}" +-. "${l}" >> "$3" ++ redo-ifchange "${l}" ++ . "${l}" >> "$3" ++fi +diff --git a/source/convert/per-user/at-spi-dbus-bus.service.do b/source/convert/per-user/at-spi-dbus-bus.service.do +index dc1ad31..46e18ee 100755 +--- a/source/convert/per-user/at-spi-dbus-bus.service.do ++++ b/source/convert/per-user/at-spi-dbus-bus.service.do +@@ -3,17 +3,19 @@ + ## For copyright and licensing terms, see the file named COPYING. + ## ************************************************************************** + # vim:set filetype=sh: ++# ++# This is run at binary package compile time to decide which service source file to use. ++ + case "`uname`" in + Linux) +- redo-ifchange /etc/os-release +- # These get us *only* the operating system variables, safely. +- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=arch-linux ;; + debian:*) ext=debian-linux ;; + centos:*) ext=redhat-linux ;; + rhel:*) ext=redhat-linux ;; ++ gentoo:*) ext=redhat-linux ;; + *) ext=who ;; + esac + ;; +diff --git a/source/convert/per-user/gconfd.service.do b/source/convert/per-user/gconfd.service.do +index dc1ad31..46e18ee 100755 +--- a/source/convert/per-user/gconfd.service.do ++++ b/source/convert/per-user/gconfd.service.do +@@ -3,17 +3,19 @@ + ## For copyright and licensing terms, see the file named COPYING. + ## ************************************************************************** + # vim:set filetype=sh: ++# ++# This is run at binary package compile time to decide which service source file to use. ++ + case "`uname`" in + Linux) +- redo-ifchange /etc/os-release +- # These get us *only* the operating system variables, safely. +- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=arch-linux ;; + debian:*) ext=debian-linux ;; + centos:*) ext=redhat-linux ;; + rhel:*) ext=redhat-linux ;; ++ gentoo:*) ext=redhat-linux ;; + *) ext=who ;; + esac + ;; +diff --git a/source/convert/per-user/per-user.conf.do b/source/convert/per-user/per-user.conf.do +index 806e245..b2a70f6 100755 +--- a/source/convert/per-user/per-user.conf.do ++++ b/source/convert/per-user/per-user.conf.do +@@ -3,16 +3,18 @@ + ## For copyright and licensing terms, see the file named COPYING. + ## ************************************************************************** + # vim:set filetype=sh: ++# ++# This is run at binary package compile time to decide which service source file to use. ++ + case "`uname`" in + Linux) +- redo-ifchange /etc/os-release +- # These get us *only* the operating system variables, safely. +- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=linux ;; + debian:[78]) ext=debian7-linux ;; + debian:*) ext=linux ;; ++ gentoo:*) ext=linux ;; + centos:*) ext=linux ;; + rhel:*) ext=linux ;; + *) ext=who ;; +diff --git a/source/convert/per-user/services.do b/source/convert/per-user/services.do +index db82062..fda31c7 100755 +--- a/source/convert/per-user/services.do ++++ b/source/convert/per-user/services.do +@@ -4,6 +4,10 @@ + ## ************************************************************************** + # vim:set filetype=sh: + # ++# This prototype is copied into every (real) user's system-control/convert directory. ++# ++# This is run by the per-user external configuration import subsystem. ++# It is used to compile all of the service bundles from source. + + eu="--etc-bundle --user" + e="--no-systemd-quirks --escape-instance --bundle-root" +@@ -24,7 +28,27 @@ redo_ifchange_follow() { + done + } + +-user_simple_alias() { ++make_raw_service_bundle() { ++ system-control convert-systemd-units $eu $e "$hs/" "./$1$2" ++ install -d -m 0755 -- "$hs/$1/service/env" ++} ++ ++link_logger_service_to_log_directory() { ++ rm -f -- "$hs/$2/main" ++ ln -s -- "/var/log/user/$i/$1" "$hs/$2/main" ++} ++ ++make_target_aliases() { ++ local t="$1" ++ shift ++ for s ++ do ++ rm -f -- "$ht/$s" ++ ln -s -- "$t" "$ht/$s" ++ done ++} ++ ++make_service_aliases() { + local t="$1" + shift + for s +@@ -34,7 +58,7 @@ user_simple_alias() { + done + } + +-user_dbus_definition() { ++make_local_dbus_user_service_definitions() { + for s + do + if ! test -e "$hd/dbus-1/services/$s.service" +@@ -45,15 +69,10 @@ user_dbus_definition() { + done + } + +-user_dbus_alias() { +- local t="$1" ++make_service_bundle_aliases_and_local_dbus_user_service_definitions() { ++ make_service_aliases "$@" + shift +- for s +- do +- rm -f -- "$hs/$s" +- ln -s -- "$t" "$hs/$s" +- done +- user_dbus_definition "$@" ++ make_local_dbus_user_service_definitions "$@" + } + + user_display() { +@@ -63,15 +82,11 @@ user_display() { + fi + } + +-user_dbus() { +- if ! test -e "$hs/$1/service/env/DBUS_SESSION_BUS_ADDRESS" +- then +-# system-control set-service-env "$hs/$1" DBUS_SESSION_BUS_ADDRESS "unix:runtime=yes" +- system-control set-service-env "$hs/$1" DBUS_SESSION_BUS_ADDRESS "unix:path=/run/user/$i/bus" +- fi ++allow_dbus_bus_activation() { ++ rm -f -- "$1/service/down" + } + +-user_link_to_log() { ++link_service_to_logger_service() { + rm -f -- "$hs/$1/log" + ln -s -- "../$2" "$hs/$1/log" + rm -f -- "$hs/$1/wants/log" "$hs/$1/after/log" +@@ -79,105 +94,88 @@ user_link_to_log() { + ln -s -- "../log" "$hs/$1/after/log" + } + +-user_socket_dbus_service() { +- redo_ifchange_follow "$1.socket" "$1.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.socket" +- install -d -m 0755 -- "$hs/$1/service/env" +- user_link_to_log "$1" "dbus-servers-log" +- userenv system-control --user preset "$1.socket" +-} +- + user_simple_dbus_service() { + redo_ifchange_follow "$1.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.service" +- install -d -m 0755 -- "$hs/$1/service/env" +- user_link_to_log "$1" "dbus-servers-log" +- user_dbus "$1" +- user_dbus_alias "$@" +- userenv system-control --user preset "$1.service" ++ make_raw_service_bundle "$1" ".service" ++ link_service_to_logger_service "$1" "dbus-servers-log" ++ make_service_bundle_aliases_and_local_dbus_user_service_definitions "$@" ++ system-control --user preset "$1.service" ++ allow_dbus_bus_activation "${hs}/$1" + } + + user_simple_dbus_service_with_dedicated_logger() { + redo_ifchange_follow "$1.service" "cyclog@.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.service" +- install -d -m 0755 -- "$hs/$1/service/env" +- system-control convert-systemd-units $eu $e "$hs/" "./cyclog@$1.service" +- install -d -m 0755 -- "$hs/cyclog@$1/service/env" +- rm -f -- "$hs/cyclog@$1/main" +- ln -s -- "/var/log/user/$i/$1" "$hs/cyclog@$1/main" +- user_link_to_log "$1" "cyclog@$1" +- user_dbus "$1" +- user_dbus_alias "$@" +- userenv system-control --user preset "$1.service" +- userenv system-control --user preset --prefix "cyclog@" "$1.service" ++ make_raw_service_bundle "$1" ".service" ++ make_raw_service_bundle "cyclog@$1" ".service" ++ link_logger_service_to_log_directory "$1" "cyclog@$1" ++ link_service_to_logger_service "$1" "cyclog@$1" ++ make_service_bundle_aliases_and_local_dbus_user_service_definitions "$@" ++ system-control --user preset "$1.service" ++ system-control --user preset --prefix "cyclog@" "$1.service" ++ allow_dbus_bus_activation "${hs}/$1" + } + + user_socket_dbus_service_with_dedicated_logger() { + redo_ifchange_follow "$1.socket" "$1.service" "cyclog@.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.socket" +- install -d -m 0755 -- "$hs/$1/service/env" +- system-control convert-systemd-units $eu $e "$hs/" "./cyclog@$1.service" +- install -d -m 0755 -- "$hs/cyclog@$1/service/env" +- rm -f -- "$hs/cyclog@$1/main" +- ln -s -- "/var/log/user/$i/$1" "$hs/cyclog@$1/main" +- user_link_to_log "$1" "cyclog@$1" +- user_dbus "$1" +- user_dbus_alias "$@" +- userenv system-control --user preset "$1.socket" +- userenv system-control --user preset --prefix "cyclog@" "$1.service" ++ make_raw_service_bundle "$1" ".socket" ++ make_raw_service_bundle "cyclog@$1" ".service" ++ link_logger_service_to_log_directory "$1" "cyclog@$1" ++ link_service_to_logger_service "$1" "cyclog@$1" ++ make_service_bundle_aliases_and_local_dbus_user_service_definitions "$@" ++ system-control --user preset "$1.socket" ++ system-control --user preset --prefix "cyclog@" "$1.service" ++ allow_dbus_bus_activation "${hs}/$1" + } + + user_simple_service() { + redo_ifchange_follow "$1.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.service" +- install -d -m 0755 -- "$hs/$1/service/env" +- user_link_to_log "$1" "simple-servers-log" +- user_simple_alias "$@" +- userenv system-control --user preset "$1.service" ++ make_raw_service_bundle "$1" ".service" ++ link_service_to_logger_service "$1" "simple-servers-log" ++ make_service_aliases "$@" ++ system-control --user preset "$1.service" + } + + user_simple_socket() { + redo_ifchange_follow "$1.socket" "$1.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.socket" +- install -d -m 0755 -- "$hs/$1/service/env" +- user_link_to_log "$1" "socket-servers-log" +- user_simple_alias "$@" +- userenv system-control --user preset "$1.socket" ++ make_raw_service_bundle "$1" ".socket" ++ link_service_to_logger_service "$1" "socket-servers-log" ++ make_service_aliases "$@" ++ system-control --user preset "$1.socket" ++} ++ ++user_dbus_socket() { ++ redo_ifchange_follow "$1.socket" "$1.service" ++ make_raw_service_bundle "$1" ".socket" ++ link_service_to_logger_service "$1" "dbus-servers-log" ++ system-control --user preset "$1.socket" + } + + user_socket_with_dedicated_logger() { + redo_ifchange_follow "$1.socket" "$1.service" "cyclog@.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.socket" +- install -d -m 0755 -- "$hs/$1/service/env" +- system-control convert-systemd-units $eu $e "$hs/" "./cyclog@$1.service" +- install -d -m 0755 -- "$hs/cyclog@$1/service/env" +- rm -f -- "$hs/cyclog@$1/main" +- ln -s -- "/var/log/user/$i/$1" "$hs/cyclog@$1/main" +- user_link_to_log "$1" "cyclog@$1" +- userenv system-control --user preset "$1.socket" +- userenv system-control --user preset --prefix "cyclog@" "$1.service" ++ make_raw_service_bundle "$1" ".socket" ++ make_raw_service_bundle "cyclog@$1" ".service" ++ link_logger_service_to_log_directory "$1" "cyclog@$1" ++ link_service_to_logger_service "$1" "cyclog@$1" ++ system-control --user preset "$1.socket" ++ system-control --user preset --prefix "cyclog@" "$1.service" + } + + user_service_with_dedicated_logger() { + redo_ifchange_follow "$1.service" "cyclog@.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1.service" +- install -d -m 0755 -- "$hs/$1/service/env" +- system-control convert-systemd-units $eu $e "$hs/" "./cyclog@$1.service" +- install -d -m 0755 -- "$hs/cyclog@$1/service/env" +- rm -f -- "$hs/cyclog@$1/main" +- ln -s -- "/var/log/user/$i/$1" "$hs/cyclog@$1/main" +- user_link_to_log "$1" "cyclog@$1" +- userenv system-control --user preset "$1.service" +- userenv system-control --user preset --prefix "cyclog@" "$1.service" ++ make_raw_service_bundle "$1" ".service" ++ make_raw_service_bundle "cyclog@$1" ".service" ++ link_logger_service_to_log_directory "$1" "cyclog@$1" ++ link_service_to_logger_service "$1" "cyclog@$1" ++ make_service_aliases "$@" ++ system-control --user preset "$1.service" ++ system-control --user preset --prefix "cyclog@" "$1.service" + } + + user_fan_in_logger() { + redo_ifchange_follow "$1-log.service" +- system-control convert-systemd-units $eu $e "$hs/" "./$1-log.service" +- install -d -m 0755 -- "$hs/$1-log/service/env" +- rm -f -- "$hs/$1-log/main" +- ln -s -- "/var/log/user/$i/$1" "$hs/$1-log/main" +- userenv system-control --user preset "$1-log.service" ++ make_raw_service_bundle "$1-log" ".service" ++ link_logger_service_to_log_directory "$1" "$1-log" ++ system-control --user preset "$1-log.service" + } + + user_target() { +@@ -201,7 +199,7 @@ relocate_user_service() { + fi + } + +-user_log() { ++make_user_log_directories() { + for d + do + install -d -m 0750 "/var/log/user/$i/$d" +@@ -227,8 +225,6 @@ then + exec false + fi + +-setfacl -m "u:$i:rwx" "/var/log/user/$i/dbus" || setfacl -m "user:$i:rwxpD::allow" "/var/log/user/$i/dbus" || : +- + hd="$h/.local/share" + hh="$h/.cache" + hc="$h/.config" +@@ -243,51 +239,44 @@ install -d -m 0755 -- "$hs" + install -d -m 0755 -- "$hc/service-bundles/common" + install -d -m 0755 -- "$hc/service-bundles/common/env" + +-for t in halt reboot poweroff +-do +- rm -f -- "$ht/$t" +- ln -s -- "exit" "$ht/$t" +-done ++# system-wide external configuration import has already made the exit service bundle for us. ++make_target_aliases "exit" halt reboot poweroff + + install -d -m 0755 -- "$hd/dbus-1" + install -d -m 0755 -- "$hd/dbus-1/services" + ++# startup used to be called intrat. + test -d "$ht/startup" || test \! -d "$ht/intrat" || mv -f -- "$ht/intrat" "$ht/startup" + + user_target "intrat" +-for t in sysinit basic +-do +- rm -f -- "$ht/$t" +- ln -s -- "intrat" "$ht/$t" +-done ++make_target_aliases "intrat" sysinit basic + + user_target "startup" +-for t in normal multi-user emergency rescue workstation server +-do +- rm -f -- "$ht/$t" +- ln -s -- "startup" "$ht/$t" +-done ++make_target_aliases "startup" normal multi-user emergency rescue workstation server + + user_target "shutdown" + user_target "sockets" + +-user_log "dbus-servers" "socket-servers" "simple-servers" ++make_user_log_directories "dbus-servers" "socket-servers" "simple-servers" + user_fan_in_logger "dbus-servers" + user_fan_in_logger "socket-servers" + user_fan_in_logger "simple-servers" +-userenv system-control --user enable "dbus-servers-log" +-userenv system-control --user enable "socket-servers-log" +-userenv system-control --user enable "simple-servers-log" ++system-control --user enable "dbus-servers-log" ++system-control --user enable "socket-servers-log" ++system-control --user enable "simple-servers-log" + + relocate_user_service "dbus" "dbus-daemon" + test -h "$hs/dbus" || ln -s "dbus-daemon" "$hs/dbus" + relocate_user_log "dbus" "dbus-daemon" + test -h "/var/log/user/$i/dbus" || ln -s "dbus-daemon" "/var/log/user/$i/dbus" + +-user_socket_dbus_service "dbus-daemon" ++user_dbus_socket "dbus-daemon" + redo_ifchange_follow "per-user.conf" + test -r "$hs/dbus-daemon/service/per-user.conf" || install -m 0644 -- "per-user.conf" "$hs/dbus/service/per-user.conf" + ++relocate_user_service "org.gnome.Weather.Application" "gnome-weather-application" ++relocate_user_service "org.gnome.Maps" "gnome-maps" ++ + user_simple_dbus_service "at-spi-dbus-bus" "org.a11y.Bus" + user_simple_dbus_service "clock-applet" "org.mate.panel.applet.ClockAppletFactory" + user_simple_dbus_service "dconf-editor" "ca.desrt.dconf-editor" +@@ -299,9 +288,11 @@ user_simple_dbus_service "evolution-source-registry" "org.gnome.evolution.datase + user_simple_dbus_service "gconfd" "org.gnome.GConf" + user_simple_dbus_service "gedit" "org.gnome.gedit" + user_simple_dbus_service "gnome-keyring-daemon" "org.gnome.keyring" "org.freedesktop.secrets" ++user_simple_dbus_service "gnome-maps" "org.gnome.Maps" + user_simple_dbus_service "gnome-settings-daemon" "org.gnome.SettingsDaemon.XSettings" + user_simple_dbus_service "gnome-shell" "org.gnome.Shell" + user_simple_dbus_service "gnome-terminal-server" "org.gnome.Terminal" ++user_simple_dbus_service "gnome-weather-application" "org.gnome.Weather.Application" + user_simple_dbus_service "goa-daemon" "org.gnome.OnlineAccounts" + user_simple_dbus_service "goa-identity-service" "org.gnome.Identity" + user_simple_dbus_service "gvfs-afc-volume-monitor" "org.gtk.Private.AfcVolumeMonitor" "org.gtk.vfs.AfcVolumeMonitor" +@@ -320,8 +311,6 @@ user_simple_dbus_service "mate-notification-daemon" "org.freedesktop.mate.Notifi + user_simple_dbus_service "mate-screensaver" "org.mate.ScreenSaver" + user_simple_dbus_service "notification-area-applet" "org.mate.panel.applet.NotificationAreaAppletFactory" + user_simple_dbus_service "obex" "org.bluez.obex" "dbus-org.bluez.obex" +-user_simple_dbus_service "org.gnome.Maps" +-user_simple_dbus_service "org.gnome.Weather.Application" + user_simple_dbus_service "telepathy-mission-control-5" "org.freedesktop.Telepathy.AccountManager" + user_simple_dbus_service "wnck-applet" "org.mate.panel.applet.WnckletFactory" + user_simple_dbus_service "xdg-desktop-portal-gtk" "org.freedesktop.implo.portal.desktop.gtk" +@@ -362,24 +351,33 @@ do + printf "dbus/%s\n" "$i" >> "$3" + done + +-user_dbus_definition "org.gnome.Maps" +-user_dbus_definition "org.gnome.Weather.Application" +-userenv system-control --user preset "zeitgeist-fts" +- +-user_display "org.gnome.Weather.Application" # The fact that the GNOME Weather server requires an X display at startup is a bug. +-user_display "org.gnome.Maps" # The fact that the GNOME Maps server requires an X display at startup is a bug. ++system-control --user preset "zeitgeist-fts" + + test -e "$hc/service-bundles/common/env/DISPLAY" || system-control set-service-env "$hc/service-bundles/common" DISPLAY ":0" ++# We do not need to set a common DBUS_SESSION_BUS_ADDRESS because userenv in the service definitions will do that for us. + + user_simple_socket "dirmngr" + user_simple_socket "gpg-agent" + user_simple_socket "urxvt" "urxvtd" ++user_simple_socket "watchman" + + user_simple_service "emacs" + user_simple_service "gam_server" + user_simple_service "speech-dispatcher" + +-user_log "mpd" ++make_user_log_directories "uscheduled" ++user_socket_with_dedicated_logger "uscheduled" "uschedule" ++if test -d "$h/.uschedule" && ++ test ! -e "$hc/uschedule" ++then ++ mv -f -- "$h/.uschedule" "$hc/uschedule" ++else ++ install -d -m 0700 -- "$hc/uschedule" ++fi ++test -e "$h/.uschedule" || ln -s -- ".config/uschedule" "$h/.uschedule" ++install -d -m 0700 -- "$hc/uschedule/commands" ++ ++make_user_log_directories "mpd" + user_socket_with_dedicated_logger "mpd" + redo_ifchange_follow "mpd.conf" + test -r "$hs/mpd/service/mpd.conf" || install -m 0644 -- "mpd.conf" "$hs/mpd/service/mpd.conf" +@@ -391,9 +389,5 @@ test -r "$hd/mpd/database" || install -m 0755 -- /dev/null "$hd/mpd/database" + install -d -m 0755 -- "$hh/mpd" + test -r "$hh/mpd/state" || install -m 0755 -- /dev/null "$hh/mpd/state" + +-user_log "pulseaudio" ++make_user_log_directories "pulseaudio" + user_socket_dbus_service_with_dedicated_logger "pulseaudio" "org.pulseaudio.Server" +- +-install -m 0444 -- /dev/null "$hc/service-bundles/do-not-generate" +- +-redo_ifchange_follow "$hc/service-bundles" +diff --git a/source/convert/rc.conf.do b/source/convert/rc.conf.do +index 88f6806..f64db9f 100755 +--- a/source/convert/rc.conf.do ++++ b/source/convert/rc.conf.do +@@ -10,8 +10,8 @@ freenas_db="/data/freenas-v1.db" + default_rc="/etc/defaults/rc.conf" + + # This gets us *only* the variables, safely. +-read_variable() { clearenv read-conf "$1" "`which printenv`" "$2" ; } +-read_optional_variable() { read_variable "$1" "$2" || echo "$3" ; } ++read_variable() { clearenv read-conf "$1" printenv "$2" ; } ++read_optional_variable() { clearenv setenv "$2" "$3" read-conf "$1" printenv "$2" ; } + + case "`uname`" in + Linux) extended_regexp="-r" ;; +@@ -530,7 +530,8 @@ convert_linux() { + local m + local os_version + +- os_version="`read_variable \"$1\" ID`:`read_optional_variable \"$1\" VERSION_ID '*'`" ++ os_version="`read_optional_variable \"$1\" ID linux`:`read_optional_variable \"$1\" VERSION_ID '*'`" ++ printf "os_version=\"%s\"\n" "${os_version}" + + ##### + # Stuff that can be overriden by explicit lines in rc.conf comes first. +diff --git a/source/convert/user-services.do b/source/convert/user-services.do +index 4a35ffb..d89e27c 100755 +--- a/source/convert/user-services.do ++++ b/source/convert/user-services.do +@@ -8,27 +8,38 @@ + # This is invoked by all.do . + # + +-redo-ifchange /etc/passwd "user-dbus-daemon@.socket" "user-dbus-daemon.service" "user-dbus-broker@.socket" "user-dbus-broker.service" "user-dbus-log@.service" "user-services.service" "user-services@.socket" "user-runtime@.service" "run-user-directory@.service" "user@.target" "per-user/exit.target" "per-user/per-user.conf" +- + lr="/var/local/sv/" + sr="/etc/service-bundles/services/" + tr="/etc/service-bundles/targets/" + eu="--etc-bundle --user" + e="--no-systemd-quirks --escape-instance --bundle-root" + +-redo-ifchange /etc/passwd ++case "`uname`" in ++FreeBSD) ++ if test -r /etc/spwd.db ++ then ++ redo-ifchange /etc/spwd.db ++ else ++ redo-ifchange /etc/pwd.db ++ fi ++ ;; ++Linux|*) redo-ifchange /etc/passwd ;; ++esac ++ ++redo-ifchange "user-dbus-daemon@.socket" "user-dbus-daemon.service" "user-dbus-broker@.socket" "user-dbus-broker.service" "user-dbus-log@.service" "user-services.service" "user-services@.socket" "user-runtime@.service" "run-user-directory@.service" "user@.target" "per-user/exit.target" "per-user/per-user.conf" "per-user/all.do" "per-user/default.do" "per-user/home.do" "per-user/user.do" "per-user/config-path.do" "per-user/services.do" ++ + getent passwd | + awk -F : '{ if (!match($7,"/nologin$")) print $1; }' | + while read -r i + do +- # On systems that don't set nologin/false as the shell, there is nothing distinguishing "system" accounts from accounts that temporarily have their password disabled. ++ # On systems that don't set nologin as the shell, there is nothing distinguishing "system" accounts from accounts that temporarily have their password disabled. + # As the manual page says, an account with a temporarily disabled password could still be used via SSH, and obviously one might want user Desktop Bus service for such a login. + case "$i" in +- bin|daemon|games|irc|mail|news|nobody|root|sync|sys|uucp|www-data|libuuid|backup|lp|saned|man|proxy|backup|list|gnats) continue ;; ++ bin|daemon|nobody|root|toor|sync|sys|games|irc|mail|news|uucp|www-data|libuuid|backup|lp|saned|man|proxy|backup|list|gnats) continue ;; + alias|qmail[dlpqrs]|publicfile) continue ;; +- avahi|colord|dnsmasq|geoclue|lightdm|messagebus|sddm|systemd-*|uuidd) continue ;; ++ avahi|colord|dnsmasq|geoclue|lightdm|messagebus|sddm|systemd-*|uuidd|cron) continue ;; + rtkit|*\\*) continue ;; +- toor) continue ;; ++ *-log) continue ;; + esac + + h="`getent passwd \"$i\" | awk -F : '{print $6;}'`" +@@ -48,6 +59,24 @@ do + done + + test -n "$h" || continue ++ ++ # We don't want to be setting up things in certain directories, regardless of the account name. ++ case "$h" in ++ # Apparently some people have not received the wisdom of the 1990s, which moved the superuser's home to /root, and still make / a home directory for some users. ++ /) ++ printf "WARNING: Dangerous home directory %s for account %s\n" "$h" "$i" 1>&2 ++ printf "WARNING: Dangerous home directory %s for account %s\n" "$h" "$i" >> "$3" ++ continue ++ ;; ++ # Most of these will be caught by the preceding well-known account names test; but better safe than sorry. ++ # Allow subdirectories of /run, but not /run itself. ++ /run|/dev|/dev/*|/proc|/proc/*|/sys|/sys/*|/bin|/sbin|/usr/bin|/usr/sbin|/usr/local/bin|/usr/local/sbin|/rescue|/rescue/*|/boot|/boot/*|/root|/root/*) ++ printf "WARNING: Dangerous home directory %s for account %s\n" "$h" "$i" 1>&2 ++ printf "WARNING: Dangerous home directory %s for account %s\n" "$h" "$i" >> "$3" ++ continue ++ ;; ++ esac ++ + test -d "$h/" || continue + + echo "per-user@$i: $h" >> "$3" +@@ -65,6 +94,7 @@ do + echo "user-dbus-log@$i" >> "$3" + rm -f -- "$lr/user-dbus-log@$i/main" + ln -s -- "/var/log/user/$i/dbus" "$lr/user-dbus-log@$i/main" ++# setfacl -m "u:$i:rwx" "/var/log/user/$i/dbus" || setfacl -m "user:$i:rwxpD::allow" "/var/log/user/$i/dbus" || : + + # This is a system-level service that is disabled in favour of the user-level dbus service. + system-control convert-systemd-units $e "$lr/" "./user-dbus-daemon@$i.socket" +@@ -110,53 +140,27 @@ do + # ln -s -- "../user-log@$i" "$lr/run-user-directory@$i/log" + + ht="$h/.config/service-bundles/targets" +- install -d -o "$i" -m 0755 -- "$ht" +- hv="$h/.config/service-bundles/convert" +- install -d -o "$i" -m 0755 -- "$hv" ++ setuidgid "$i" install -d -o "$i" -m 0755 -- "$ht" + + # Yes, this service bundle is root-owned; we don't want users messing it up. + system-control convert-systemd-units $eu $e "$ht/" "./per-user/exit.target" + install -d -o "$i" -m 0755 "$ht/exit/supervise" + echo "per-user@$i/exit" >> "$3" + ++ setuidgid "$i" install -d -o "$i" -m 0755 -- "$h/.config/system-control" ++ ++ hv="$h/.config/system-control/convert" ++ if test ! -d "${hv}" && test -d "$h/.config/service-bundles/convert" ++ then ++ mv -- "$h/.config/service-bundles/convert" "${hv}" ++ ln -s -- "../system-control/convert" "$h/.config/service-bundles/" ++ fi ++ setuidgid "$i" install -d -o "$i" -m 0755 -- "$hv" + for s in all default home config-path user services + do + test -e "${hv}/${s}.do" || + setuidgid "$i" ln -f "per-user/${s}.do" "${hv}/" 2>/dev/null || +- install -o "$i" -m 0755 "per-user/${s}.do" "${hv}/" ++ setuidgid "$i" install -o "$i" -m 0755 "per-user/${s}.do" "${hv}/" + done +- redo-ifchange "${hv}" + echo "per-user@$i" >> "$3" + done +- +-for p in /usr/local/share /usr/share /share +-do +- if ! test -e "$p" +- then +- redo-ifcreate "$p" +- continue +- fi +- redo-ifchange "$p" +- test -d "$p" || continue +- d="$p/dbus-1/services" +- if ! test -e "$d" +- then +- redo-ifcreate "$d" +- continue +- fi +- redo-ifchange "$d" +- test -d "$d" || continue +- +- find "$d/" -maxdepth 1 -name '*.service' -type f -print | +- while read -r i +- do +- basename "${i}" +- done +-done | +-awk '!x[$0]++' | +-while read -r i +-do +- printf "per-user/dbus/%s\n" "$i" +- printf "per-user/dbus/%s\n" "$i" >> "$3" +-done | +-xargs -- redo-ifchange -- +diff --git a/source/services/dbus-broker.service.do b/source/services/dbus-broker.service.do +index 2f2eda6..e4fbcc8 100755 +--- a/source/services/dbus-broker.service.do ++++ b/source/services/dbus-broker.service.do +@@ -5,15 +5,14 @@ + # vim: set filetype=sh: + case "`uname`" in + Linux) +- redo-ifchange /etc/os-release exec +- # These get us *only* the operating system variables, safely. +- read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=redhat-linux ;; + debian:*) ext=debian-linux ;; + centos:*) ext=redhat-linux ;; + rhel:*) ext=redhat-linux ;; ++ gentoo:*) ext=debian-linux ;; + *) ext=who ;; + esac + ;; +diff --git a/source/services/dbus-daemon.service.do b/source/services/dbus-daemon.service.do +index 2f2eda6..f041915 100755 +--- a/source/services/dbus-daemon.service.do ++++ b/source/services/dbus-daemon.service.do +@@ -5,13 +5,12 @@ + # vim: set filetype=sh: + case "`uname`" in + Linux) +- redo-ifchange /etc/os-release exec +- # These get us *only* the operating system variables, safely. +- read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=redhat-linux ;; + debian:*) ext=debian-linux ;; ++ gentoo:*) ext=debian-linux ;; + centos:*) ext=redhat-linux ;; + rhel:*) ext=redhat-linux ;; + *) ext=who ;; +diff --git a/source/services/exim4-smtp-relay@.service.do b/source/services/exim4-smtp-relay@.service.do +new file mode 100755 +index 0000000..f041915 +--- /dev/null ++++ b/source/services/exim4-smtp-relay@.service.do +@@ -0,0 +1,23 @@ ++#!/bin/sh -e ++## ************************************************************************** ++## For copyright and licensing terms, see the file named COPYING. ++## ************************************************************************** ++# vim: set filetype=sh: ++case "`uname`" in ++Linux) ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in ++ arch:*) ext=redhat-linux ;; ++ debian:*) ext=debian-linux ;; ++ gentoo:*) ext=debian-linux ;; ++ centos:*) ext=redhat-linux ;; ++ rhel:*) ext=redhat-linux ;; ++ *) ext=who ;; ++ esac ++ ;; ++*BSD) ext=bsd ;; ++*) ext=who ;; ++esac ++redo-ifchange "$1.${ext}" ++ln -s -f "`basename \"$1\"`.${ext}" "$3" +diff --git a/source/services/exim4-smtp-submission@.service.do b/source/services/exim4-smtp-submission@.service.do +new file mode 100755 +index 0000000..f041915 +--- /dev/null ++++ b/source/services/exim4-smtp-submission@.service.do +@@ -0,0 +1,23 @@ ++#!/bin/sh -e ++## ************************************************************************** ++## For copyright and licensing terms, see the file named COPYING. ++## ************************************************************************** ++# vim: set filetype=sh: ++case "`uname`" in ++Linux) ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in ++ arch:*) ext=redhat-linux ;; ++ debian:*) ext=debian-linux ;; ++ gentoo:*) ext=debian-linux ;; ++ centos:*) ext=redhat-linux ;; ++ rhel:*) ext=redhat-linux ;; ++ *) ext=who ;; ++ esac ++ ;; ++*BSD) ext=bsd ;; ++*) ext=who ;; ++esac ++redo-ifchange "$1.${ext}" ++ln -s -f "`basename \"$1\"`.${ext}" "$3" +diff --git a/source/services/system-wide.conf.do b/source/services/system-wide.conf.do +index 1a787e0..3126c25 100755 +--- a/source/services/system-wide.conf.do ++++ b/source/services/system-wide.conf.do +@@ -5,16 +5,15 @@ + # vim: set filetype=sh: + case "`uname`" in + Linux) +- redo-ifchange exec /etc/os-release +- # These get us *only* the operating system variables, safely. +- read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } +- +- case "`read_os ID`:`read_os VERSION_ID`" in ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in + arch:*) ext=arch-linux ;; + debian:[78]) ext=debian7-linux ;; + debian:*) ext=linux ;; + centos:*) ext=linux ;; + rhel:*) ext=linux ;; ++ gentoo:*) ext=linux ;; + *) ext=who ;; + esac + ;; +diff --git a/source/systemd/system/service-manager.socket.do b/source/systemd/system/service-manager.socket.do +new file mode 100755 +index 0000000..e4fbcc8 +--- /dev/null ++++ b/source/systemd/system/service-manager.socket.do +@@ -0,0 +1,23 @@ ++#!/bin/sh -e ++## ************************************************************************** ++## For copyright and licensing terms, see the file named COPYING. ++## ************************************************************************** ++# vim: set filetype=sh: ++case "`uname`" in ++Linux) ++ redo-ifchange os_version ++ read -r os_version < os_version ++ case "${os_version}" in ++ arch:*) ext=redhat-linux ;; ++ debian:*) ext=debian-linux ;; ++ centos:*) ext=redhat-linux ;; ++ rhel:*) ext=redhat-linux ;; ++ gentoo:*) ext=debian-linux ;; ++ *) ext=who ;; ++ esac ++ ;; ++*BSD) ext=bsd ;; ++*) ext=who ;; ++esac ++redo-ifchange "$1.${ext}" ++ln -s -f "`basename \"$1\"`.${ext}" "$3" diff --git a/os_version.do b/os_version.do new file mode 100755 index 0000000..a924470 --- /dev/null +++ b/os_version.do @@ -0,0 +1,27 @@ +#!/bin/sh -e +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** +# vim:set filetype=sh: +# +# This is run at binary package compile time to decide which service source file to use. + +if test -r /etc/os-release +then + redo-ifchange exec /etc/os-release "`readlink -f /etc/os-release`" + # These get us *only* the operating system variables, safely. + read_os() { ./exec clearenv setenv "$1" "$2" read-conf /etc/os-release printenv "$1" ; } +elif test -r /usr/lib/os-release +then + redo-ifcreate /etc/os-release + redo-ifchange exec /usr/lib/os-release + # These get us *only* the operating system variables, safely. + read_os() { ./exec clearenv setenv "$1" "$2" read-conf /usr/lib/os-release printenv "$1" ; } +else + redo-ifcreate /etc/os-release + redo-ifcreate /usr/lib/os-release + # The os-release system has defined defaults. + read_os() { printf "%s\n" "$2" ; } +fi +printf "%s:%s\n" "`read_os ID linux`" "`read_os VERSION_ID`" > "$3" +exec true diff --git a/per-user-exec.patch b/per-user-exec.patch deleted file mode 100644 index 8220a19..0000000 --- a/per-user-exec.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/source/convert/per-user/at-spi-dbus-bus.service.do b/source/convert/per-user/at-spi-dbus-bus.service.do -index dc1ad31..de4100d 100755 ---- a/source/convert/per-user/at-spi-dbus-bus.service.do -+++ b/source/convert/per-user/at-spi-dbus-bus.service.do -@@ -5,9 +5,9 @@ - # vim:set filetype=sh: - case "`uname`" in - Linux) -- redo-ifchange /etc/os-release -+ redo-ifchange exec /etc/os-release - # These get us *only* the operating system variables, safely. -- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } -+ read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } - - case "`read_os ID`:`read_os VERSION_ID`" in - arch:*) ext=arch-linux ;; -diff --git a/source/convert/per-user/gconfd.service.do b/source/convert/per-user/gconfd.service.do -index dc1ad31..de4100d 100755 ---- a/source/convert/per-user/gconfd.service.do -+++ b/source/convert/per-user/gconfd.service.do -@@ -5,9 +5,9 @@ - # vim:set filetype=sh: - case "`uname`" in - Linux) -- redo-ifchange /etc/os-release -+ redo-ifchange exec /etc/os-release - # These get us *only* the operating system variables, safely. -- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } -+ read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } - - case "`read_os ID`:`read_os VERSION_ID`" in - arch:*) ext=arch-linux ;; -diff --git a/source/convert/per-user/per-user.conf.do b/source/convert/per-user/per-user.conf.do -index 806e245..736a57e 100755 ---- a/source/convert/per-user/per-user.conf.do -+++ b/source/convert/per-user/per-user.conf.do -@@ -5,9 +5,9 @@ - # vim:set filetype=sh: - case "`uname`" in - Linux) -- redo-ifchange /etc/os-release -+ redo-ifchange exec /etc/os-release - # These get us *only* the operating system variables, safely. -- read_os() { /bin/exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } -+ read_os() { ./exec clearenv read-conf /etc/os-release "`which printenv`" "$1" ; } - - case "`read_os ID`:`read_os VERSION_ID`" in - arch:*) ext=linux ;; diff --git a/uscheduled.service b/uscheduled.service new file mode 100644 index 0000000..51943cb --- /dev/null +++ b/uscheduled.service @@ -0,0 +1,14 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=Uwe Ohse's %p for %u + +[Service] +RuntimeDirectory=%p +RuntimeDirectoryMode=0700 +EnvironmentDirectory=env +ExecStart=%p + +[Install] diff --git a/uscheduled.socket b/uscheduled.socket new file mode 100644 index 0000000..e9a0115 --- /dev/null +++ b/uscheduled.socket @@ -0,0 +1,14 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=Control FIFO for Uwe Ohse's %p for %u + +[Socket] +SocketMode=0700 +ListenFIFO=%t/%p/trigger +Accept=false + +[Install] +WantedBy=normal.target diff --git a/watchman.service b/watchman.service new file mode 100644 index 0000000..adfd4b2 --- /dev/null +++ b/watchman.service @@ -0,0 +1,17 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=Facebook Watchman server for %u + +[Service] +LocalReaper=true +RuntimeDirectory=%p +RuntimeDirectoryMode=0700 +EnvironmentDirectory=env +ExecStart=%p --foreground --inetd +StandardInput=socket + +[Install] +WantedBy=normal.target diff --git a/watchman.socket b/watchman.socket new file mode 100644 index 0000000..21a7329 --- /dev/null +++ b/watchman.socket @@ -0,0 +1,12 @@ +## ************************************************************************** +## For copyright and licensing terms, see the file named COPYING. +## ************************************************************************** + +[Unit] +Description=Facebook Watchman daemon control socket for %u + +[Socket] +ListenStream=%t/%p/state/sock +SocketMode=0600 + +[Install] -- 2.11.4.GIT