123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- #!/bin/sh
- #(c) Copyright 2010 Barry Kauler bkhome.org
- #Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt)
- #called from 'connectwizard'
- #choose between old Network Wizard, new Network Wizard and Pwireless2.
- #100227 BK initial creation of script.
- #100306 added Barry's Simple Network Setup. 100810 moved SNS to top choice, improved messages.
- #120201 rodin.s: internationalized.
- #121029 01micko, rerwin: added/integrated Frisbee.
- #121122 rerwin: change indicator of frisbee; ensure frisbee stopped if not chosen.
- #130103 rerwin: change name of frisbee invocations for integrated version.
- #131216 zigbert: gui (gtkdialog) improvements.
- export TEXTDOMAIN=connectwizard_2nd
- export TEXTDOMAINDIR=/usr/share/locale
- export OUTPUT_CHARSET=UTF-8
- . gettext.sh
- export LANGORG=$LANG
- /usr/lib/gtkdialog/svg_text "Simple Network Setup" > /tmp/network_connection_wizard_1.svg
- /usr/lib/gtkdialog/svg_text "Pwireless2" > /tmp/network_connection_wizard_2.svg
- /usr/lib/gtkdialog/svg_text "Frisbee" > /tmp/network_connection_wizard_3.svg
- /usr/lib/gtkdialog/svg_text "Network Wizard" > /tmp/network_connection_wizard_4.svg
- /usr/lib/gtkdialog/svg_text "Network Wizard (classic)" > /tmp/network_connection_wizard_5.svg
- #100306
- SNS=""
- if [ -d /usr/local/simple_network_setup ];then
- SNS='
- <vbox>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon /tmp/network_connection_wizard_1.svg`"'
- <action type="exit">FLAGSNS</action>
- </button>
- <hbox space-expand="true" space-fill="true">
- <text width-request="10" space-expand="false" space-fill="false"><label>""</label></text>
- <text use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext 'This is a simple network setup tool created by BarryK. Not as many features as the Network Wizard, for example requires the network to have a DHCP server (the vast majority of cases). The greatest feature is extreme ease of use. <b>Recommended for most people.</b>')'"</label></text>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </vbox>'
- fi
- PWIRELESS=""
- if [ -d /usr/local/Pwireless2 ];then #Jemimah's wireless connection gui.
- PWIRELESS='
- <vbox>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon /tmp/network_connection_wizard_2.svg`"'
- <action type="exit">FLAGPWIRELESS</action>
- </button>
- <hbox space-expand="true" space-fill="true">
- <text width-request="10" space-expand="false" space-fill="false"><label>""</label></text>
- <text use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext 'This is a tool developed by Jemimah. Mostly for wireless connectivity for laptops, but also can handle ethernet connection. Very good for wireless roaming. Under very active development (see forum).')'"</label></text>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </vbox>'
- fi
- FRISBEE="" #121029...
- if [ -f /usr/local/bin/frisbee ];then #Jemimah's wireless connection gui. 121122 130103
- FRISBEE='
- <vbox>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon /tmp/network_connection_wizard_3.svg`"'
- <action type="exit">FLAGFRISBEE</action>
- </button>
- <hbox space-expand="true" space-fill="true">
- <text width-request="10" space-expand="false" space-fill="false"><label>""</label></text>
- <text use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext 'This is a tool developed by Jemimah. Mostly for wireless connectivity for laptops, but also can handle ethernet connection. <b>Very good for wireless roaming.</b>')'"</label></text>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </vbox>'
- fi
- NETWIZARD=""
- if [ -f /usr/sbin/net-setup.sh ];then #wizard developed by Dougal.
- NETWIZARD='
- <vbox>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon /tmp/network_connection_wizard_4.svg`"'
- <action type="exit">FLAGNETWIZARD</action>
- </button>
- <hbox space-expand="true" space-fill="true">
- <text width-request="10" space-expand="false" space-fill="false"><label>""</label></text>
- <text use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext "This is the most sophisticated tool for network setup in Puppy. It is based on the 'Classic' Network Wizard originally written by BarryK, but greatly enhanced by Dougal, Rarsa, Shinobar and others. It is for both wired (ethernet) and wireless connectivity, <b>with more configuration features</b> than Frisbee and SNS.")'"</label></text>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </vbox>'
- fi
- NETWIZCLASSIC=""
- if [ -f /usr/local/net_setup/usr/sbin/net-setup.sh ];then #wizard used in older puppies.
- NETWIZCLASSIC='
- <vbox>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon /tmp/network_connection_wizard_5.svg`"'
- <action type="exit">FLAGNETWIZCLASSIC</action>
- </button>
- <hbox space-expand="true" space-fill="true">
- <text width-request="10" space-expand="false" space-fill="false"><label>""</label></text>
- <text use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext "The Network Wizard was originally developed by Barry Kauler, with considerable input from others.")'"</label></text>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- </vbox>'
- fi
- export Network_Connection_Wizard='
- <window title="'$(gettext 'Network Connection Wizard')'" icon-name="gtk-connect">
- <vbox space-expand="true" space-fill="true">
- '"`/usr/lib/gtkdialog/xml_info fixed network_connect.svg 60 "$(gettext 'This build of Puppy has the following choices of GUI tool that you can use to connect to a network (and Internet)...')"`"'
- <vbox space-expand="true" space-fill="true">
- <frame>
- '${SNS}'
- '${PWIRELESS}'
- '${FRISBEE}'
- '${NETWIZARD}'
- '${NETWIZCLASSIC}'
- </frame>
- </vbox>
- <hbox space-expand="false" space-fill="false">
- <button space-expand="false" space-fill="false">
- <label>'$(gettext "Cancel")'</label>
- '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
- <action>exit:Cancel</action>
- </button>
- </hbox>
- </vbox>
- </window>'
- . /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
- RETSTRING="`gtkdialog -p Network_Connection_Wizard`"
- if [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'FLAG'`" != "" ];then
- CHOSENWIZ="`echo "$RETSTRING" | grep '^EXIT' | grep 'FLAG' | cut -f 2 -d '"'`"
- if [ "$FRISBEE" ];then #130103...
- [ "$CHOSENWIZ" != "FLAGFRISBEE" ] && frisbee_mode_disable
- fi
- case $CHOSENWIZ in
- FLAGPWIRELESS) #Pwireless2
- chmod 755 /etc/init.d/Pwireless2 #100304
- /etc/init.d/Pwireless2 start #100304
- /usr/local/bin/Pwireless2 > /dev/null 2>&1
- NWEXEC='Pwireless2'
- NWCHOICE="Jemimah's Pwireless2"
- ;;
- FLAGFRISBEE) #121029
- /usr/local/bin/frisbee > /dev/null 2>&1 #130103
- NWEXEC='frisbee' #130103
- NWCHOICE="Jemimah's Frisbee"
- ;;
- FLAGNETWIZARD) #net-setup.sh
- /usr/sbin/net-setup.sh > /dev/null 2>&1
- NWEXEC='net-setup.sh'
- NWCHOICE="Dougal's Network Wizard"
- ;;
- FLAGNETWIZCLASSIC) #net_wiz_classic
- /usr/sbin/net_wiz_classic > /dev/null 2>&1
- NWEXEC='net_wiz_classic'
- NWCHOICE="Barry's Network Wizard Classic"
- ;;
- FLAGSNS)
- /usr/sbin/sns
- NWEXEC='sns'
- NWCHOICE="Barry's Simple Network Setup"
- ;;
- esac
-
- IFSUP="`ifconfig | grep -E '^eth|^wlan'`"
- if [ "$IFSUP" != "" ];then
- IFSUP="`echo "$IFSUP" | cut -f 1 -d ' ' | tr '\n' ' '`"
- MSG1="$(gettext 'These interfaces are active:')
- <b>${IFSUP}</b>
- `gettext \"...Satisfied? Got online ok? If yes, click <u>Set as default</u> button, so Puppy will be optimised to use this tool for future boots.\"`"
- else
- MSG1="`gettext \"No interfaces are active, so was the tool unsatisfactory? If it actually was ok, click the <u>Set as default</u> button. But, it seems not, so...\"`"
- fi
-
- CURREXEC="`cat /usr/local/bin/defaultconnect | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
- [ "`grep 'gprs' /usr/local/bin/defaultconnect`" != "" ] && CURREXEC='pgprs-connect'
- [ "$CURREXEC" = "gkdial" ] && CURREXEC="pupdial" #for older pups.
- case $CURREXEC in
- Pwireless2)
- CURRCHOICE="Jemimah's Pwireless2"
- ;;
- frisbee) #121029 130103
- CURRCHOICE="Jemimah's Frisbee"
- ;;
- net-setup.sh)
- CURRCHOICE="Dougal's Network Wizard"
- ;;
- net_wiz_classic)
- CURRCHOICE="Barry's Network Wizard Classic"
- ;;
- sns)
- CURRCHOICE="Barry's Simple Network Setup"
- ;;
- *)
- CURRCHOICE="${CURREXEC}"
- ;;
- esac
- [ "$NWEXEC" = "$CURREXEC" ] && exit
- # <text><label>Note, the current default network tool is '${CURRCHOICE}'.</label></text>
- export Network_Connection_Wizard='
- <window title="'$(gettext 'Network Connection Wizard')'" icon-name="gtk-connect">
- <vbox space-expand="true" space-fill="true">
- '"`/usr/lib/gtkdialog/xml_info fixed network_connect.svg 60 "$(gettext 'You have finished running')" "<b>${NWCHOICE}</b>"`"'
- <vbox space-expand="true" space-fill="true">
- <frame>
- '"`/usr/lib/gtkdialog/xml_pixmap dialog-question.svg popup`"'
- <text use-markup="true"><label>"'${MSG1}'
- <u>'$(gettext "Try a different tool")'</u> '$(gettext "if you would like to try one of the other network setup tools...")'"</label></text>
- </frame>
- <hbox space-expand="false" space-fill="false">
- <button space-expand="false" space-fill="false">
- '"`/usr/lib/gtkdialog/xml_button-icon refresh`"'
- <label>'$(gettext 'Try a different tool')'</label>
- <action type="exit">FLAGTRYDIFF</action>
- </button>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <button space-expand="false" space-fill="false">
- <label>'$(gettext "Cancel")'</label>
- '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
- <action>exit:Cancel</action>
- </button>
- <button>
- '"`/usr/lib/gtkdialog/xml_button-icon apply`"'
- <label>'$(gettext 'Set as default')'</label>
- <action type="exit">FLAGYES</action>
- </button>
- </hbox>
- </vbox>
- </vbox>
- </window>'
- RETSTRING="`gtkdialog -p Network_Connection_Wizard --center`"
- if [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'FLAG'`" != "" ];then
- CHOSENACTION="`echo "$RETSTRING" | grep '^EXIT' | grep 'FLAG' | cut -f 2 -d '"'`" #'geany
- case $CHOSENACTION in
- FLAGYES)
- echo -e "#!/bin/sh\nexec ${NWEXEC}" > /usr/local/bin/defaultconnect
- echo "<b>${NWCHOICE} $(gettext "now set as default network tool.</b>
- Here are some technical notes that you might find useful:
- The default network tool is specified in file /usr/local/bin/defaultconnect, and if you were to look in that file now you will see that it contains '${NWEXEC}'. If you ever wanted to manually change that back to the original setting, you could edit the file and in place of '${NWEXEC}' put 'connectwizard'.
- If you click on the 'connect' icon on the desktop, it will directly start the '${NWEXEC}' tool. In fact, it starts whatever has been specified in /usr/local/bin/defaultconnect. You can right-click on the 'connect' icon for a menu with other run options.
- <b>Geek stuff</b>: If you really want to know in-depth about the inner workings, specifically how the default tool is activated at bootup, look in /etc/rc.d/rc.sysinit. Two other relevant scripts are /usr/sbin/connectwizard and /usr/sbin/connectwizard_2nd.")" > /tmp/box_help
- /usr/lib/gtkdialog/box_help "$(gettext 'Network Connection Wizard')" info.svg &
- ;;
- FLAGTRYDIFF)
- echo -e '#!/bin/sh\nexec connectwizard' > /usr/local/bin/defaultconnect
- exec connectwizard
- ;;
- esac
- fi
-
- fi
- ###END###
|