From b503a455931ff595a92af7a6c1297213743b00fc Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 26 Jan 2012 19:49:36 +0100 Subject: [PATCH] xbps-triggers: update to 0.38 -- improved systemd-service trigger. - Always run 'systemd-tmpfiles --create' at post INSTALL time. - Informative messages showing what's enabled/stopped, etc. --- srcpkgs/xbps-triggers/files/systemd-service | 30 ++++++++++++++++++--- srcpkgs/xbps-triggers/template | 5 ++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/srcpkgs/xbps-triggers/files/systemd-service b/srcpkgs/xbps-triggers/files/systemd-service index fb2c9eff172..7456d08a105 100755 --- a/srcpkgs/xbps-triggers/files/systemd-service +++ b/srcpkgs/xbps-triggers/files/systemd-service @@ -31,7 +31,8 @@ run) [ ! -x bin/systemctl ] && exit 0 [ -z "${systemd_services}" ] && exit 1 - if [ -e sys/fs/cgroups/systemd ]; then + systemd-notify --booted + if [ $? -eq 0 ]; then systemd_booted=yes fi @@ -50,21 +51,41 @@ run) if [ "$UPDATE" = "no" ]; then # package is being removed. # disable and stop the unit. + echo "Disabling systemd service ${_srv}..." systemctl --no-reload disable ${_srv} >/dev/null 2>&1 || : + echo "Stopping systemd service ${_srv}..." systemctl stop ${_srv} >/dev/null 2>&1 || : fi elif [ "$TARGET" = "post-install" ]; then if [ "$UPDATE" = "no" ]; then # package is being installed. # enable (but don't start) the unit by default. + echo "Enabling systemd service ${_srv}..." systemctl enable ${_srv} >/dev/null 2>&1 || : - if [ "$systemd_booted" ]; then + if [ -n "$systemd_booted" ]; then # reload systemd if running. systemctl daemon-reload >/dev/null 2>&1 || : fi + cat <<_EOF +========================================================================== + +The service "${_srv}" has been enabled by default, +that means that it will be started in next boot. To start it immediately, +execute the following command (as root): + + $ systemctl start ${_srv} + +And to stop it: + + $ systemctl stop ${_srv} + +Refer to the systemd documentation if more information is required. + +========================================================================== +_EOF else # package is being updated. - if [ "$system_booted" ]; then + if [ -n "$system_booted" ]; then # reload systemd if running. systemctl daemon-reload >/dev/null 2>&1 || : fi @@ -75,6 +96,9 @@ run) echo "systemd ${_srv} service must be restarted manually!" fi fi + # Always create required tmpfiles in case a service + # needs any of them. + systemd-tmpfiles --create fi shift; shift done diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template index 8651c091370..2a03fef7dd1 100644 --- a/srcpkgs/xbps-triggers/template +++ b/srcpkgs/xbps-triggers/template @@ -1,6 +1,6 @@ # Template file for 'xbps-triggers' pkgname=xbps-triggers -version=0.37 +version=0.38 short_desc="XBPS triggers" maintainer="Juan RP " homepage="http://code.google.com/p/xbps" @@ -12,8 +12,7 @@ noarch=yes noextract=yes bootstrap=yes -do_install() -{ +do_install() { _triggersdir=var/db/xbps/triggers for f in ${FILESDIR}/*; do