EDIT BEGINS (20, July 2015 13:36 [IST]):
Thanks to PackRat I've made some critical changes to the script. Thanks again PackRat!
EDIT ENDS :
VastOne has already decided the vsido-start script but I've spent a good deal of sunday afternoon on this one so here is a different version of vsido-start. I want to thank relentless ratman PackRat for his suggestions,ideas and testing.
This vsido-start script once launched works like this,
* Presents user with the information written by VastOne and gives option of launching either Ceni or Wicd.
* If user selects Ceni, then the script will check the running status of Wicd and if it is running then the script offers option to stop Wicd or keep it running, Next the script checks if Wicd is autostarting or not, If Wicd is enabled to autostart then the script will offer option to disable it or keep it enabled, And finally the script will launch Ceni.
* If user selects Wicd, then the script will check the running status of Wicd service, If the Wicd service is dead then the script will start the Wicd service, Next the script checks if Wicd is autostarting or not. If Wicd is disabled from autostarting then the script will enable Wicd autostart, And finally the script will launch Wicd GTK interface.
Here is the script,
#!/bin/bash
testyad=`which yad`
if [ "$testyad" = "" ]; then
sudo apt-get -y -q install yad
fi
if [ "$testyad" != "" ]; then
DIALOGMENU="`which yad` --window-icon=vsido-start --width=420 --height=393 --center"
DIALOG="`which yad` --window-icon=vsido-start --width=420 --height=393 --center"
TITLE="--always-print-result --dialog-sep --image=vsido-start --title="
TEXT="--text="
ENTRY="--entry "
ENTRYTEXT="--entry-text "
MENU="--list --expand-column=0 --column=Pick --column=Info"
YESNO=" --button=Yes:0 --button=No:1 "
MSGBOX=" --button=Ok:0 "
TITLETEXT="Vsido Message Center"
fi
mainmenu () {
CHOICES=`$DIALOGMENU $TITLE"$TITLETEXT" --button=Ok:0 --button=Exit:1 $MENU $TEXT"Welcome to VSIDO. Due to changes from Debian, systemd and udev, it is not possible to see every Network Interface that systemd/udev now creates.
It is recommended that you run Ceni or WICD to establish your network before you begin. Ceni is a Curses user interface for configuring network interfaces with ifupdown developed by Kel Modderman and used for setting up networks on several distros. You can also select and use the WICD GUI that has more robust WIFI connectivity options.
Simply select your Network Interface and then Accept-Enter and finally Yes to exit Ceni. Your network is then ready to go and connectivity to the Internet established.
Please select an option:
" \
Ceni "Run Ceni" \
Wicd "Run Wicd"`
if [ "$?" = "0" ]; then
CHOICE=`echo $CHOICES | cut -d "|" -f 1`
else
exit 0
fi
if [ "$CHOICE" = "Ceni" ]; then
cenimenu
elif [ "$CHOICE" = "Wicd" ]; then
wicdmenu
else
exit 0
fi
}
cenimenu () {
wistatus=$(sudo systemctl status wicd | grep "dead")
wiboot=$(sudo systemctl status wicd | grep "disabled")
if [[ -z "$wistatus" ]]; then
CHOICES=`$DIALOGMENU $TITLE"$TITLETEXT" --button=Ok:0 --button=Exit:1 $MENU $TEXT"You have decided to use Ceni. Wicd is no longer needed. Stop Wicd?
" \
Stop "Stop Wicd" \
Cancel "Leave Wicd Running"`
if [ "$?" = "0" ]; then
CHOICE=`echo $CHOICES | cut -d "|" -f 1`
else
exit 0
fi
if [ "$CHOICE" = "Stop" ]; then
sudo systemctl stop wicd
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd service has been stopped. \nClick OK to proceed."
fi
if [ "$CHOICE" = "Cancel" ]; then
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd service is kept running. \nClick OK to proceed."
fi
fi
if [[ -z "$wiboot" ]]; then
CHOICES=`$DIALOGMENU $TITLE"$TITLETEXT" --button=Ok:0 --button=Exit:1 $MENU $TEXT"You have decided to use Ceni. Would you like to disable Wicd from autostarting?
" \
Disable "Disable Wicd Autostart" \
Cancel "Keep Wicd Autostart Enabled"`
if [ "$?" = "0" ]; then
CHOICE=`echo $CHOICES | cut -d "|" -f 1`
else
exit 0
fi
if [ "$CHOICE" = "Disable" ]; then
sudo systemctl disable wicd
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd autostart has been disabled. \nClick OK to proceed."
xfce4-terminal -e 'sudo ceni'
fi
if [ "$CHOICE" = "Cancel" ]; then
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd autostart is kept enabled. \nClick OK to proceed."
xfce4-terminal -e 'sudo ceni'
fi
else
xfce4-terminal -e 'sudo ceni'
fi
exit 0
}
wicdmenu () {
wistatus=$(sudo systemctl status wicd | grep "dead")
wiboot=$(sudo systemctl status wicd | grep "disabled")
if [[ -n "$wistatus" ]]; then
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd service is not running. \nClick OK to start Wicd."
sudo systemctl start wicd
fi
if [[ -n "$wiboot" ]]; then
$DIALOG $TITLE"Vsido Mesage Center" $MSGBOX $TEXT"Wicd service is disabled from autostarting. \nClick OK to autostart Wicd."
sudo systemctl enable wicd
wicd-gtk --no-tray
else
wicd-gtk --no-tray
fi
exit 0
}
mainmenu
Waiting for the views-reviews especially from VastOne and PackRat.
Cheers!!!