- replace 'echo -e' with printf - replace 'if [[ ... ]]' with 'if [ ... ]' - add \ at after && and || when those are at end of line
Signed-off-by: Natanael Copa <nc...@alpinelinux.org> --- I have tested the patch locally and it appears to work. On busybox 'echo -e' works but I replaced them since checkbashisms mentioned them. src/lxc/lxc-checkconfig.in | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in index 8c2b5e5..db78c7d 100644 --- a/src/lxc/lxc-checkconfig.in +++ b/src/lxc/lxc-checkconfig.in @@ -1,13 +1,13 @@ -#!/bin/bash +#!/bin/sh # Allow environment variables to override grep and config : ${CONFIG:=/proc/config.gz} : ${GREP:=zgrep} -SETCOLOR_SUCCESS="echo -en \\033[1;32m" -SETCOLOR_FAILURE="echo -en \\033[1;31m" -SETCOLOR_WARNING="echo -en \\033[1;33m" -SETCOLOR_NORMAL="echo -en \\033[0;39m" +SETCOLOR_SUCCESS="printf \\e[1;32m" +SETCOLOR_FAILURE="printf \\e[1;31m" +SETCOLOR_WARNING="printf \\e[1;33m" +SETCOLOR_NORMAL="printf \\e[0;39m" is_set() { $GREP -q "$1=[y|m]" $CONFIG @@ -21,12 +21,12 @@ is_enabled() { RES=$? if [ $RES -eq 0 ]; then - $SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL + $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL else if [ ! -z "$mandatory" -a "$mandatory" = yes ]; then - $SETCOLOR_FAILURE && echo -e "required" && $SETCOLOR_NORMAL + $SETCOLOR_FAILURE && echo "required" && $SETCOLOR_NORMAL else - $SETCOLOR_WARNING && echo -e "missing" && $SETCOLOR_NORMAL + $SETCOLOR_WARNING && echo "missing" && $SETCOLOR_NORMAL fi fi } @@ -73,7 +73,7 @@ echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then echo -n "Cgroup clone_children flag: " && - $SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL + $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL else echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes fi @@ -89,19 +89,19 @@ echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \ sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/') -if [[ $KVER_MAJOR == 2 ]]; then +if [ "$KVER_MAJOR" = "2" ]; then KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ sed -r 's/.* 2.6.([0-9]{2}).*/\1/') else KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/') fi -echo -n "File capabilities: " && - ( [[ ${KVER_MAJOR} == 2 && ${KVER_MINOR} < 33 ]] && - is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) || - ( [[ ( ${KVER_MAJOR} == 2 && ${KVER_MINOR} > 32 ) || - ${KVER_MAJOR} > 2 ]] && $SETCOLOR_SUCCESS && - echo -e "enabled" && $SETCOLOR_NORMAL ) +echo -n "File capabilities: " && \ + ( [ "${KVER_MAJOR}" = "2" ] && [ ${KVER_MINOR} -lt 33 ] && \ + is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) || \ + ( ( [ "${KVER_MAJOR}" = "2" ] && [ ${KVER_MINOR} -gt 32 ] ) || \ + [ ${KVER_MAJOR} -gt 2 ] && $SETCOLOR_SUCCESS && \ + echo "enabled" && $SETCOLOR_NORMAL ) echo echo "Note : Before booting a new kernel, you can check its configuration" -- 1.8.0 ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel