From patchwork Sun Sep 17 11:58:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Fitzenreiter X-Patchwork-Id: 7187 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 (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4RpRL43ylvz3wtG for ; Sun, 17 Sep 2023 11:59:24 +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 (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4RpRL06S7PzJ9; Sun, 17 Sep 2023 11:59:20 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4RpRL05Xxmz2yTq; Sun, 17 Sep 2023 11:59:20 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4RpRKy5VP5z2x9g for ; Sun, 17 Sep 2023 11:59:18 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4RpRKx70RKz1kZ; Sun, 17 Sep 2023 11:59:17 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1694951958; 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; bh=RFZFKpaEJY/hZyhmMxBJFRojP5VyHJSfgvE8YsbIpxA=; b=TD4e4i/o5YZ+ixy+1sK/UBYAMkYkF99bibngnQcQgyzzAdmDOAcB1MCBV2KEeKR1kbHTnf HAdHZBNOzz57i3DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1694951958; 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; bh=RFZFKpaEJY/hZyhmMxBJFRojP5VyHJSfgvE8YsbIpxA=; b=pnEg+jiVBcz3z2HGy3zIBmBo581A7vnLBm0bQzPyD27SCCJIlnNKyjh4zRU8yAzzn78Qw+ vatSCtufDI3P6W8ngo45OJXP+y5YPNBgM73vL0+ZEgcFHjog6gs6qyiQXQNUIDAwc5mv0h KhqW4FyiAPyxo1j1/jW4ll7yQ6sNmqLidxVc8woAWlbvrAHuRNKiobEKPCm5Tc+JNQ7zS6 pgpUb1q32gPnA9ajbsuhrVtCwDXtMfIJOMxv8jWlqD42LSpvm/PMMJtaUwboqe84q5GG8w WvV31obkrVbUzNf63e/0awgoKG+dM9xe14tREBHPN252gjR5t8eQNzr9L2+fwA== From: Arne Fitzenreiter To: development@lists.ipfire.org Subject: [PATCH] extrahd: use udev rule to mount extrahd partitions Date: Sun, 17 Sep 2023 13:58:54 +0200 Message-ID: <20230917115910.4074-1-arne_f@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: , Cc: Arne Fitzenreiter Errors-To: development-bounces@lists.ipfire.org Sender: "Development" the previous patches for https://bugzilla.ipfire.org/show_bug.cgi?id=12863 introduce a new bug that slow devices are not mounted at boot. So now udev calls the extrahd script with the uuid. Signed-off-by: Arne Fitzenreiter --- config/extrahd/extrahd.pl | 36 ++++++++++++++++++++++++++++-------- config/rootfiles/common/udev | 1 + config/udev/61-extrahd.rules | 1 + lfs/udev | 4 ++++ 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 config/udev/61-extrahd.rules diff --git a/config/extrahd/extrahd.pl b/config/extrahd/extrahd.pl index 145a2a43a..cc85228d5 100644 --- a/config/extrahd/extrahd.pl +++ b/config/extrahd/extrahd.pl @@ -35,10 +35,20 @@ extrahd_mount() { local failed=0 while IFS=';' read -r device filesystem mountpoint rest; do - # Filter by mountpoint if set - if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then - continue - fi + # Filter by UUID or mountpoint + case "${_mountpoint}" in + UUID=*) + if [ "${device}" != "${_mountpoint}" ]; then + continue + fi + ;; + + /*) + if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then + continue + fi + ;; + esac # Check that the mountpoint starts with a slash if [ "${mountpoint:0:1}" != "/" ]; then @@ -75,10 +85,20 @@ extrahd_umount() { local failed=0 while IFS=';' read -r device filesystem mountpoint rest; do - # Filter by mountpoint if set - if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then - continue - fi + # Filter by UUID or mountpoint + case "${_mountpoint}" in + UUID=*) + if [ "${device}" != "${_mountpoint}" ]; then + continue + fi + ;; + + /*) + if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then + continue + fi + ;; + esac # Do not try to umount if nothing is mounted if ! mountpoint "${mountpoint}" &>/dev/null; then diff --git a/config/rootfiles/common/udev b/config/rootfiles/common/udev index e5c9bd01f..876ae0c5a 100644 --- a/config/rootfiles/common/udev +++ b/config/rootfiles/common/udev @@ -70,6 +70,7 @@ lib/udev/rules.d/60-persistent-storage.rules lib/udev/rules.d/60-persistent-v4l.rules lib/udev/rules.d/60-sensor.rules lib/udev/rules.d/60-serial.rules +lib/udev/rules.d/61-extrahd.rules lib/udev/rules.d/64-btrfs.rules lib/udev/rules.d/70-camera.rules lib/udev/rules.d/70-joystick.rules diff --git a/config/udev/61-extrahd.rules b/config/udev/61-extrahd.rules new file mode 100644 index 000000000..114f2d665 --- /dev/null +++ b/config/udev/61-extrahd.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="block", RUN+="/var/ipfire/extrahd/bin/extrahd.pl udev-event" diff --git a/lfs/udev b/lfs/udev index eb01ae848..703d98b86 100644 --- a/lfs/udev +++ b/lfs/udev @@ -122,6 +122,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) install -v -m 644 $(DIR_SRC)/config/udev/60-net.rules \ /lib/udev/rules.d + # Install ExtraHD rules + install -v -m 644 $(DIR_SRC)/config/udev/61-extrahd.rules \ + /lib/udev/rules.d + # Install AQM rules install -v -m 644 $(DIR_SRC)/config/udev/99-aqm.rules \ /lib/udev/rules.d