Browse Source

modules.d: get rid of "tr"

replace it with sed or str_replace or bash ${var/a/b}
master
Harald Hoyer 13 years ago
parent
commit
99c7b70d1d
  1. 2
      modules.d/10i18n/module-setup.sh
  2. 2
      modules.d/40network/module-setup.sh
  3. 2
      modules.d/40network/net-lib.sh
  4. 6
      modules.d/40network/parse-bond.sh
  5. 2
      modules.d/40network/parse-bridge.sh
  6. 2
      modules.d/40network/parse-ifname.sh
  7. 2
      modules.d/80cms/cms-write-ifcfg.sh
  8. 2
      modules.d/80cms/module-setup.sh
  9. 2
      modules.d/95dasd/module-setup.sh
  10. 2
      modules.d/95zfcp/module-setup.sh
  11. 2
      modules.d/95zfcp/zfcpconf.sh

2
modules.d/10i18n/module-setup.sh

@ -31,7 +31,7 @@ install() {
*) cmd=grep ;; *) cmd=grep ;;
esac 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 for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN findkeymap $FN
done done

2
modules.d/40network/module-setup.sh

@ -77,7 +77,7 @@ installkernel() {


install() { install() {
local _arch _i _dir local _arch _i _dir
dracut_install ip arping tr dhclient dracut_install ip arping dhclient sed
dracut_install -o brctl dracut_install -o brctl
inst_script "$moddir/ifup.sh" "/sbin/ifup" inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot" inst_script "$moddir/netroot.sh" "/sbin/netroot"

2
modules.d/40network/net-lib.sh

@ -13,7 +13,7 @@ iface_for_remote_addr() {
} }


iface_for_mac() { 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 for interface in /sys/class/net/*; do
if [ $(cat $interface/address) = "$mac" ]; then if [ $(cat $interface/address) = "$mac" ]; then
echo ${interface##*/} echo ${interface##*/}

6
modules.d/40network/parse-bond.sh

@ -32,8 +32,8 @@ parsebond() {
case $# in case $# in
0) bondname=bond0; bondslaves="eth0 eth1" ;; 0) bondname=bond0; bondslaves="eth0 eth1" ;;
1) bondname=$1; bondslaves="eth0 eth1" ;; 1) bondname=$1; bondslaves="eth0 eth1" ;;
2) bondname=$1; bondslaves=$(echo $2|tr "," " ") ;; 2) bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
3) bondname=$1; bondslaves=$(echo $2|tr "," " "); bondoptions=$(echo $3|tr "," " ") ;; 3) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
*) die "bond= requires zero to four parameters" ;; *) die "bond= requires zero to four parameters" ;;
esac esac
} }
@ -53,7 +53,7 @@ if getarg bond >/dev/null; then
bondslaves="eth0 eth1" bondslaves="eth0 eth1"
fi fi
# Make it suitable for initscripts export # Make it suitable for initscripts export
bondoptions=$(echo $bondoptions|tr ";" ",") bondoptions=$(str_replace "$bondoptions" ";" ",")
echo "bondname=$bondname" > /tmp/bond.info echo "bondname=$bondname" > /tmp/bond.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info

2
modules.d/40network/parse-bridge.sh

@ -29,7 +29,7 @@ parsebridge() {
case $# in case $# in
0) bridgename=br0; ethnames=$iface ;; 0) bridgename=br0; ethnames=$iface ;;
1) die "bridge= requires two parameters" ;; 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" ;; *) die "bridge= requires two parameters" ;;
esac esac
} }

2
modules.d/40network/parse-ifname.sh

@ -26,7 +26,7 @@ parse_ifname_opts() {
7) 7)
ifname_if=$1 ifname_if=$1
# udev requires MAC addresses to be lower case # 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=" die "Invalid arguments for ifname="

2
modules.d/80cms/cms-write-ifcfg.sh

@ -89,7 +89,7 @@ EOF
for option in LAYER2 PORTNO; do for option in LAYER2 PORTNO; do
[ -z "${!option}" ] && continue [ -z "${!option}" ] && continue
[ -n "$optstr" ] && optstr=${optstr}" " [ -n "$optstr" ] && optstr=${optstr}" "
optstr=${optstr}$(echo ${option} | tr [[:upper:]] [[:lower:]])"="${!option} optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
done done
# write single quotes since network.py removes double quotes but we need quotes # write single quotes since network.py removes double quotes but we need quotes
echo "OPTIONS='$optstr'" >> $IFCFGFILE echo "OPTIONS='$optstr'" >> $IFCFGFILE

2
modules.d/80cms/module-setup.sh

@ -24,7 +24,7 @@ install() {
inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh" inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"
inst_script "$moddir/cmsifup.sh" /sbin/cmsifup inst_script "$moddir/cmsifup.sh" /sbin/cmsifup
dracut_install /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ 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) $(rpm -ql s390utils-base)


inst_libdir_file "gconv/*" inst_libdir_file "gconv/*"

2
modules.d/95dasd/module-setup.sh

@ -18,7 +18,7 @@ installkernel() {


install() { install() {
inst_hook cmdline 30 "$moddir/parse-dasd.sh" 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 if [[ $hostonly ]]; then
inst /etc/dasd.conf inst /etc/dasd.conf
fi fi

2
modules.d/95zfcp/module-setup.sh

@ -22,7 +22,7 @@ installkernel() {


install() { install() {
inst_hook cmdline 30 "$moddir/parse-zfcp.sh" 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_script /sbin/zfcpconf.sh
inst_rules 56-zfcp.rules inst_rules 56-zfcp.rules

2
modules.d/95zfcp/zfcpconf.sh

@ -30,7 +30,7 @@ if [ -f "$CONFIG" ]; then
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
return return
fi fi
tr "A-Z" "a-z" < $CONFIG| while read line; do sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' < $CONFIG| while read line; do
case $line in case $line in
\#*) ;; \#*) ;;
*) *)

Loading…
Cancel
Save