Files
2026-09-14 12:43:38 +02:00

21 lines
495 B
Bash
Executable File

#!/bin/bash
if [ "$1" != "wlan0" ] && [ "$1" != "eth0" ]; then
printf "Wrong Interface, \$1 must be eth0 or wlan0\n";
exit 0
fi
if [ "$(whoami)" != "root" ]; then
printf "Script must be executed as root\n"
exit 0
fi
if [ "$(/sbin/ifconfig | grep eth0)" != "" ]; then
ifdown eth0
fi
if [ "$(/sbin/ifconfig | grep wlan0)" != "" ]; then
ifdown wlan0
fi
cp /etc/network/interfaces.$1 /etc/network/interfaces
ifup $1
/sbin/ifconfig
printf "Network interface has been changed to %s\n" "$1"