[debian-edu-commits] [Git][debian-edu/debian-edu-config][mr/drop-net-tools] 8 commits: debian/control: Depend on iproute2

Daniel Teichmann (@dzatoah) gitlab at salsa.debian.org
Wed Aug 19 14:38:59 BST 2026



Daniel Teichmann pushed to branch mr/drop-net-tools at Debian Edu / debian-edu-config


Commits:
590d32ae by Daniel Teichmann at 2026-08-19T15:38:47+02:00
debian/control: Depend on iproute2

- - - - -
1332ed11 by Mike Gabriel at 2026-08-19T15:38:47+02:00
sbin/update-hostname-from-ip: white-space cleanup

- - - - -
2ee6454f by Mike Gabriel at 2026-08-19T15:38:47+02:00
sbin/update-hostname-from-ip: Stop using net-tools, use ip command from iproute2 instead

- - - - -
f226895b by Daniel Teichmann at 2026-08-19T15:38:47+02:00
testsuite/network: Stop using net-tools, use ip from iproute2 instead

- - - - -
194f4b02 by Daniel Teichmann at 2026-08-19T15:38:47+02:00
ldap-tools/ldap-debian-edu-install: Get MAC addresses via ip link instead of ifconfig

- - - - -
7dbb3d52 by Daniel Teichmann at 2026-08-19T15:38:47+02:00
share/debian-edu-config/testsuite-lib.sh: Use ss instead of netstat

- - - - -
e56def7d by Daniel Teichmann at 2026-08-19T15:38:47+02:00
testsuite/ldap-server: Use ss instead of netstat

- - - - -
3438d290 by Daniel Teichmann at 2026-08-19T15:38:47+02:00
debian/control: Drop Depends: net-tools

- - - - -


6 changed files:

- debian/control
- ldap-tools/ldap-debian-edu-install
- sbin/update-hostname-from-ip
- share/debian-edu-config/testsuite-lib.sh
- testsuite/ldap-server
- testsuite/network


Changes:

=====================================
debian/control
=====================================
@@ -31,6 +31,7 @@ Depends: ${misc:Depends},
          education-tasks,
          fping,
          gnutls-bin,
+         iproute2,
          iptables,
          isenkram-cli,
          ldap-utils,
@@ -50,7 +51,6 @@ Depends: ${misc:Depends},
          lockfile-progs,
          lsb-release,
          media-types,
-         net-tools,
          ng-utils,
          openssl,
          patch,


=====================================
ldap-tools/ldap-debian-edu-install
=====================================
@@ -111,7 +111,7 @@ fi
 ################# password available now ##################
 
 lookup_mac_addrs() {
-    PATH=/sbin:$PATH LANG=C ifconfig 2>/dev/null | grep -i hwaddr | awk '{print $5}' | sort -u
+    LANG=C ip link | awk '/link\/ether/ { print $2 }' | sort -u
 }
 
 slapd_stop() {


=====================================
sbin/update-hostname-from-ip
=====================================
@@ -26,9 +26,9 @@ log() {
 # Generate FQDN based on hardware MAC address
 ether2hostname() {
     if [ "$1" ] ; then
-	mac="$1"
+        mac="$1"
     else
-	mac=$(ifconfig $INTERFACE | awk '/ether/ { print $2; exit}')
+        mac=$(ip addr show ${INTERFACE} | grep 'link/ether ' | awk '{print $2; exit}')
     fi
     # Generate NetBIOS compliant hostname.
     mac=$(echo $mac | sed 's/[^0-9a-f-]//gi')
@@ -42,12 +42,12 @@ ether2hostname() {
 ip2hostname() {
     ip=$1
     host $ip | grep 'domain name pointer' | cut -d ' ' -f 5 | \
-	rev |cut -d '.' -f 2-|rev
+        rev | cut -d '.' -f 2- | rev
 }
 
 PATH="/sbin:$PATH"
 
-INTERFACE="$(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8; exit }')"
+INTERFACE="$(ip -4 route | awk '/^default via / { print $5; exit }')"
 
 if [ -z "$INTERFACE" ] ; then
     INTERFACE=eth0
@@ -57,11 +57,11 @@ sethostname() {
     hostname="$1"
     namesource="$2"
     if hostname $hostname ; then
-	echo $hostname > /etc/hostname
-	log "info: changing hostname to $hostname based on $namesource"
+        echo $hostname > /etc/hostname
+        log "info: changing hostname to $hostname based on $namesource"
     else
-	log "warning: unable to set hostname to $hostname."
-	return -1
+        log "warning: unable to set hostname to $hostname."
+        return -1
     fi
 }
 
@@ -69,15 +69,15 @@ sethostname() {
 TEMP=$(getopt -n update-hostname-from-ip -o dmM:nI:q -- "$@")
 
 # Abort when there was a bug
-[ $? = 0 ] || die "error parsing arguments. Try $0 --help"       
+[ $? = 0 ] || die "error parsing arguments. Try $0 --help"
 
 eval set -- "$TEMP"
-while true; do     
-    case $1 in 
+while true; do
+    case $1 in
         -m)
             USEMAC=true; shift; continue
-            ;;                                    
-        -M)                            
+            ;;
+        -M)
             MAC="$2"; shift; shift; continue
             ;;
         -I)
@@ -102,7 +102,7 @@ done
 
 # Extract current IP if non was provided on the command line
 if [ -z "$IP" ] ; then
-    IP=`ifconfig $INTERFACE 2>&1 |grep 'inet '|tr a-zA-Z: " "|awk '{print $1; exit}'`
+    IP=$(ip addr show ${INTERFACE} | grep 'inet ' | awk '{print $2; exit}' | cut -d "/" -f1)
 fi
 
 if [ "127.0.0.1" = "$IP" ] ; then
@@ -121,7 +121,7 @@ fi
 
 if [ "$MY_HOSTNAME" ]; then
     if $onlyprint ; then
-	echo $MY_HOSTNAME
+        echo $MY_HOSTNAME
     else
         # Already got the correct host name?
         if [ "$MY_HOSTNAME" != "$(uname -n)" ] ; then


=====================================
share/debian-edu-config/testsuite-lib.sh
=====================================
@@ -19,7 +19,8 @@ netstat_check() {
     proto=$2
     service="$3"
 
-    if netstat -a --numeric-hosts 2>&1 | grep ":$port " | grep -q "^$proto" ; then
+    if ss -H -t -u -a 2>&1 | grep ":$port " | grep -q "^$proto" || \
+       ss -H -n -t -u -a 2>&1 | grep ":$port " | grep -q "^$proto" ; then
 	echo "success: $0: $service service is listening on $port/$proto."
 	true
     else


=====================================
testsuite/ldap-server
=====================================
@@ -74,7 +74,7 @@ else
 fi
 
 echo "info: connection per ldap-client"
-netstat -a --numeric-hosts | grep :ldap |
+ss -H -t -u -a | grep :ldap |
     awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n |
     sed "s%^%info: $0: clients: %"
 


=====================================
testsuite/network
=====================================
@@ -14,16 +14,11 @@ if test -r /etc/debian-edu/config ; then
     . /etc/debian-edu/config
 fi
 
-if [ -x /sbin/ifconfig ] ; then
-	/sbin/ifconfig -a | sed "s%^%info: $0: ifconfig: %" || true
+if command -v ip >/dev/null ; then
+	ip addr | sed "s%^%info: $0: ip addr: %" || true
+	ip route | sed "s%^%info: $0: ip route: %" || true
 else
-	error "Unable to find /sbin/ifconfig"
-fi
-
-if [ -x /sbin/route ] ; then
-	/sbin/route -n | sed "s%^%info: $0: route: %" || true
-else
-	error "Unable to find /sbin/route"
+	error "Unable to find ip (iproute2)"
 fi
 
 if [ -x /usr/bin/nmap ] ; then
@@ -65,11 +60,7 @@ fi
 ######################################################################
 
 have_interface() {
-    if /sbin/ifconfig "$1" > /dev/null 2>&1 ; then
-        true
-    else
-        false
-    fi
+    ip link show "$1" > /dev/null 2>&1
 }
 
 for value in `echo $PROFILE |sed 's/ /-/g' | sed 's/,-/ /g'`; do



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/82afdeff528bc3901b58be0739b9559b4b066ec1...3438d290b89aea4b2f222336fdeec3ac49e0695e

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/82afdeff528bc3901b58be0739b9559b4b066ec1...3438d290b89aea4b2f222336fdeec3ac49e0695e
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20260819/2cc70463/attachment-0001.htm>


More information about the debian-edu-commits mailing list