Advertisement
s243a

saveInterfaceSetup - Network Wizard - Puppylinux

Nov 28th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.58 KB | None | 0 0
  1. saveInterfaceSetup()
  2. {
  3.   INTERFACE="$1"
  4.   # Dougal: use HWaddress for the config files!
  5.   #HWADDRESS=`cat /sys/class/net/$1/address | tr a-z A-Z`
  6.   # need to address from ifconfig, for firewire (/sys.../address gives 24-bit)
  7.   HWADDRESS=$(ifconfig "$1" | grep "^$1" | tr -s ' ' | cut -d' ' -f5)
  8.  
  9. # create config file
  10.  
  11.   #if [ -e "/tmp/wireless-config" ] ; then
  12.   if checkIfIsWireless "$INTERFACE" ; then
  13.     # Dougal: only need to do this once
  14.     if [ ! -s "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf" ] ; then
  15.       #cp -a /tmp/wireless-config "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf"
  16.       echo -e "INT_WPA_DRV='$PROFILE_WPA_DRV'\nUSE_WLAN_NG='$USE_WLAN_NG'" > ${WLAN_INTERFACES_DIR}/$HWADDRESS.conf
  17.     fi
  18.     # create interface config file
  19.     echo "IS_WIRELESS='$IS_WIRELESS'" > ${NETWORK_INTERFACES_DIR}/$HWADDRESS.conf
  20.     # Dougal: add info for static ip to profile, in case we use it
  21.     # (note that -- currently at least -- that's the only use for MODECOMMANDS)
  22.     #### (I am assuming the profile variable is still set...)
  23.     # Need to clean up old info before adding new (pointed out by PaulBx1)
  24.     sed -i '/^STATIC_IP=.*/d ; /^IP_ADDRESS=.*/d ; /^NETMASK=.*/d ; /DNS_SERVER^.*/d ; /^GATEWAY=.*/d ' "${PROFILES_DIR}/${PROFILE_AP_MAC}.${PROFILE_ENCRYPTION}.conf"
  25.     echo -e "${MODECOMMANDS}" >>"${PROFILES_DIR}/${PROFILE_AP_MAC}.${PROFILE_ENCRYPTION}.conf"
  26.   else
  27.     #echo -e "${MODECOMMANDS}" > /etc/${INTERFACE}mode
  28.     # Dougal: maybe append? in case used both for dhcp and static.
  29.     echo -e "${MODECOMMANDS}\nIS_WIRELESS=''" > ${NETWORK_INTERFACES_DIR}/$HWADDRESS.conf
  30.   fi
  31.  
  32. } # end saveInterfaceSetup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement