utils/check-package: allow exception for global checks
PATCH 1/2 utils/check-package: allow exception for global checks
check-package has a mechanism for a specific file to make an exception to a specific checker, by preceding the offending line with "check-package ... <checker class>". However, this is not possible for the global checks that are done in the checker's after() function.
Allow exceptions for the global checks by writing the same "check-package ... <checker class>" comment on the last line of the file.
--- utils/check-package | 2 ++ 1 file changed, 2 insertions(+)
utils/check-package +2 -0
@@ -247,6 +247,8 @@ def check_file_using_lib(fname): lastline = text for name, cf in objects: + if cf.disable.search(lastline): + continue warn, fail = print_warnings(cf.after(), name in xfail) if fail > 0: failed.add(name)
Signature · 6 lines
2.41.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/initscripts: add service to load kernel modules at boot
From: Angelo Compagnucci <[email protected]>
In cases where no hotplug is available (by choice or by the lack of a proper hotplug method for a device), this service can be used to load kernel module drivers by reading the /etc/modules-load.d/*.conf files. The modules files matches the one used by systemd, which in turn has a builtin mechanism to load a module at boot, therefore making systemv init on par with systemd features.
[Arnout:
- add exception for missing DAEMON variable;
- fix shellcheck warnings
]
--- package/initscripts/init.d/S11modules | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/initscripts/init.d/S11modules
package/initscripts/init.d/S11modules new file +62 -0
@@ -0,0 +1,62 @@ +#!/bin/sh + +MODULES_DIR="/etc/modules-load.d/" + +[ -z "$(ls -A ${MODULES_DIR} 2> /dev/null)" ] && exit 0 + +load_unload() { + for module_file in "${MODULES_DIR}"/*.conf; do + while read -r module args; do + + case "$module" in + ""|"#"*) continue ;; + esac + + if [ "$1" = "load" ]; then + # shellcheck disable=SC2086 # We need word splitting for args + modprobe -q "${module}" ${args} >/dev/null && \ + printf '%s ' "$module" || RET='FAIL' + else + rmmod "${module}" >/dev/null + fi + + done < "${module_file}" + done + + RET='OK' +} + +start() { + printf 'Starting modules: ' + + load_unload load + + echo $RET +} + +stop() { + printf 'Stopping modules: ' + + load_unload unload + + echo $RET +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart) + "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac + +# check-package Ignore missing DAEMON Variables
Signature · 6 lines
2.41.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/initscripts: add service to load kernel modules at boot
Quoted 9 lines · Arnout Vandecappelle
From: Angelo Compagnucci <[email protected]>
In cases where no hotplug is available (by choice or by the lack of a proper hotplug method for a device), this service can be used to load kernel module drivers by reading the
/etc/modules-load.d/*.conffiles. The modules files matches the one used by systemd, which in turn has a builtin mechanism to load a module at boot, therefore making systemv init on par with systemd features.
Quoted 7 lines
Signed-off-by Angelo Compagnucci <[email protected]>[Arnout:
- add exception for missing DAEMON variable;
- fix shellcheck warnings
]Signed-off-by Arnout Vandecappelle <[email protected]>---
I forgot the patch history.
v2:
* Moved script to initscripts (Arnout)
* Moved script to S11modules, after S10[mu]dev (Andreas)
* Use /etc/modules-load.d/ to share the same setup with systemd (me) v4:
* Select only .conf file (Peter)
* Better ouput: printing module name only when loaded successfully, print a FAIL when at least one module fails (Peter)
v5 (Arnout):
* Fix shellcheck warnings
* Add exception for missing DAEMON variable
Regards,
Arnout
Quoted 62 lines
package/initscripts/init.d/S11modules | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)create mode 100644 package/initscripts/init.d/S11modules
package/initscripts/init.d/S11modules new file +52
-0@@ -0,0 +1,62 @@ +#!/bin/sh + +MODULES_DIR="/etc/modules-load.d/" + +[ -z "$(ls -A ${MODULES_DIR} 2> /dev/null)" ] && exit 0 + +load_unload() { + for module_file in "${MODULES_DIR}"/*.conf; do + while read -r module args; do + + case "$module" in + ""|"#"*) continue ;; + esac + + if [ "$1" = "load" ]; then + # shellcheck disable=SC2086 # We need word splitting for args + modprobe -q "${module}" ${args} >/dev/null && \ + printf '%s ' "$module" || RET='FAIL' + else + rmmod "${module}" >/dev/null + fi + + done < "${module_file}" + done + + RET='OK' +} + +start() { + printf 'Starting modules: ' + + load_unload load + + echo $RET +} + +stop() { + printf 'Stopping modules: ' + + load_unload unload + + echo $RET +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart)
package/initscripts/init.d/S11modules line 62
Quoted 10 lines
package/initscripts/init.d/S11modules new file +10
-0+ "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac + +# check-package Ignore missing DAEMON Variables
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 10 lines · Arnout Vandecappelle
check-package has a mechanism for a specific file to make an exception to a specific checker, by preceding the offending line with "check-package ... <checker class>". However, this is not possible for the global checks that are done in the checker's
after()function.Allow exceptions for the global checks by writing the same "check-package ... <checker class>" comment on the last line of the file.
Signed-off-by Arnout Vandecappelle <[email protected]>
Applied both to master, thanks.
Regards,
Arnout
Quoted 9 lines
--- utils/check-package | 2 ++ 1 file changed, 2 insertions(+)utils/check-package +0
-0
utils/check-package def check_file_using_lib(fname): · line 254
Quoted 8 lines
utils/check-package +2
-0@@ -247,6 +247,8 @@ def check_file_using_lib(fname): lastline = text for name, cf in objects: + if cf.disable.search(lastline): + continue warn, fail = print_warnings(cf.after(), name in xfail) if fail > 0: failed.add(name)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot