VSIDO Community

VSIDO Controls => VSIDO News & Announcements => Topic started by: VastOne on March 04, 2013, 02:33:19 AM

Title: Update Script - 01MAR2013 15:32 CST ISO
Post by: VastOne on March 04, 2013, 02:33:19 AM
Beginning with this thread, there will be scripts made available that will update users who have already installed VSIDO with the same updates

Attached is vsido_up.sh.  Simply save it to your /home directory and then follow these steps

Logout and drop to tty1 (ctrl + alt + f1)

chmod +x vsido_up.sh

sudo sh vsido_up.sh

At the end it suggests you reboot, but this is not necessary..

ctrl + d to log out of tty1

ctrl + f7  to get back to the login screen

Login

Profit

This particular update installs the correct conky menu xml and several new themes to Fluxbox and changes the Fluxbox menu to the normal default Fluxbox menu layout (for vrkalak)
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: tlinsley on March 04, 2013, 05:05:31 AM
Very nice VastOne!

And I am curious.  Does this only work with the Debian iso?

I ask because I am still using the last Siduction kernel iso.  Which also means i do not have "your" FluxBox.  But I do have latest FluxBox compiled from tarball.  Which I'm guessing might not play well with your script.  But I haven't tried it, so don't know.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: VastOne on March 04, 2013, 05:19:20 AM
Thank you!

Yes... It will work with your setup

It is copying files to your /home directory

It will correct the OB menu and add several new styles and correct the Fluxbox menu
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: jedi on March 04, 2013, 05:46:28 AM
Worked perfect for me....
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: Sector11 on March 04, 2013, 07:16:11 AM
VastOne said:


   correct the OB menu



Does this mean it's going to change a users customized setup?

I don't see this as a good thing.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: tlinsley on March 04, 2013, 07:20:29 AM
Yep worked fine for me too.  Thanks!

Found a few issues though.

SpaceFM would not launch from the FluxBox menu, due to camel casing the program name.

In this menu stanza:
   [submenu] (Accessories) {}
         [exec] (Application Finder) {xfce4-appfinder}
         [exec] (Medit) {launch medit}
         [exec] (Geany) {launch geany} <>
         [exec] (LXAppearance) {/usr/bin/lxappearance} <>
         [exec] (nitrogen) {/usr/bin/nitrogen} <>
         [exec] (Screenshot) {launch xfce4-screenshooter} <>
         [exec] (SpaceFM) {launch SpaceFM} <>
         [exec] (SpaceFM File Search) {spacefm --find-files %F} <>  
         [exec] (Terminal) {launch xfce4-terminal} <>
         [exec] (Xarchiver) {xarchiver} <>
         [exec] (Htop) {xfce4-terminal -x htop}
      [end]


This line:
         [exec] (SpaceFM) {launch SpaceFM} <>

should be:
         [exec] (SpaceFM) {launch spacefm} <>


Also noticed that "Logout" did not work for me.  Found that was due to my not having file "/usr/bin/vsido-exit-fb".  I assume that is because I am running a Vsido release prior to the inclusion of FluxBox.  Is there a way to pull that file without loading the new iso?


Even with these minor issues, a very nice script indeed.  Love the FB themes!  Most default FB themes make me want to claw my eyes.  :'(  But these are great.  Vsido just plain ROCKS.  Can't thank you enough for the distro VastOne.  ;D
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: Sector11 on March 04, 2013, 07:30:57 AM
what do you get with:
whereis vsido-exit

04 Mar 13 | 04:25:35 ~
         $ whereis vsido-exit
vsido-exit: /usr/bin/vsido-exit /usr/bin/X11/vsido-exit

04 Mar 13 | 04:25:45 ~


It's been in every VSIDO ISO to the best of my knowledge, I'm not running the FluxBox version either.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: tlinsley on March 04, 2013, 07:47:31 AM
Yes I have that one (actually both).  And I temporarily modified the FluxBox menu to use that.  That allowed shut down and reboot to work.  But those both do not have code to logout of FluxBox.  They only do logout of OpenBox.  Lol.  In looking at my previous post, I see that I stated "Exit" instead of "Logout".  Sorry for the confusion.  I will edit that post.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: lwfitz on March 04, 2013, 08:34:56 AM
I updated and compiled the latest fluxbox and then ran the update script and had no issues except spacefm not opening for the same reason tlinsley stated. And that was easily fixed.

@ Sector11

Yes unfortunately it did kill my OB menu so if you have one that youve edited a lot you might wanna back up ~/.config/openbox/menu.xmlso you dont have to redo the whole thing. I didnt think of that before I updated so mine will be getting a make over  ;D


Edit:


Ok heres a couple fixes for the logout issue

First thing is to edit the sudoers file

sudo geany /etc/sudoers

and add

%youruser  ALL=NOPASSWD: /sbin/shutdown,/sbin/reboot

**Note your username will go where is says youruser

and then save the file


Option #1


Next we are going to create a simple reboot script


#!/bin/sh
#shutdown script
xmessage "What would you like to do?" -center -title "Fluxbox Exit" -default "Cancel" -buttons "Cancel":1,"Reboot":2,"Shutdown":3,"logout":4

case $? in
    1)
        echo "Exit";;
    2)
        sudo reboot;;
    3)
        sudo shutdown;;
    4)
        killall fluxbox;;   
esac



and save it to /usr/bin/fluxbox_exit.sh

next we need to make that file executable with

sudo chmod 755 /usr/bin/fluxbox_exit.sh


Now we run

geany ~/.fluxbox/menu

and replace

[exec] (Exit) {/usr/bin/vsido-exit-fb} <>   

with

[exec] (Exit) {/usr/bin/fluxbox_exit.sh} <>   


and that will give you a pop up logout/exit/reboot window similar to openbox

(http://en.zimagez.com/miniature/screenshot-03042013-023147am.png) (http://en.zimagez.com/zimage/screenshot-03042013-023147am.php)



Option #2

With the sudoers file edited we can just change

[separator]
   [exec] (Exit) {/usr/bin/vsido-exit-fb} <>   

[end]


to

    [end]
[submenu] (Exit) {}   
        [exec] (Restart) {sudo shutdown -r now} <>   
        [exec] (Shutdown) {sudo shutdown -h now}<> 
        [exec] (Logout) {killall fluxbox} <>   

[end]
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: jedi on March 04, 2013, 01:03:51 PM
Yeah my SpaceFM menu setting had to be changed as well.  I had only tried it in the first menu and it worked there.  Changing the "camel casing" as per Tinsley's post and all is perfect.  My logout works as well...
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: VastOne on March 04, 2013, 01:48:34 PM
Just another case of me not Being ALL and Seeing ALL

@ Sector11, like anything else, a backup should always be done before applying a patch.  I can only worry about the default settings and the patch to the openbox menu does just that, it corrects the original menu

I completely forgot about vsido-exit-fb ... here it is.  Save it to /usr/bin and make sure it is executable

/usr/bin/vsido-exit-fb

#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass

class cb_exit:
def disable_buttons(self):
self.cancel.set_sensitive(False)
self.logout.set_sensitive(False)
self.suspend.set_sensitive(False)
self.reboot.set_sensitive(False)
self.shutdown.set_sensitive(False)

def cancel_action(self,btn):
self.disable_buttons()
gtk.main_quit()

def logout_action(self,btn):
self.disable_buttons()
self.status.set_label("Exiting FluxBox, please standby...")
os.system("logout.sh")

def suspend_action(self,btn):
self.disable_buttons()
self.status.set_label("Suspending, please standby...")
os.system("cb-lock")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Suspend")
gtk.main_quit()

def reboot_action(self,btn):
self.disable_buttons()
self.status.set_label("Rebooting, please standby...")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart")

def shutdown_action(self,btn):
self.disable_buttons()
self.status.set_label("Shutting down, please standby...")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")

def create_window(self):
self.window = gtk.Window()
title = "Log out " + getpass.getuser() + "? Choose an option:"
self.window.set_title(title)
self.window.set_border_width(5)
self.window.set_size_request(500, 80)
self.window.set_resizable(False)
self.window.set_keep_above(True)
self.window.stick
self.window.set_position(1)
self.window.connect("delete_event", gtk.main_quit)
windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
self.window.set_icon(windowicon)


#Create HBox for buttons
self.button_box = gtk.HBox()
self.button_box.show()

#Cancel button
self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)
self.cancel.set_border_width(4)
self.cancel.connect("clicked", self.cancel_action)
self.button_box.pack_start(self.cancel)
self.cancel.show()

#Logout button
self.logout = gtk.Button("_Log out")
self.logout.set_border_width(4)
self.logout.connect("clicked", self.logout_action)
self.button_box.pack_start(self.logout)
self.logout.show()

#Suspend button
self.suspend = gtk.Button("_Suspend")
self.suspend.set_border_width(4)
self.suspend.connect("clicked", self.suspend_action)
self.button_box.pack_start(self.suspend)
self.suspend.show()

#Reboot button
self.reboot = gtk.Button("_Reboot")
self.reboot.set_border_width(4)
self.reboot.connect("clicked", self.reboot_action)
self.button_box.pack_start(self.reboot)
self.reboot.show()

#Shutdown button
self.shutdown = gtk.Button("_Power off")
self.shutdown.set_border_width(4)
self.shutdown.connect("clicked", self.shutdown_action)
self.button_box.pack_start(self.shutdown)
self.shutdown.show()

#Create HBox for status label
self.label_box = gtk.HBox()
self.label_box.show()
self.status = gtk.Label()
self.status.show()
self.label_box.pack_start(self.status)

#Create VBox and pack the above HBox's
self.vbox = gtk.VBox()
self.vbox.pack_start(self.button_box)
self.vbox.pack_start(self.label_box)
self.vbox.show()

self.window.add(self.vbox)
self.window.show()

def __init__(self):
self.create_window()


def main():
    gtk.main()

if __name__ == "__main__":
    go = cb_exit()
    main()


The spacefm has been corrected too

lwfitz, I like your logout setup .... I will look into replacing the current one with that

I do not understand the need to modify sudoers for it though... It adds a serious level of complexity to the shutdown and build by altering sudoers.. Perhaps it would be easier to add to groups

Thanks everyone for testing and pointing out these issues
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: jedi on March 04, 2013, 03:23:59 PM
VastOne, just checked and my Fluxbox already has the vsido-exit-fb in /usr/bin.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: lwfitz on March 04, 2013, 07:48:29 PM
Quote from: VastOnelwfitz, I like your logout setup .... I will look into replacing the current one with that

I do not understand the need to modify sudoers for it though... It adds a serious level of complexity to the shutdown and build by altering sudoers.. Perhaps it would be easier to add to groups

Thanks! Which one do you like? The script or the second option?

The issue is that you have to make your user/group able to run a root command without needing a password. Im working on getting this going without editing  sudoers. Ill keep you updated


Edit:

Ive been playing with this for quit a while today and I cant seem to find any way to do it without the user being added to sudoers. Im gonna dig into the script that you have and see what I can come up with from that.
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: tlinsley on March 05, 2013, 08:48:50 AM
Here is a modified vsido-exit which should work on both FluxBox and OpenBox (and possibly other wm's, I don't have others installed with which to test).  Nothing fancy, just issues "killall" for whatever wm that wmctrl say is running.

#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass

class cb_exit:
def disable_buttons(self):
self.cancel.set_sensitive(False)
self.logout.set_sensitive(False)
self.suspend.set_sensitive(False)
self.reboot.set_sensitive(False)
self.shutdown.set_sensitive(False)

def cancel_action(self,btn):
self.disable_buttons()
gtk.main_quit()

def logout_action(self,btn):
self.disable_buttons()
for line in os.popen("wmctrl -m"):
parts = line.split()
if parts[0] == "Name:":
wmName = parts[1].lower()
self.status.set_label("Exiting " + wmName + ", please standby...")
os.system("killall " + wmName)

def suspend_action(self,btn):
self.disable_buttons()
self.status.set_label("Suspending, please standby...")
os.system("cb-lock")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Suspend")
gtk.main_quit()

def reboot_action(self,btn):
self.disable_buttons()
self.status.set_label("Rebooting, please standby...")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart")

def shutdown_action(self,btn):
self.disable_buttons()
self.status.set_label("Shutting down, please standby...")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")

def create_window(self):
self.window = gtk.Window()
title = "Log out " + getpass.getuser() + "? Choose an option:"
self.window.set_title(title)
self.window.set_border_width(5)
self.window.set_size_request(500, 80)
self.window.set_resizable(False)
self.window.set_keep_above(True)
self.window.stick
self.window.set_position(1)
self.window.connect("delete_event", gtk.main_quit)
windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
self.window.set_icon(windowicon)


#Create HBox for buttons
self.button_box = gtk.HBox()
self.button_box.show()

#Cancel button
self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)
self.cancel.set_border_width(4)
self.cancel.connect("clicked", self.cancel_action)
self.button_box.pack_start(self.cancel)
self.cancel.show()

#Logout button
self.logout = gtk.Button("_Log out")
self.logout.set_border_width(4)
self.logout.connect("clicked", self.logout_action)
self.button_box.pack_start(self.logout)
self.logout.show()

#Suspend button
self.suspend = gtk.Button("_Suspend")
self.suspend.set_border_width(4)
self.suspend.connect("clicked", self.suspend_action)
self.button_box.pack_start(self.suspend)
self.suspend.show()

#Reboot button
self.reboot = gtk.Button("_Reboot")
self.reboot.set_border_width(4)
self.reboot.connect("clicked", self.reboot_action)
self.button_box.pack_start(self.reboot)
self.reboot.show()

#Shutdown button
self.shutdown = gtk.Button("_Power off")
self.shutdown.set_border_width(4)
self.shutdown.connect("clicked", self.shutdown_action)
self.button_box.pack_start(self.shutdown)
self.shutdown.show()

#Create HBox for status label
self.label_box = gtk.HBox()
self.label_box.show()
self.status = gtk.Label()
self.status.show()
self.label_box.pack_start(self.status)

#Create VBox and pack the above HBox's
self.vbox = gtk.VBox()
self.vbox.pack_start(self.button_box)
self.vbox.pack_start(self.label_box)
self.vbox.show()

self.window.add(self.vbox)
self.window.show()

def __init__(self):
self.create_window()


def main():
    gtk.main()

if __name__ == "__main__":
    go = cb_exit()
    main()
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: lwfitz on March 05, 2013, 04:36:01 PM
Very nice tlinsley! Ill be testing that out in just a bit
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: VastOne on March 06, 2013, 03:32:24 AM
Thank you tlinsley, that script is now the default vsido-ext script that does work for both OpenBox and FluxBox..

I appreciate it!
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: tlinsley on March 06, 2013, 03:54:18 AM
Aw shucks, I'm honored you find it useful.   :)
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: VastOne on March 06, 2013, 03:55:58 AM
I am honored to have members who take the time to contribute to the distro and the community

Thank you!
Title: Re: Update Script - 01MAR2013 15:32 CST ISO
Post by: lwfitz on March 06, 2013, 07:11:17 PM
Yep, it worked perfect tlinsley. Great job!