From patchwork Mon May 8 17:07:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 6844 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QFSQc3CBmz3wlQ for ; Mon, 8 May 2023 17:07:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QFSQT6xkqz1TJ; Mon, 8 May 2023 17:07:29 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QFSQT3zswz30JX; Mon, 8 May 2023 17:07:29 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QFSQS2mcRz2xlq for ; Mon, 8 May 2023 17:07:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QFSQR6kpGz16k; Mon, 8 May 2023 17:07:27 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1683565648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCWzUbqszCM0uHnXwkx9sd/WszFzt/ZFPdk0gQw5JU0=; b=5XydV1RzOOG+nAOAPOGEwUWKTYX37vBcrLGX7KD/nvBQMF6dCRfjrVQsCZxj6p/dLfYEK9 1wcKt+pWR4Qb/bBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1683565648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCWzUbqszCM0uHnXwkx9sd/WszFzt/ZFPdk0gQw5JU0=; b=gPxxLzOy4gtxdwpjbn3RuNSu/GPEAtdwYMWzjtOjan5hZxNOUFH5bLEGtN/hpFPQhhxZly 1TXOa9g80z0ZIV+CXxPyOMUrpyqh3Hu98a+XInQFqmqn3sNkYuOX9pOX1UdvrwcTMmHHTM ALfnEzUUGJPi4KKrlXJ44GUPT32NaYxjzNOPGQXGuPqq2c3SKLAxe+W05+XgOLvKHODQyl 26tB9Yue3LTLu0pIgjYXnK5BE7NbZMUKM2EKpueUFMsh0Zi9qirQFLx2Fq9K1uzOEjls0g cAPeshhqAzoLRAEm1V/6/JXoUlqeYaEHHT2ulCVdN4KxHlDSlZ0LVOuVCRmIug== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH v2 3/4] alsa: Fixes Bug#13087 - module removal & path correction for asound.state file Date: Mon, 8 May 2023 19:07:22 +0200 Message-Id: <20230508170723.3525876-3-adolf.belka@ipfire.org> In-Reply-To: <20230508170723.3525876-1-adolf.belka@ipfire.org> References: <20230508170723.3525876-1-adolf.belka@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - 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 --- src/paks/alsa/install.sh | 8 +++++++- src/paks/alsa/uninstall.sh | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/paks/alsa/install.sh b/src/paks/alsa/install.sh index 7b6b3dc80..ee0092195 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 62e27008d..ce88c294b 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