[alsa-devel] [PATCH] alsactl: Make homedir configurable

Takashi Iwai tiwai at suse.de
Wed Dec 28 17:06:37 CET 2016


On Tue, 27 Dec 2016 17:15:27 +0100,
Paul Menzel wrote:
> 
> 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

> 
> CC: Jordi Mallach <jordi at debian.org>
> Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
> ---
> 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(-)
> 
> diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in
> index c0c1b23..95b26c4 100644
> --- a/alsactl/90-alsa-restore.rules.in
> +++ b/alsactl/90-alsa-restore.rules.in
> @@ -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"
> diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
> index cac8094..d03137b 100644
> --- a/alsactl/Makefile.am
> +++ b/alsactl/Makefile.am
> @@ -40,6 +40,7 @@ endif
>  edit = \
>  	$(SED) -r -e 's, at sbindir\@,$(sbindir),g' \
>  		  -e 's, at mydatadir\@,$(mydatadir),g' \
> +		  -e 's, at alsactlhome\@,$(ALSACTL_HOME_DIR),g' \
>  		  -e 's, at daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
>  							< $< > $@ || rm $@
>  
> diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
> index 2884098..23dece8 100644
> --- a/alsactl/alsa-restore.service.in
> +++ b/alsactl/alsa-restore.service.in
> @@ -12,6 +12,6 @@ After=alsa-state.service
>  [Service]
>  Type=oneshot
>  RemainAfterExit=true
> -ExecStart=- at sbindir@/alsactl restore
> -ExecStop=- at sbindir@/alsactl store
> +ExecStart=- at sbindir@/alsactl -E HOME=@alsactlhome@ restore
> +ExecStop=- at sbindir@/alsactl -E HOME=@alsactlhome@ store
>  StandardOutput=syslog
> diff --git a/alsactl/alsa-state.service.in b/alsactl/alsa-state.service.in
> index f1321d6..28e3043 100644
> --- a/alsactl/alsa-state.service.in
> +++ b/alsactl/alsa-state.service.in
> @@ -10,5 +10,5 @@ After=sysinit.target
>  
>  [Service]
>  Type=simple
> -ExecStart=- at sbindir@/alsactl -s -n 19 -c rdaemon
> -ExecStop=- at sbindir@/alsactl -s kill save_and_quit
> +ExecStart=- at sbindir@/alsactl -E HOME=@alsactlhome@ -s -n 19 -c rdaemon
> +ExecStop=- at sbindir@/alsactl -E HOME=@alsactlhome@ -s kill save_and_quit
> diff --git a/configure.ac b/configure.ac
> index 69ff2ab..8cbf798 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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"],
> -- 
> 2.11.0


More information about the Alsa-devel mailing list