packages/utils/lxc/patches/020-lxc-checkconfig.patch
Paul Spooren 30ea917518 treewide: replace which with command -v
Fix shellcheck SC2230
> which is non-standard. Use builtin 'command -v' instead.

Once applied to everything concerning OpenWrt we can disable the busybox
feature `which` and save 3.8kB.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-08-09 13:58:14 -10:00

20 lines
528 B
Diff

--- a/src/lxc/cmd/lxc-checkconfig.in
+++ b/src/lxc/cmd/lxc-checkconfig.in
@@ -4,6 +4,17 @@
# Allow environment variables to override config
: ${CONFIG:=/proc/config.gz}
: ${MODNAME:=configs}
+: ${ZGREP:=zgrep}
+: ${GUNZIP:=gunzip}
+
+if [ -z $(command -v $ZGREP) ] && ! [ -z $(command -v $GUNZIP) ] && [ -x $(command -v $GUNZIP) ] && [ -f $CONFIG ] && [ "$CONFIG" == "/proc/config.gz" ] ; then
+
+ CONFIG_NEW="/tmp/config-$(uname -r)"
+ $GUNZIP -c $CONFIG > $CONFIG_NEW
+ CONFIG=$CONFIG_NEW
+
+ GREP=grep
+fi
CAT="cat"