From fbbeecf193549e6ab2b9e74b826dbb305069cd69 Mon Sep 17 00:00:00 2001 From: illiliti Date: Sun, 6 Sep 2020 16:46:46 +0300 Subject: [PATCH] cleanup copy_hook --- tinyramfs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tinyramfs b/tinyramfs index 5e4fb7f..ff83b8b 100755 --- a/tinyramfs +++ b/tinyramfs @@ -235,22 +235,24 @@ copy_hook() { hook="$1" - # false positive - # shellcheck disable=1090 for _dir in "$hksdir" /etc/tinyramfs/hooks "${srcdir}/hooks"; do [ -f "${_dir}/${hook}/${hook}" ] || ! continue + done || panic "could not find $hook hook" - print "running $hook hook"; . "${_dir}/${hook}/${hook}" + print "running $hook hook" - for _file in init init.late; do - [ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue + # false positive + # shellcheck disable=1090 + . "${_dir}/${hook}/${hook}" - copy_file "${_dir}/${hook}/${hook}.${_file}" \ - "/usr/share/tinyramfs/hooks/${hook##*/}" 644 0 - done + for _file in init init.late; do + [ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue - break - done || panic "could not run $hook hook" + print "copying ${hook}.${_file}" + + copy_file "${_dir}/${hook}/${hook}.${_file}" \ + "/usr/share/tinyramfs/hooks/${hook##*/}" 644 0 + done } copy_modules()