constantin-net

netmenu_setup_iface

Sep 17th, 2020
977
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #ethernet not wifi
  3. [ -z "$1" -o -z "$2" ] && echo "iface method" && exit 0
  4. if [[ -z `cat /etc/network/interfaces | grep $1` || "$2" != "manual" ]]; then
  5.   dhclient -x
  6.   dhclient $1
  7. fi
  8. sed -i -r  "s/iface $1.*$/iface $1 inet $2/" /etc/network/interfaces
  9. sed -i -r  "/iface $1/!b;:x;n;s/^./#\0/;/^$/b;bx" /etc/network/interfaces
  10. ifdown $1
  11. ifup $1
RAW Paste Data