[arch-commits] Commit in systemd/trunk (PKGBUILD initcpio-install-systemd)

Christian Hesse eworm at archlinux.org
Tue Apr 6 22:03:21 UTC 2021


    Date: Tuesday, April 6, 2021 @ 22:03:21
  Author: eworm
Revision: 411674

clean up systemd hook

This also allows proper parsing of udev rule files where
comma is inside quoted string.

Modified:
  systemd/trunk/PKGBUILD
  systemd/trunk/initcpio-install-systemd

--------------------------+
 PKGBUILD                 |    2 +-
 initcpio-install-systemd |   21 +++++++--------------
 2 files changed, 8 insertions(+), 15 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-04-06 21:03:04 UTC (rev 411673)
+++ PKGBUILD	2021-04-06 22:03:21 UTC (rev 411674)
@@ -45,7 +45,7 @@
             '882e486b6d88c8bafc50088845e41a49686e98981967f72ca1fb4ef07a01767400632f4b648fd31857d2a2a24a8fd65bcc2a8983284dd4fff2380732741d4c41'
             '313f3d6cc3d88f718509007e029213a82d84b196afdadc6ef560580acf70ab480aaecd7622f51726cc1af7d7841c6ec5390f72890b055a54fc74722341395651'
             'f0d933e8c6064ed830dec54049b0a01e27be87203208f6ae982f10fb4eddc7258cb2919d594cbfb9a33e74c3510cfd682f3416ba8e804387ab87d1a217eb4b73'
-            '99afbaef608930df97ced89ebfb6ae15e7d737591cb5a2c97d82707ea8cd9f255328e992961307fa7e7a7d0b8dabc56221c8c2bafc099420e8373c632eb64b13'
+            '4a18325cabad91c12e3ec9c80ad6a91d71ac387a108cc18e4201d0bda2f548d8a9e6955f3e5a6ed9ef99a2d5e32bba94eaa0d1249ab3721be0fe8f564c057538'
             'a25b28af2e8c516c3a2eec4e64b8c7f70c21f974af4a955a4a9d45fd3e3ff0d2a98b4419fe425d47152d5acae77d64e69d8d014a7209524b75a81b0edb10bf3a'
             '61032d29241b74a0f28446f8cf1be0e8ec46d0847a61dadb2a4f096e8686d5f57fe5c72bcf386003f6520bc4b5856c32d63bf3efe7eb0bc0deefc9f68159e648'
             'c416e2121df83067376bcaacb58c05b01990f4614ad9de657d74b6da3efa441af251d13bf21e3f0f71ddcb4c9ea658b81da3d915667dc5c309c87ec32a1cb5a5'

Modified: initcpio-install-systemd
===================================================================
--- initcpio-install-systemd	2021-04-06 21:03:04 UTC (rev 411673)
+++ initcpio-install-systemd	2021-04-06 22:03:21 UTC (rev 411674)
@@ -1,13 +1,5 @@
 #!/bin/bash
 
-strip_quotes() {
-  local len=${#1} quotes=$'[\'"]' str=${!1}
-
-  if [[ ${str:0:1} = ${str: -1} && ${str:0:1} = $quotes ]]; then
-    printf -v "$1" %s "${str:1:-1}"
-  fi
-}
-
 add_udev_rule() {
     # Add an udev rules file to the initcpio image. Dependencies on binaries
     # will be discovered and added.
@@ -15,7 +7,7 @@
 
     local rules= rule= key= value= binary=
 
-    rules=$(PATH=/usr/lib/udev/rules.d:/lib/udev/rules.d type -P "$1")
+    rules=$(PATH=/usr/lib/udev/rules.d type -P "$1")
     if [[ -z $rules ]]; then
         # complain about not found rules
         return 1
@@ -31,12 +23,13 @@
             IFS=' =' read -r key value <<< "$pair"
             case $key in
                 RUN@({program}|+)|IMPORT{program}|ENV{REMOVE_CMD})
-                    strip_quotes 'value'
+                    # strip quotes
+                    binary=${value//[\"\']/}
                     # just take the first word as the binary name
-                    binary=${value%% *}
+                    binary=${binary%% *}
                     [[ ${binary:0:1} == '$' ]] && continue
                     if [[ ${binary:0:1} != '/' ]]; then
-                        binary=$(PATH=/usr/lib/udev:/lib/udev type -P "$binary")
+                        binary=$(PATH=/usr/lib/udev type -P "$binary")
                     fi
                     add_binary "$binary"
                     ;;
@@ -52,7 +45,7 @@
 
     local unit= rule= entry= key= value= binary= dep=
 
-    unit=$(PATH=/usr/lib/systemd/system:/lib/systemd/system type -P "$1")
+    unit=$(PATH=/usr/lib/systemd/system type -P "$1")
     if [[ -z $unit ]]; then
         # complain about not found unit file
         return 1
@@ -82,7 +75,7 @@
     done <"$unit"
 
     # preserve reverse soft dependency
-    for dep in {/usr,}/lib/systemd/system/*.wants/${unit##*/}; do
+    for dep in /usr/lib/systemd/system/*.wants/${unit##*/}; do
         if [[ -L $dep ]]; then
             add_symlink "$dep"
         fi



More information about the arch-commits mailing list