From: Adolf Belka Date: Mon, 8 May 2023 17:07:22 +0000 (+0200) Subject: alsa: Fixes Bug#13087 - module removal & path correction for asound.state file X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=238a0468da6a6d1fdfa236969e5dd43029dcb85a;p=people%2Fms%2Fipfire-2.x.git alsa: Fixes Bug#13087 - module removal & path correction for asound.state file - start_service added to install.sh and stop_service to uninstall.sh This ensures that the modules are loaded after install - The /etc/asound.state file was touched by the install.sh cript but the alsactl store and restore commands have default location of /var/lib/alsa/ so the touch command created an asound.state file that was then not used subsequently. It also meant that the first start of alsa would fail as it would try and restore from /var/lib/alsa/asound.state but the file did not exist. - This patch corrects the path for the touch command for asound.state - The install.sh script also checks if /etc/asound.state, that was never used, exists and if it does removes it. - Uninstalling alsa left the sound modules installed until a reboot was carried out. Uninstallation should unload the alsa kernel modules. This patch adds the modprobe -r commands to the uninstall.sh file to unload all the snd modules when alsa is uninstalled. - make_backup and restore_backup commands added to ther install.sh and uninstall.sh scripts Fixes: Bug#13087 Signed-off-by: Adolf Belka --- diff --git a/src/paks/alsa/install.sh b/src/paks/alsa/install.sh index 7b6b3dc80d..ee0092195d 100644 --- a/src/paks/alsa/install.sh +++ b/src/paks/alsa/install.sh @@ -24,7 +24,13 @@ . /opt/pakfire/lib/functions.sh extract_files groupadd audio 2>/dev/null -touch /etc/asound.state +touch /var/lib/alsa/asound.state +if [ -f /etc/asound.state ]; then + rm /etc/asound.state +fi +restore_backup ${NAME} ln -svf ../init.d/alsa /etc/rc.d/rc3.d/S65alsa ln -svf ../init.d/alsa /etc/rc.d/rc0.d/K35alsa ln -svf ../init.d/alsa /etc/rc.d/rc6.d/K35alsa +start_service ${NAME} +exit 0 diff --git a/src/paks/alsa/uninstall.sh b/src/paks/alsa/uninstall.sh index 62e27008d1..ce88c294bc 100644 --- a/src/paks/alsa/uninstall.sh +++ b/src/paks/alsa/uninstall.sh @@ -22,5 +22,11 @@ ############################################################################ # . /opt/pakfire/lib/functions.sh +stop_service ${NAME} +make_backup ${NAME} +# unload alsa related modules +modprobe -r snd_pcm_oss >/dev/null 2>&1 || failed=1 +modprobe -r snd_timer >/dev/null 2>&1 || failed=1 remove_files rm -rf /etc/rc.d/rc*.d/*alsa +exit 0