From 69669521453d299ff2a3d02ab9ac00a247bd47e5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Sep 2013 15:05:07 +0200 Subject: [dbus] Create systemd service using a template instead of grabbing from running system Also remove the ugly hack that moves /lib/systemd to /etc/systemd; this would only help mixing systemd service files from the running system with our own -- trouble ahead! Warn if /lib/systemd exists in the target build dir. --- .../dbus/data/etc/systemd/system/dbus.socket | 5 +++++ remote/modules/dbus/dbus.build | 21 ++++++++++++++++++--- remote/modules/dbus/templates/dbus.service | 11 +++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 remote/modules/dbus/data/etc/systemd/system/dbus.socket create mode 100644 remote/modules/dbus/templates/dbus.service (limited to 'remote/modules') diff --git a/remote/modules/dbus/data/etc/systemd/system/dbus.socket b/remote/modules/dbus/data/etc/systemd/system/dbus.socket new file mode 100644 index 00000000..5c373cf4 --- /dev/null +++ b/remote/modules/dbus/data/etc/systemd/system/dbus.socket @@ -0,0 +1,5 @@ +[Unit] +Description=D-Bus System Message Bus Socket + +[Socket] +ListenStream=/run/dbus/system_bus_socket diff --git a/remote/modules/dbus/dbus.build b/remote/modules/dbus/dbus.build index bcab63b0..81c849fb 100644 --- a/remote/modules/dbus/dbus.build +++ b/remote/modules/dbus/dbus.build @@ -7,11 +7,26 @@ fetch_source() { build() { COPYLIST="list_dpkg_output" [ -e "${COPYLIST}" ] && rm "${COPYLIST}" - - list_packet_files >> "${COPYLIST}" + + list_packet_files >> "${COPYLIST}" tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}" - + + # Generate systemd files + mkdir "$MODULE_BUILD_DIR/etc/systemd/system" + local UUIDGEN=$(find "$MODULE_BUILD_DIR" -name dbus-uuidgen -executable | head -n 1) + local DAEMON=$(find "$MODULE_BUILD_DIR" -name dbus-daemon -executable | head -n 1) + local SEND=$(find "$MODULE_BUILD_DIR" -name dbus-send -executable | head -n 1) + UUIDGEN="${UUIDGEN#$MODULE_BUILD_DIR}" + DAEMON="${DAEMON#$MODULE_BUILD_DIR}" + SEND="${SEND#$MODULE_BUILD_DIR}" + [ -z "$UUIDGEN" ] && perror "Could not determine dbus-uuidgen location" + [ -z "$DAEMON" ] && perror "Could not determine dbus-daemon location" + [ -z "$SEND" ] && perror "Could not determine dbus-send location" + sed "s,%UUIDGEN%,/$UUIDGEN,g;s,%DAEMON%,$DAEMON,g;s,%SEND%,$SEND,g" "templates/dbus.service" \ + > "$MODULE_BUILD_DIR/etc/systemd/system/dbus.service" \ + || perror "Could not generate $MODULE_BUILD_DIR/etc/systemd/system/dbus.service" } post_copy() { : } + diff --git a/remote/modules/dbus/templates/dbus.service b/remote/modules/dbus/templates/dbus.service new file mode 100644 index 00000000..b6e05271 --- /dev/null +++ b/remote/modules/dbus/templates/dbus.service @@ -0,0 +1,11 @@ +[Unit] +Description=D-Bus System Message Bus +Requires=dbus.socket +After=syslog.target + +[Service] +ExecStartPre=%UUIDGEN% --ensure +ExecStartPre=-/bin/rm -f /run/dbus/pid +ExecStart=%DAEMON% --system --address=systemd: --nofork --activation=systemd +ExecReload=%SEND% --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig +OOMScoreAdjust=-900 -- cgit v1.2.3-55-g7522 From 27a36ead9a8dfa042d649211dcdc1666081eea89 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Sep 2013 15:09:33 +0200 Subject: [dbus] Fix mkdir, remove /lib/systemd from required directories --- remote/modules/dbus/dbus.build | 2 +- remote/modules/dbus/dbus.conf.opensuse | 5 +---- remote/modules/dbus/dbus.conf.ubuntu | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) (limited to 'remote/modules') diff --git a/remote/modules/dbus/dbus.build b/remote/modules/dbus/dbus.build index 81c849fb..beb557b4 100644 --- a/remote/modules/dbus/dbus.build +++ b/remote/modules/dbus/dbus.build @@ -12,7 +12,7 @@ build() { tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}" # Generate systemd files - mkdir "$MODULE_BUILD_DIR/etc/systemd/system" + mkdir -p "$MODULE_BUILD_DIR/etc/systemd/system" local UUIDGEN=$(find "$MODULE_BUILD_DIR" -name dbus-uuidgen -executable | head -n 1) local DAEMON=$(find "$MODULE_BUILD_DIR" -name dbus-daemon -executable | head -n 1) local SEND=$(find "$MODULE_BUILD_DIR" -name dbus-send -executable | head -n 1) diff --git a/remote/modules/dbus/dbus.conf.opensuse b/remote/modules/dbus/dbus.conf.opensuse index 93610f62..9bc514e2 100644 --- a/remote/modules/dbus/dbus.conf.opensuse +++ b/remote/modules/dbus/dbus.conf.opensuse @@ -1,7 +1,4 @@ REQUIRED_CONTENT_PACKAGES=" dbus-1 " -REQUIRED_DIRECTORIES+=" - /usr/lib/systemd -" -REQUIRED_FILES="" + diff --git a/remote/modules/dbus/dbus.conf.ubuntu b/remote/modules/dbus/dbus.conf.ubuntu index d007c2ef..9f302876 100644 --- a/remote/modules/dbus/dbus.conf.ubuntu +++ b/remote/modules/dbus/dbus.conf.ubuntu @@ -1,9 +1,7 @@ REQUIRED_CONTENT_PACKAGES=" dbus " -REQUIRED_DIRECTORIES+=" - /lib/systemd -" REQUIRED_FILES=" /etc/default/dbus " + -- cgit v1.2.3-55-g7522 From 4052504dc902765d109c34bff0db73a69a12b428 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Sep 2013 15:14:12 +0200 Subject: [dbus] Missed *.wants --- .../dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service | 1 + .../dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket | 1 + remote/modules/dbus/dbus.build | 2 +- remote/modules/dbus/templates/dbus.service | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 120000 remote/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service create mode 120000 remote/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket (limited to 'remote/modules') diff --git a/remote/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service b/remote/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service new file mode 120000 index 00000000..224df24b --- /dev/null +++ b/remote/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service @@ -0,0 +1 @@ +../dbus.service \ No newline at end of file diff --git a/remote/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket b/remote/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket new file mode 120000 index 00000000..fe02d162 --- /dev/null +++ b/remote/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket @@ -0,0 +1 @@ +../dbus.socket \ No newline at end of file diff --git a/remote/modules/dbus/dbus.build b/remote/modules/dbus/dbus.build index beb557b4..7b7e472c 100644 --- a/remote/modules/dbus/dbus.build +++ b/remote/modules/dbus/dbus.build @@ -22,7 +22,7 @@ build() { [ -z "$UUIDGEN" ] && perror "Could not determine dbus-uuidgen location" [ -z "$DAEMON" ] && perror "Could not determine dbus-daemon location" [ -z "$SEND" ] && perror "Could not determine dbus-send location" - sed "s,%UUIDGEN%,/$UUIDGEN,g;s,%DAEMON%,$DAEMON,g;s,%SEND%,$SEND,g" "templates/dbus.service" \ + sed "s,%UUIDGEN%,/$UUIDGEN,g;s,%DAEMON%,/$DAEMON,g;s,%SEND%,/$SEND,g" "templates/dbus.service" \ > "$MODULE_BUILD_DIR/etc/systemd/system/dbus.service" \ || perror "Could not generate $MODULE_BUILD_DIR/etc/systemd/system/dbus.service" } diff --git a/remote/modules/dbus/templates/dbus.service b/remote/modules/dbus/templates/dbus.service index b6e05271..a49d8f0f 100644 --- a/remote/modules/dbus/templates/dbus.service +++ b/remote/modules/dbus/templates/dbus.service @@ -1,5 +1,6 @@ [Unit] Description=D-Bus System Message Bus +Wants=dbus.socket Requires=dbus.socket After=syslog.target -- cgit v1.2.3-55-g7522 From a868911a9f3816719113d570bcd2a92a67cdc507 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Sep 2013 15:16:24 +0200 Subject: [debug] Remove non existent binary --- remote/modules/debug/debug.conf | 1 - 1 file changed, 1 deletion(-) (limited to 'remote/modules') diff --git a/remote/modules/debug/debug.conf b/remote/modules/debug/debug.conf index 82a741fe..66f90011 100644 --- a/remote/modules/debug/debug.conf +++ b/remote/modules/debug/debug.conf @@ -12,7 +12,6 @@ REQUIRED_BINARIES=" su file @htop - logger @tcpdump getfacl " -- cgit v1.2.3-55-g7522 From b3ae57767f7ca02e7901a07f087f9a40707d279d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Sep 2013 15:17:26 +0200 Subject: ...better yet, make it optional --- remote/modules/debug/debug.conf | 1 + 1 file changed, 1 insertion(+) (limited to 'remote/modules') diff --git a/remote/modules/debug/debug.conf b/remote/modules/debug/debug.conf index 66f90011..71006514 100644 --- a/remote/modules/debug/debug.conf +++ b/remote/modules/debug/debug.conf @@ -12,6 +12,7 @@ REQUIRED_BINARIES=" su file @htop + @logger @tcpdump getfacl " -- cgit v1.2.3-55-g7522