summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-02-09 22:35:00 +0100
committerLennart Poettering <lennart@poettering.net>2011-02-09 22:35:00 +0100
commit786b4b05dc1bfc725995f4c2556d49aec5e2ae1b (patch)
tree434e8f6e016cf8e0e20645db8d62b3bc9b070fc1 /src
parentdfd5e05f01dd4d28bc6c5ebc3c991404723bc076 (diff)
systemd: add unit for bootup and shutdown sounds
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am22
-rw-r--r--src/canberra-system-bootup.service.in18
-rw-r--r--src/canberra-system-shutdown-reboot.service.in17
-rw-r--r--src/canberra-system-shutdown.service.in16
-rw-r--r--src/oss.c3
5 files changed, 72 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 48c75ba..d6a5352 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -274,6 +274,7 @@ endif
endif
bin_PROGRAMS =
+CLEANFILES =
if HAVE_UDEV
if HAVE_ALSA
@@ -291,6 +292,25 @@ canberra_boot_LDADD = \
canberra_boot_CFLAGS = \
$(UDEV_CFLAGS)
+if HAVE_SYSTEMD
+
+systemdsystemunit_DATA = \
+ canberra-system-bootup.service \
+ canberra-system-shutdown.service \
+ canberra-system-shutdown-reboot.service
+
+EXTRA_DIST += \
+ canberra-system-bootup.service.in \
+ canberra-system-shutdown.service.in \
+ canberra-system-shutdown-reboot.service.in
+
+%.service: %.service.in
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+CLEANFILES += \
+ $(systemdsystemunit_DATA)
+
+endif
endif
endif
@@ -415,7 +435,7 @@ gdmautostart_DATA = \
gnomeshutdown_SCRIPTS = \
libcanberra-logout-sound.sh
-CLEANFILES = \
+CLEANFILES += \
libcanberra-login-sound.desktop \
libcanberra-ready-sound.desktop \
libcanberra-logout-sound.sh
diff --git a/src/canberra-system-bootup.service.in b/src/canberra-system-bootup.service.in
new file mode 100644
index 0000000..490b6b8
--- /dev/null
+++ b/src/canberra-system-bootup.service.in
@@ -0,0 +1,18 @@
+[Unit]
+Description=Play Bootup Sound
+DefaultDependencies=no
+After=alsa-restore.service
+Before=shutdown.target
+Conflicts=shutdown.target
+
+# A little optimization under the assumption that we are using the
+# standard freedesktop theme
+ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-bootup.oga
+
+[Service]
+Type=oneshot
+ExecStart=-@bindir@/canberra-boot system-bootup
+
+[Install]
+WantedBy=sound.target
+Also=canberra-system-shutdown.service canberra-system-shutdown-reboot.service
diff --git a/src/canberra-system-shutdown-reboot.service.in b/src/canberra-system-shutdown-reboot.service.in
new file mode 100644
index 0000000..0e46765
--- /dev/null
+++ b/src/canberra-system-shutdown-reboot.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=Play Reboot Sound
+DefaultDependencies=no
+Before=shutdown.target
+
+# A little optimization under the assumption that we are using the
+# standard freedesktop theme
+ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-shutdown.oga
+ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-shutdown-reboot.oga
+
+[Service]
+Type=oneshot
+ExecStart=-@bindir@/canberra-boot system-shutdown-reboot
+
+[Install]
+WantedBy=reboot.target kexec.target
+Also=canberra-system-shutdown.service
diff --git a/src/canberra-system-shutdown.service.in b/src/canberra-system-shutdown.service.in
new file mode 100644
index 0000000..f5ce0ca
--- /dev/null
+++ b/src/canberra-system-shutdown.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Play Shutdown Sound
+DefaultDependencies=no
+Before=shutdown.target
+
+# A little optimization under the assumption that we are using the
+# standard freedesktop theme
+ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-shutdown.oga
+
+[Service]
+Type=oneshot
+ExecStart=-@bindir@/canberra-boot system-shutdown
+
+[Install]
+WantedBy=halt.target poweroff.target
+Also=canberra-system-shutdown-reboot.service canberra-system-shutdown-reboot.service
diff --git a/src/oss.c b/src/oss.c
index 222503c..9bb7149 100644
--- a/src/oss.c
+++ b/src/oss.c
@@ -230,7 +230,6 @@ static int translate_error(int error) {
}
static int open_oss(ca_context *c, struct outstanding *out) {
- struct private *p;
int mode, val, test, ret;
ca_return_val_if_fail(c, CA_ERROR_INVALID);
@@ -241,8 +240,6 @@ static int open_oss(ca_context *c, struct outstanding *out) {
* multichannel streams. We cannot support those files hence */
ca_return_val_if_fail(ca_sound_file_get_nchannels(out->file) <= 2, CA_ERROR_NOTSUPPORTED);
- p = PRIVATE(c);
-
if ((out->pcm = open(c->device ? c->device : "/dev/dsp", O_WRONLY | O_NONBLOCK, 0)) < 0)
goto finish_errno;