Check-in [76ff3102e9]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:76ff3102e9591427e9f822b3c3b2a129c3cd9892
Date: 2012-05-05 10:21:23
User: BarryK
Comment:new script /usr/sbin/network_default_connect, will auto-reconnect when X restarted. used in conjunction with hostname-set

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/etc/rc.d/rc.sysinit

@@ -650,10 +650,11 @@
  for ONECOUNT in sns/r sns/t pupdial/isp1/r pupdial/isp1/t pupdial/isp2/r pupdial/isp2/t;do
   echo -n 0 > /var/local/${ONECOUNT}x_bytes_month
  done
 fi
 
+#120505 ***NOTE: this code block extracted to /usr/sbin/network_default_connect. in future could delete it here and call that script.***
 #100227 choose default network tool...
 DEFAULTCONNECT="`cat /usr/local/bin/defaultconnect | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
 [ "`grep 'gprs' /usr/local/bin/defaultconnect`" != "" ] && DEFAULTCONNECT='pgprs-connect'
 [ "$DEFAULTCONNECT" = "gkdial" ] && DEFAULTCONNECT="pupdial" #for older pups.
 NETCHOICE="$DEFAULTCONNECT"	#101007 shinobar

Changes to woof-code/rootfs-skeleton/usr/bin/xwin

@@ -27,10 +27,11 @@
 #110721 o/p to /dev/null when modprobe modules that are builtin to kernel.
 #110804 /etc/profile has fix for double-login. need to output '# ' when exit xwin.
 #110807 revert 110804
 #120131 rodin.s: internationalized.
 #120301 load console font on exit from X.
+#120505 automatic network reconnect. refer /usr/sbin/hostname-set
 
 export TEXTDOMAIN=xwin
 export OUTPUT_CHARSET=UTF-8
 eval_gettext () {
   local myMESSAGE=$(gettext "$1")
@@ -53,10 +54,19 @@
 #PUPSFS=puppy.sfs main part of puppy, stored on PDEV1, PUPSAVE=vfat,sda1,/pup_save.3fs
 #PMEDIA is a broad description of the boot media, ex "usbflash" or "idehd".
 . /etc/DISTRO_SPECS #110413
 
 KERNELVER="`uname -r`" #w479
+
+#120505 automatic network reconnect. refer /usr/sbin/hostname-set
+if [ -f /tmp/simple_network_setup/network_default_reconnect_required_flag ];then
+ rm -f /tmp/simple_network_setup/network_default_reconnect_required_flag
+ IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`" #precaution.
+ if [ "$IFCONFIG" = "" ];then
+  network_default_connect #/usr/sbin
+ fi
+fi
 
 #0.9.9 enables to start a specific w.m. from commandline...
 if [ $1 ];then
  echo -n "$1" > /etc/windowmanager
  #note, /root/.xinitrc uses this file.

Changes to woof-code/rootfs-skeleton/usr/sbin/hostname-set

@@ -57,13 +57,17 @@
 
  #120505 when hostname changed, also need to restart network connection...
  IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`"
  if [ "$IFCONFIG" ];then
   networkdisconnect #see /usr/sbin
+  touch /tmp/simple_network_setup/network_default_reconnect_required_flag #/usr/bin/xwin will read this, will call /usr/sbin/network_default_connect
+#  M_h3b="
+#
+#$(gettext '\ZbNOTE:\ZB There did appear to be an active network connection, that has now been disconnected. Restarting the network connection is required to update the hostname on the network. After restarting X, you will have to reconnect -- that can be done by clicking the \Zbconnect\ZB icon on the desktop, or in some cases right-click the \Zbnetwork tray icon\ZB and choose \ZbReconnect\ZB from the menu.')"
   M_h3b="
 
-$(gettext '\ZbNOTE:\ZB There did appear to be an active network connection, that has now been disconnected. Restarting the network connection is required to update the hostname on the network. After restarting X, you will have to reconnect -- that can be done by clicking the \Zbconnect\ZB icon on the desktop, or in some cases right-click the \Zbnetwork tray icon\ZB and choose \ZbReconnect\ZB from the menu.')"
+$(gettext '\ZbNOTE:\ZB There did appear to be an active network connection, that has now been disconnected. Restart of the network is required for the new hostname to take effect over the network. After restarting X, there should be an automatic reconnection -- if not, you can do it manually by clicking the \Zbconnect\ZB icon on the desktop')"
  else
   M_h3b=""
  fi
 
  hostname $NEW_HOSTNAME

Changes to woof-code/rootfs-skeleton/usr/sbin/network_default_connect

@@ -1,1 +1,80 @@
+#!/bin/sh
+#Barry Kauler, May 2012, license GPL3 (ref: /usr/share/doc/legal)
+#this code is taken out of /etc/rc.d/rc.sysinit
+#called from /usr/bin/xwin, if file /tmp/simple_network_setup/network_default_reconnect_required_flag exists.
+#that 'flag' file is created in /usr/sbin/hostname-set, if the hostname was changed and the network connection brought down.
 
+#100227 choose default network tool...
+DEFAULTCONNECT="`cat /usr/local/bin/defaultconnect | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
+[ "`grep 'gprs' /usr/local/bin/defaultconnect`" != "" ] && DEFAULTCONNECT='pgprs-connect'
+[ "$DEFAULTCONNECT" = "gkdial" ] && DEFAULTCONNECT="pupdial" #for older pups.
+NETCHOICE="$DEFAULTCONNECT"	#101007 shinobar
+case $DEFAULTCONNECT in
+ Pwireless2)
+  NETCHOICE='Pwireless2'
+ ;;
+ net-setup.sh)
+  NETCHOICE='net-setup.sh'
+ ;;
+ net_wiz_classic)
+  NETCHOICE='net_wiz_classic'
+ ;;
+ sns)
+  NETCHOICE='sns'
+ ;;
+ connectwizard) #try determine which tool was used to setup networking... 101007
+  if [ -s /etc/simple_network_setup/connections ];then #100306
+   NETCHOICE='sns'
+  else
+   CHECKOLDWIZ="`ls -1 /etc/*[0-9]mode 2>/dev/null`" #ex: eth0mode, wlan0mode.
+   if [ "$CHECKOLDWIZ" != "" -a -d /usr/local/net_setup ];then
+    NETCHOICE='net_wiz_classic'
+   else
+    CHECKNEWWIZ="`ls -1 /etc/network-wizard/network/interfaces 2>/dev/null`"
+    if [ "$CHECKNEWWIZ" != "" ];then
+     NETCHOICE='net-setup.sh'
+    else
+     [ -f /usr/local/Pwireless2/interface ] && NETCHOICE='Pwireless2' #100304
+    fi
+   fi
+  fi
+ ;;
+esac
+[ -f /etc/init.d/Pwireless2 ] && chmod 644 /etc/init.d/Pwireless2 #prevent jemimah's script from running. 100304 100513
+case $NETCHOICE in
+ Pwireless2)
+  #this only sets up interface 'lo'...
+  /etc/rc.d/rc.network_basic
+  #jemimah's script is in /etc/init.d/Pwireless2
+  chmod 755 /etc/init.d/Pwireless2 #make executable so it will run.
+  #i want to run it right now, as a separate process (rc.services will ignore it)...
+  /etc/init.d/Pwireless2 start &
+ ;;
+ net-setup.sh)
+  /etc/rc.d/rc.network &
+ ;;
+ net_wiz_classic)
+  #note, old wizard is located in /usr/local/net_setup.
+  /usr/local/net_setup/etc/rc.d/rc.network &
+ ;;
+ sns) #100306
+  /etc/rc.d/rc.network_basic #this only sets up interface 'lo'.
+  /usr/local/simple_network_setup/rc.network &
+ ;;
+ connectwizard) #101007 shinobar
+  #100628 shinobar: launch rc.network if eth0 is usable
+  RCNETWORK=/etc/rc.d/rc.network_basic #this only sets up interface 'lo'.
+  # eth0 usable?
+  if /sbin/ifconfig eth0 &>/dev/null ;then
+    if [ -x /etc/rc.d/rc.network ]; then
+      RCNETWORK=/etc/rc.d/rc.network
+    elif [ -e /etc/init.d/Pwireless2 ]; then
+      chmod 755 /etc/init.d/Pwireless2
+    fi
+  fi
+  $RCNETWORK &
+ ;;
+ *) #101007 shinobar
+   /etc/rc.d/rc.network_basic &
+ ;;
+esac