From: Harald Hoyer Date: Wed, 27 Jun 2012 12:16:32 +0000 (+0200) Subject: modules.d: get rid of "tr" X-Git-Tag: 020~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99c7b70d1d2fac88c5639ab6fbd615689147a944;p=thirdparty%2Fdracut.git modules.d: get rid of "tr" replace it with sed or str_replace or bash ${var/a/b} --- diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh index 7c8cd6657..a7ddc8282 100755 --- a/modules.d/10i18n/module-setup.sh +++ b/modules.d/10i18n/module-setup.sh @@ -31,7 +31,7 @@ install() { *) cmd=grep ;; esac - for INCL in $($cmd "^include " $MAP | cut -d' ' -f2 | tr -d '"'); do + for INCL in $($cmd "^include " $MAP | while read a a b; do echo ${a/\"/}; done); do for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do findkeymap $FN done diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh index 0ec6b4ec6..c69d81a38 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -77,7 +77,7 @@ installkernel() { install() { local _arch _i _dir - dracut_install ip arping tr dhclient + dracut_install ip arping dhclient sed dracut_install -o brctl inst_script "$moddir/ifup.sh" "/sbin/ifup" inst_script "$moddir/netroot.sh" "/sbin/netroot" diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 7157cd5b5..9132e4d2e 100644 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -13,7 +13,7 @@ iface_for_remote_addr() { } iface_for_mac() { - local interface="" mac="$(echo $1 | tr '[:upper:]' '[:lower:]')" + local interface="" mac="$(echo $1 | sed 'y/ABCDEF/abcdef/')" for interface in /sys/class/net/*; do if [ $(cat $interface/address) = "$mac" ]; then echo ${interface##*/} diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh index 933ad27a8..983eb3aeb 100755 --- a/modules.d/40network/parse-bond.sh +++ b/modules.d/40network/parse-bond.sh @@ -32,8 +32,8 @@ parsebond() { case $# in 0) bondname=bond0; bondslaves="eth0 eth1" ;; 1) bondname=$1; bondslaves="eth0 eth1" ;; - 2) bondname=$1; bondslaves=$(echo $2|tr "," " ") ;; - 3) bondname=$1; bondslaves=$(echo $2|tr "," " "); bondoptions=$(echo $3|tr "," " ") ;; + 2) bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;; + 3) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;; *) die "bond= requires zero to four parameters" ;; esac } @@ -53,7 +53,7 @@ if getarg bond >/dev/null; then bondslaves="eth0 eth1" fi # Make it suitable for initscripts export - bondoptions=$(echo $bondoptions|tr ";" ",") + bondoptions=$(str_replace "$bondoptions" ";" ",") echo "bondname=$bondname" > /tmp/bond.info echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh index 5728fb6a3..1f027bb0d 100755 --- a/modules.d/40network/parse-bridge.sh +++ b/modules.d/40network/parse-bridge.sh @@ -29,7 +29,7 @@ parsebridge() { case $# in 0) bridgename=br0; ethnames=$iface ;; 1) die "bridge= requires two parameters" ;; - 2) bridgename=$1; ethnames=$(echo $2|tr "," " ") ;; + 2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;; *) die "bridge= requires two parameters" ;; esac } diff --git a/modules.d/40network/parse-ifname.sh b/modules.d/40network/parse-ifname.sh index 26e6084d8..ce73a72a3 100755 --- a/modules.d/40network/parse-ifname.sh +++ b/modules.d/40network/parse-ifname.sh @@ -26,7 +26,7 @@ parse_ifname_opts() { 7) ifname_if=$1 # udev requires MAC addresses to be lower case - ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'` + ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/') ;; *) die "Invalid arguments for ifname=" diff --git a/modules.d/80cms/cms-write-ifcfg.sh b/modules.d/80cms/cms-write-ifcfg.sh index 6349df356..6df63547a 100755 --- a/modules.d/80cms/cms-write-ifcfg.sh +++ b/modules.d/80cms/cms-write-ifcfg.sh @@ -89,7 +89,7 @@ EOF for option in LAYER2 PORTNO; do [ -z "${!option}" ] && continue [ -n "$optstr" ] && optstr=${optstr}" " - optstr=${optstr}$(echo ${option} | tr [[:upper:]] [[:lower:]])"="${!option} + optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option} done # write single quotes since network.py removes double quotes but we need quotes echo "OPTIONS='$optstr'" >> $IFCFGFILE diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh index 87f34e327..69a20ad83 100755 --- a/modules.d/80cms/module-setup.sh +++ b/modules.d/80cms/module-setup.sh @@ -24,7 +24,7 @@ install() { inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh" inst_script "$moddir/cmsifup.sh" /sbin/cmsifup dracut_install /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ - cmsfs-fuse fusermount ulockmgr_server bash tr insmod rmmod cat normalize_dasd_arg \ + cmsfs-fuse fusermount ulockmgr_server bash insmod rmmod cat normalize_dasd_arg sed \ $(rpm -ql s390utils-base) inst_libdir_file "gconv/*" diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh index 74efc7b29..62bf18cc7 100755 --- a/modules.d/95dasd/module-setup.sh +++ b/modules.d/95dasd/module-setup.sh @@ -18,7 +18,7 @@ installkernel() { install() { inst_hook cmdline 30 "$moddir/parse-dasd.sh" - dracut_install tr dasdinfo dasdconf.sh normalize_dasd_arg + dracut_install dasdinfo dasdconf.sh normalize_dasd_arg if [[ $hostonly ]]; then inst /etc/dasd.conf fi diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh index bbfdd2761..fc8f42250 100755 --- a/modules.d/95zfcp/module-setup.sh +++ b/modules.d/95zfcp/module-setup.sh @@ -22,7 +22,7 @@ installkernel() { install() { inst_hook cmdline 30 "$moddir/parse-zfcp.sh" - dracut_install tr zfcp_cio_free grep sed seq + dracut_install zfcp_cio_free grep sed seq inst_script /sbin/zfcpconf.sh inst_rules 56-zfcp.rules diff --git a/modules.d/95zfcp/zfcpconf.sh b/modules.d/95zfcp/zfcpconf.sh index ceced3556..7127eaebf 100755 --- a/modules.d/95zfcp/zfcpconf.sh +++ b/modules.d/95zfcp/zfcpconf.sh @@ -30,7 +30,7 @@ if [ -f "$CONFIG" ]; then if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then return fi - tr "A-Z" "a-z" < $CONFIG| while read line; do + sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' < $CONFIG| while read line; do case $line in \#*) ;; *)