add optional aplay-at-startup service

Installs service file in /etc/systemd/system/, then disables.  Prompts
user to enable, and triggers reboot dialog if installed.
This commit is contained in:
Brennen Bearnes 2018-10-24 10:55:34 -06:00
parent 4aecc73356
commit c84c0249ea

View file

@ -438,6 +438,32 @@ EOL
sudo mv ~/asound.conf /etc/asound.conf sudo mv ~/asound.conf /etc/asound.conf
newline
echo "Installing aplay systemd unit"
sudo sh -c 'cat > /etc/systemd/system/aplay.service' << 'EOL'
[Unit]
Description=Invoke aplay from /dev/zero at system start.
[Service]
ExecStart=/usr/bin/aplay /dev/zero
[Install]
WantedBy=multi-user.target
EOL
sudo systemctl daemon-reload
sudo systemctl disable aplay
newline
echo "You can optionally activate '/dev/zero' playback in"
echo "the background at boot. This will remove all"
echo "popping/clicking but does use some processor time."
newline
if confirm "Activate '/dev/zero' playback in background? [RECOMMENDED]"; then
newline
sudo systemctl enable aplay
ASK_TO_REBOOT=true
fi
if [ $bcm2835off == "yes" ]; then if [ $bcm2835off == "yes" ]; then
newline newline
echo "We can now test your $productname" echo "We can now test your $productname"