Skip to contentSkip to conversation

alsactl: Make homedir configurable

PATCH In review Paul Menzel 2 participants 2 messages Dec 27, 2016 – Dec 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsactl: Make homedir configurable

Date: Sat, 19 Oct 2013 10:12:19 +0000

Add new configure switch to set alsactl's homedir. This is used to avoid that a directory .pulse is created by the init script, when PulseAudio is installed [1].

[1] https://bugs.debian.org/712980
"alsa-utils startup script creates /.pulse files ("Failed to create
secure directory") when pulseaudio is installed"

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--
 alsactl/Makefile.am              | 1 +
 alsactl/alsa-restore.service.in  | 4 ++--
 alsactl/alsa-state.service.in    | 4 ++--
 configure.ac                     | 6 ++++++
 5 files changed, 13 insertions(+), 6 deletions(-)
alsactl/90-alsa-restore.rules.in +2 -2
index c0c1b23..95b26c4 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==
 GOTO="alsa_restore_end"
 
 LABEL="alsa_restore_go"
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}"
-TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
+TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl -E HOME=@alsactlhome@ restore $attr{device/number}"
+TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl -E HOME=@alsactlhome@ nrestore $attr{device/number}"
 
 LABEL="alsa_restore_end"
alsactl/Makefile.am +1 -0
index cac8094..d03137b 100644
@@ -40,6 +40,7 @@ endif
 edit = \
 	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
+		  -e 's,@alsactlhome\@,$(ALSACTL_HOME_DIR),g' \
 		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
 							< $< > $@ || rm $@
 
alsactl/alsa-restore.service.in +2 -2
index 2884098..23dece8 100644
@@ -12,6 +12,6 @@ After=alsa-state.service
 [Service]
 Type=oneshot
 RemainAfterExit=true
-ExecStart=-@sbindir@/alsactl restore
-ExecStop=-@sbindir@/alsactl store
+ExecStart=-@sbindir@/alsactl -E HOME=@alsactlhome@ restore
+ExecStop=-@sbindir@/alsactl -E HOME=@alsactlhome@ store
 StandardOutput=syslog
alsactl/alsa-state.service.in +2 -2
index f1321d6..28e3043 100644
@@ -10,5 +10,5 @@ After=sysinit.target
 
 [Service]
 Type=simple
-ExecStart=-@sbindir@/alsactl -s -n 19 -c rdaemon
-ExecStop=-@sbindir@/alsactl -s kill save_and_quit
+ExecStart=-@sbindir@/alsactl -E HOME=@alsactlhome@ -s -n 19 -c rdaemon
+ExecStop=-@sbindir@/alsactl -E HOME=@alsactlhome@ -s kill save_and_quit
configure.ac +6 -0
index 69ff2ab..8cbf798 100644
@@ -409,6 +409,12 @@ AC_ARG_WITH([alsactl-pidfile-dir],
         [ALSACTL_PIDFILE_DIR="/var/run"])
 AC_SUBST(ALSACTL_PIDFILE_DIR)
 
+AC_ARG_WITH([alsactl-home-dir],
+        AS_HELP_STRING([--with-alsactl-home-dir=DIR], [Directory to use as homedir for alsactl]),
+        [ALSACTL_HOME_DIR="$withval"],
+        [ALSACTL_HOME_DIR="/var/run/alsa"])
+AC_SUBST(ALSACTL_HOME_DIR)
+
 AC_ARG_WITH([alsactl-daemonswitch],
         AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
         [ALSACTL_DAEMONSWITCH="$withval"],
Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · Paul Menzel

Date: Sat, 19 Oct 2013 10:12:19 +0000

Add new configure switch to set alsactl's homedir. This is used to avoid that a directory .pulse is created by the init script, when PulseAudio is installed [1].

[1] https://bugs.debian.org/712980
"alsa-utils startup script creates /.pulse files ("Failed to create
secure directory") when pulseaudio is installed"

Hrm, how is PA triggered by alsactl?
Overriding $HOME sounds scary to me...

thanks,

Takashi

Quoted 83 lines

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--
 alsactl/Makefile.am              | 1 +
 alsactl/alsa-restore.service.in  | 4 ++--
 alsactl/alsa-state.service.in    | 4 ++--
 configure.ac                     | 6 ++++++
 5 files changed, 13 insertions(+), 6 deletions(-)
alsactl/90-alsa-restore.rules.in +2 -2
index c0c1b23..95b26c4 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==
 GOTO="alsa_restore_end"
 
 LABEL="alsa_restore_go"
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}"
-TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
+TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl -E HOME=@alsactlhome@ restore $attr{device/number}"
+TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl -E HOME=@alsactlhome@ nrestore $attr{device/number}"
 
 LABEL="alsa_restore_end"
alsactl/Makefile.am +1 -0
index cac8094..d03137b 100644
@@ -40,6 +40,7 @@ endif
 edit = \
 	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
+		  -e 's,@alsactlhome\@,$(ALSACTL_HOME_DIR),g' \
 		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
 							< $< > $@ || rm $@
 
alsactl/alsa-restore.service.in +2 -2
index 2884098..23dece8 100644
@@ -12,6 +12,6 @@ After=alsa-state.service
 [Service]
 Type=oneshot
 RemainAfterExit=true
-ExecStart=-@sbindir@/alsactl restore
-ExecStop=-@sbindir@/alsactl store
+ExecStart=-@sbindir@/alsactl -E HOME=@alsactlhome@ restore
+ExecStop=-@sbindir@/alsactl -E HOME=@alsactlhome@ store
 StandardOutput=syslog
alsactl/alsa-state.service.in +2 -2
index f1321d6..28e3043 100644
@@ -10,5 +10,5 @@ After=sysinit.target
 
 [Service]
 Type=simple
-ExecStart=-@sbindir@/alsactl -s -n 19 -c rdaemon
-ExecStop=-@sbindir@/alsactl -s kill save_and_quit
+ExecStart=-@sbindir@/alsactl -E HOME=@alsactlhome@ -s -n 19 -c rdaemon
+ExecStop=-@sbindir@/alsactl -E HOME=@alsactlhome@ -s kill save_and_quit
configure.ac +6 -0
index 69ff2ab..8cbf798 100644
@@ -409,6 +409,12 @@ AC_ARG_WITH([alsactl-pidfile-dir],
         [ALSACTL_PIDFILE_DIR="/var/run"])
 AC_SUBST(ALSACTL_PIDFILE_DIR)
 
+AC_ARG_WITH([alsactl-home-dir],
+        AS_HELP_STRING([--with-alsactl-home-dir=DIR], [Directory to use as homedir for alsactl]),
+        [ALSACTL_HOME_DIR="$withval"],
+        [ALSACTL_HOME_DIR="/var/run/alsa"])
+AC_SUBST(ALSACTL_HOME_DIR)
+
 AC_ARG_WITH([alsactl-daemonswitch],
         AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]),
         [ALSACTL_DAEMONSWITCH="$withval"],
Signature · 1 line
2.11.0