X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=functions.sh;h=6e01cfdc96afc1fbf108ccb521c7a25d706312aa;hb=9296da3744288c65bbf1eba3c1805023918dcfed;hp=8c2ec0005b3bfe9763c8df88ed0ebe83535abd44;hpb=ee4b21b73a51233003fbbe3d8acd68c9398f6dd9;p=carnet-tools-cn.git diff --git a/functions.sh b/functions.sh index 8c2ec00..6e01cfd 100644 --- a/functions.sh +++ b/functions.sh @@ -7,14 +7,14 @@ cp_get_ifaddr() { [ -z "$interface" ] && interface=lo if ! ifconfig $interface 2> /dev/null >> /dev/null; then - [ -z "$CP_ECHO_RETURN" ] || echo "cp_get_ifaddr: $interface: No such interface" + echo "cp_get_ifaddr: $interface: No such interface" 1>&2 return 1 fi ifaddr="`/sbin/ifconfig $interface | awk '/inet/{ printf("%s\n",substr($2,index($2,":")+1)) }'`" if [ -z $ifaddr ]; then - [ -z "$CP_ECHO_RETURN" ] || echo "cp_get_ifaddr: $interface: No such ipaddress" + echo "cp_get_ifaddr: $interface: No such ipaddress" 1>&2 return 1 fi @@ -31,14 +31,14 @@ cp_get_ifmask() { [ -z "$interface" ] && interface=lo if ! ifconfig $interface 2> /dev/null >> /dev/null; then - [ -z "$CP_ECHO_RETURN" ] || echo "cp_get_ifmask: $interface: No such interface" + echo "cp_get_ifmask: $interface: No such interface" 1>&2 return 1 fi ifmask="`/sbin/ifconfig $interface | awk '/Mask/{if($3~/Mask/)a=$3;else if ($4~/Mask/)a=$4;printf ("%s\n", substr(a,index(a,":")+1))}'`" if [ -z "$ifmask" ]; then - [ -z "$CP_ECHO_RETURN" ] || echo "cp_get_ifmask: $interface: No such netmask" + echo "cp_get_ifmask: $interface: No such netmask" 1>&2 return 1 fi @@ -61,7 +61,7 @@ cp_get_ifdefault() { } # by ico, Tue, 15 Mar 2005 14:04:21 +0100 -cp_get_cidr() { +cp_get_netaddr() { [ "$CP_SCRIPT_DEBUG" ] && set -vx local netmask ipaddress interface cidr echo_return echo_return="$CP_ECHO_RETURN" # since we're making our own calls @@ -77,20 +77,20 @@ cp_get_cidr() { fi if ! ifconfig $interface 2> /dev/null >> /dev/null; then - [ "$CP_VERBOSE" ] || echo "cp_get_cidr: $interface: No such interface" + echo "cp_get_netaddr: $interface: No such interface" 1>&2 goto return1 fi cp_get_ifaddr "$interface" ipaddress="$RET" if [ -z $ipaddress ]; then - [ "$CP_VERBOSE" ] || echo "cp_get_cidr: $interface: No such ipaddress" + echo "cp_get_netaddr: $interface: No such ipaddress" 1>&2 goto return1 fi cp_get_ifmask "$interface" netmask="$RET" if [ -z $netmask ]; then - [ "$CP_VERBOSE" ] || echo "cp_get_cidr: $interface: No such netmask" + echo "cp_get_netaddr: $interface: No such netmask" 1>&2 fi if [ "$netmask" = "255.255.255.255" ]; then @@ -111,15 +111,15 @@ cp_get_cidr() { # by ico, Tue, 15 Mar 2005 14:04:21 +0100 cp_backup_conffile() { - [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx + [ "$CP_SCRIPT_DEBUG" ] && set -vx local file_bak if [ -z $1 ]; then - [ -z "$CP_ECHO_RETURN" ] || echo "Usage: cp_backup_conffile " + echo "Usage: cp_backup_conffile " 1>&2 return 1 fi if [ ! -f $1 ]; then - [ -z "$CP_ECHO_RETURN" ] || echo "cp_backup_conffile: $1: No such file" + echo "cp_backup_conffile: $1: No such file" 1>&2 return 1 fi