Re: alsa start (Re: Fwd: udev events and /usr not mounted)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Myra Nelson wrote:

> Alsa is in my daemons array and starts. The problem is the udev
> rule to restore the volume levels fails as it is run before /usr
> is mounted. That's why I was asking about udev rules and why [
> /usr/bin/alsactl restore ] works from the console after I've
> booted. After reading through the initscripts, rc.d, and mkinitcpio
> code I think it may be possible to run:
> 
> [
> run_hook sysinit_postmount
> 
>  udevam control --reload-rules
> 
> run_hook single_end
> ]
> 
> in rc.local.

The hooks don't work like this, rc.local might run too late.

You'd make a file eg. /etc/rc.d/functions.d/my-hooks.sh:

  my_sysinit_postmount_udevadm()
  {
      udevadm control --reload-rules ||
      echo "my_sysinit_postmount_udevadm: udevadm err $?"
      return 0
  }
  add_hook sysinit_postmount my_sysinit_postmount_udevadm

Putting the file into etc/rc.d/functions.d/ will let the hooks system
see and source it, and add_hook() will put your function into the array
of functions to run at a specific point.  The list of hooks is in
etc/rc.d/functions and a custom hook function is a regular shell
function.  No special error handling or sandboxing is done on them, so
you want to make sure they don't block or kill the shell.  This is why
I'd recommend to use the "|| ..." clause after some user command and to
return a zero at the end, though ATM neither seems strictly necessary.
It will make a hook funtion future proof, I presume.


clemens



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux