home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / connectwizard < prev    next >
Encoding:
Text File  |  2006-07-08  |  3.1 KB  |  113 lines

  1. #!/bin/sh
  2. #Barry Kauler www.puppyos.com
  3.  
  4. DEFAULTCONNECT="`cat /usr/local/bin/defaultconnect | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
  5. #radiobuttons...
  6. DEFGNOMEPPP="no"
  7. DEFGKDIAL="no"
  8. DEFPPPOE="no"
  9. DEFICW="no"
  10. case $DEFAULTCONNECT in
  11.  gnome-ppp)
  12.   DEFGNOMEPPP="yes"
  13.   ;;
  14.  gkdial)
  15.   DEFGKDIAL="yes"
  16.   ;;
  17.  tkpppoe)
  18.   DEFPPPOE="yes"
  19.   ;;
  20.  *)
  21.   DEFICW="yes"
  22.   ;;
  23. esac
  24.  
  25. MSGMODEM="coming soon..."
  26. if [ -e /dev/modem ];then
  27.  DEVMODEM="`readlink /dev/modem`"
  28.  MSGMODEM="A modem is detected at $DEVMODEM"
  29. fi
  30.  
  31. FLAGGNOMEPPP=""
  32. if [ ! "`which gnome-ppp`" = "" ];then
  33.  FLAGGNOMEPPP="<radiobutton><label>GnomePPP (modem dialup)</label><variable>RADIOGNOMEPPP</variable><default>$DEFGNOMEPPP</default></radiobutton>"
  34. fi
  35.  
  36. WizardWizard="
  37.  <wtitle>Internet Connection Wizard</wtitle>
  38.  <vbox>
  39.  <frame Current setup/status>
  40.    <text>
  41.     <label>$MSGMODEM</label>
  42.    </text>
  43.  </frame>
  44.  <frame Connect>
  45.   <hbox>
  46.    <text>
  47.     <label>Connect to Internet by dialup analog modem...</label>
  48.    </text>
  49.    <button>
  50.     <input file>/usr/local/lib/X11/mini-icons/wizard16.xpm</input>
  51.     <action>/usr/sbin/modem-wizard</action>
  52.     <action>/usr/local/bin/gkdial &</action>
  53.     <action>exit</action>
  54.    </button>
  55.   </hbox>
  56.   <hbox>
  57.    <text>
  58.     <label>Connect to Internet by wired ethernet interface...</label>
  59.    </text>
  60.    <button>
  61.     <input file>/usr/local/lib/X11/mini-icons/wizard16.xpm</input>
  62.     <action>/usr/sbin/net-setup.sh &</action>
  63.     <action>exit</action>
  64.    </button>
  65.   </hbox>
  66.   <hbox>
  67.    <text>
  68.     <label>Connect to Internet by wireless interface...</label>
  69.    </text>
  70.    <button>
  71.     <input file>/usr/local/lib/X11/mini-icons/wizard16.xpm</input>
  72.     <action>/usr/sbin/wirelesswizard &</action>
  73.     <action>exit</action>
  74.    </button>
  75.   </hbox>
  76.  </frame>
  77.  <frame Tools>
  78.   <hbox>
  79.    <text>
  80.     <label>Setup a firewall...</label>
  81.    </text>
  82.    <button>
  83.     <input file>/usr/local/lib/X11/mini-icons/wizard16.xpm</input>
  84.     <action>rxvt -e /usr/sbin/firewallinstallshell &</action>
  85.     <action>exit</action>
  86.    </button>
  87.   </hbox>
  88.  </frame>
  89.  <frame Desktop 'connect' icon>
  90.   <vbox>
  91.    $FLAGGNOMEPPP
  92.    <radiobutton><label>Gkdial (modem dialup)</label><variable>RADIOGKDIAL</variable><default>$DEFGKDIAL</default></radiobutton>
  93.    <radiobutton><label>Roaring Penguin (PPPoE)</label><variable>RADIOPPPOE</variable><default>$DEFPPPOE</default></radiobutton>
  94.    <radiobutton><label>Internet Connection Wizard</label><variable>RADIOICW</variable><default>$DEFICW</default></radiobutton>
  95.   </vbox>
  96.  </frame>
  97.   <hbox>
  98.    <button ok></button>
  99.   </hbox>
  100.  </vbox>
  101. "
  102.  
  103. RETSTR="`echo "$WizardWizard" | gtkdialog2 --stdin`"
  104. #gtkdialog --program=WizardWizard
  105.  
  106. RADIOBUT="`echo "$RETSTR" | grep '^RADIO' | grep '"true"' | cut -f 1 -d '='`"
  107. [ "$RADIOBUT" = "RADIOGNOMEPPP" ] && echo -e '#!/bin/sh\nexec gnomepppshell' > /usr/local/bin/defaultconnect
  108. [ "$RADIOBUT" = "RADIOGKDIAL" ] && echo -e '#!/bin/sh\nexec gkdial' > /usr/local/bin/defaultconnect
  109. [ "$RADIOBUT" = "RADIOPPPOE" ] && echo -e '#!/bin/sh\nexec tkpppoe' > /usr/local/bin/defaultconnect
  110. [ "$RADIOBUT" = "RADIOICW" ] && echo -e '#!/bin/sh\nexec connectwizard' > /usr/local/bin/defaultconnect
  111.  
  112. ###end###
  113.