]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
refactor(crypt): use function in crypt-cleanup.sh main
authorBenjamin Drung <benjamin.drung@canonical.com>
Sat, 18 Jul 2026 21:59:19 +0000 (23:59 +0200)
committerdevkontrol <dev@kontrol.dev>
Thu, 23 Jul 2026 01:19:32 +0000 (21:19 -0400)
shellcheck will complain about crypt-cleanup.sh when checking for
busybox:

```
In modules.d/70crypt/crypt-cleanup.sh line 8:
        local do_break="y"
        ^---^ SC2168 (error): 'local' is only valid in functions.
```

modules.d/70crypt/crypt-cleanup.sh

index 8307a2fdce9eaabb1e49f3d37402777d6b1388db..7d037637b3a0ecf0d06b436555f2f1fe49feb239 100755 (executable)
@@ -3,7 +3,7 @@
 # close everything which is not busy
 rm -f -- /etc/udev/rules.d/70-luks.rules > /dev/null 2>&1
 
-if ! getarg rd.luks.uuid > /dev/null 2>&1 && getargbool 1 rd.luks > /dev/null 2>&1; then
+close_luks() {
     while :; do
         local do_break="y"
         for i in /dev/mapper/luks-*; do
@@ -11,4 +11,8 @@ if ! getarg rd.luks.uuid > /dev/null 2>&1 && getargbool 1 rd.luks > /dev/null 2>
         done
         [ "$do_break" = "y" ] && break
     done
+}
+
+if ! getarg rd.luks.uuid > /dev/null 2>&1 && getargbool 1 rd.luks > /dev/null 2>&1; then
+    close_luks
 fi