(SOLVED) Yad startup script for ceni

hakerdefo

#30
PackRat thanks for testing. Please run the following command first and then retest the script,
sudo rm /etc/wicd/*.conf
Cheers!!!
You Can't Always Git What You Want

PackRat

#31
No change - did manage to get wicd purged and re-installed so it is working.

There is an error message in the terminal before it quite - something about a non-native systemd service(?).

systemctl list-units | grep wicd

does list a wicd.service

Any idea what log, if any, would have that error?
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

Thanks there PackRat. I'll need your help here. I want you to run following commands in the exact order and observe their outcome.
First just check if wicd is running or not,

sudo systemctl status wicd

If wicd is running then try to stop it,

sudo systemctl stop wicd

And then try and start wicd,

sudo systemctl start wicd

Try and run the GTK client,

wicd-gtk

Next check if it is enabled to startup at boot,

sudo systemctl is-enabled wicd

If it is not then try and make it autostart with system,

sudo systemctl enable wicd

Reboot and check if wicd has started and whether the wicd-gtk is running in the tint2 tray.
Thanks in advance PackRat!
Cheers!!!
You Can't Always Git What You Want

PackRat

#33
No error messages.

Wicd is enabled and running so all the commands are working like they are supposed to. It's actually how I manage my wireless on the laptop now. The tray applet doesn't show up in the system tray unless -

wicd-gtk --tray

is in an autostart file. I don't have that in my ~/.fluxbox/startup; it's mainly for those that regularly roam between networks.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

Thanks for testing them out! Then why the same commands are failing in the script? Well another puzzle! Any ideas?
You Can't Always Git What You Want

PackRat

No specific ideas. But I did change the wicd command to:

Run_Wicd*) cmd="xfce4-terminal -e 'sudo htop' && xfce4-terminal -e 'sudo ps_mem' && wicd-gtk" ;;

and I did get an instance of xfce4-terminal with htop running after entering my password. The second xfce4-terminal did not start.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

#36
I finally figured out the failures with the button style I wanted and now have it working... It was all in the single [ ] brackets

Once I changed to double brackets and added the ret=$? variables, everything fell into place...

This script has  been tested on new installs and all works as it should and everything exits as it should

This will be the final vsido-start script and will be on the next ISO's

vsido-start (must be made executable)

#! /bin/bash

# Greeting window
action=$(yad --title="VSIDO Messge Center" \
--width=420 \
--image=vsido-start \
--button=$"Run Ceni        :1" \
--button=$"Run WICD        :2" \
--button=$"Close           :3" \
--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
${custom_text}" \ )

ret=$?

[[ $ret -eq 3 ]] && exit 0


if [[ $ret -eq 1 ]] ; then
xfce4-terminal -e ceni
exit 0
fi

if [[ $ret -eq 2 ]] ; then
wicd-gtk -n
exit 0
fi
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

A new install of VSIDO x32 uses 84 MiB on boot even with wicd services running...

Just a tidbit of info...

BTW, I have always removed and purge wicd as a first step on any distro I used that had it

Including VSIDO...  :P
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

I want to say Thank You to everyone who helped with this script

VSIDO      VSIDO Change Blog    

    I dev VSIDO

hakerdefo

#39
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!!!
You Can't Always Git What You Want

PackRat

The wicd selection is working.

The ceni selection goes through the wicd options, then fails to start ceni.

This command:

xfce4-terminal -e sudo ceni

yields the error message "unknown option "ceni"

In a terminal, this will start ceni

xfce4-terminal -e 'sudo ceni'

I made the changes in the script and ceni will start; I don't know if that is the proper syntax for your script though.

Well done.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

PackRat you are being too modest here! That little change is critical! Actually I tested the script on Sakura terminal and it didn't complain about anything but it seems xfce4 terminal has it's own ways to handle commands.
Thanks again from the bottom of my heart, really! Without your testing and support nothing would have been possible!
Cheers to you PackRat  8)
You Can't Always Git What You Want

hakerdefo

Taking cues from VastOne. This one is for PackRat,

You Can't Always Git What You Want

PackRat

@hackerdefo -

no problem.

nice to see sakura getting some love; nice terminal app that flies under the radar.

As a test, I changed:

xfce4-terminal -e 'sudo ceni'

to

xterm -fa fixed-11 -e sudo ceni

and it works - that should make it disto agnostic for any non-vsido users who are lurking about.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

'xterm -fa fixed-11 -e'
I didn't know about this one! This is great for scripting! Thanks a metric ton for this tip PackRat!
Cheers!!!
You Can't Always Git What You Want