Just made this script: UPS

Non release banter
Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: Just made this script: UPS

Post#31 by Jack » 19 Oct 2016, 00:45

normalGuy wrote:Hello again,

Keeping the base zups code in the above comment...

... here is another version to test now more porteus alike, using an adaptation of the gtk-update-porteus function for the terminal:

Code: Select all

    #!/bin/bash
    #-----------------------------------------------------------------------
    # Upate by Porteus Scripts - gui/zenity version (zups.sh)
    # By normalGuy (ptrin)
    # Date: Oct 18, 2016
    #-----------------------------------------------------------------------


## Porteus functions - thanks to Brokenman porteus linux ##

. /usr/share/porteus/porteus-functions
. /usr/share/porteus/gtkdialog-functions

zty=`command -pv zenity`
if [ "$?" = "0" ]
then
is_root || { gksu $0; exit; }
else 
gtk_message1 "=> Zenity does not exist...install with USM" 
gksu usmgui
exit 0
fi

    # Selecting app names to updatelist ------------------------------------
    ulist=$(ls -1 /opt/porteus-scripts/update-* | awk -F/ '!/update-module/{print$NF}' | awk -F/ '!/update-porteus/{print$NF}' > /tmp/zups1
    cat /tmp/zups1)

    # Selecting app names to radiolist -------------------------------------
    rlst=$(cat /tmp/zups1 | sed -e 's/update-//' -e 's/^/FALSE /' > /tmp/zups2
    cat /tmp/zups2)

    # Selecting app single names to list -----------------------------------
    slst=$(cat /tmp/zups1 | sed -e 's/update-//' > /tmp/zups3
    cat /tmp/zups3)

# Status to the final list----------------------------------------------------
for app in $slst; do 
(if ls /var/log/packages | grep $app; then
         echo "Installed"
         else
         echo "not_Installed"
        fi); done > /tmp/z3
        
sed '/Installed/!d' /tmp/z3 > /tmp/z9        # Only Installed info line
cat /tmp/zups1 | sed -e 's/update-//' -e 's/^/FALSE /' > /tmp/z4 
paste /tmp/z4  /tmp/z9 > /tmp/z6            # Add status to third column
flst=$(cat /tmp/z6)


    # Read lines (app name to install) to update-command ------------------------------
    zups_install(){
    ap2i=$(cat /tmp/zzz) 
    if [ -z != "$ap2i" ]; then
      if (zenity --question --title="$Title" --width=295 --ok-label="Yes" --cancel-label="No" \
                  --text '<span foreground="#008080" font="12">Update <b>'$ap2i'</b></span>') ; then   
          terminal
# uxterm -bg black -fg orange -geometry 75x20 -title "update-$ap2i" -e 'bash -c "/opt/porteus-scripts/update-'$ap2i'; echo Enter to Close Terminal; read line"'
return
      fi
    fi
    
}

# Porteus gtk-update terminal adaptation from Brokenman gtk-update porteus

terminal(){
SCRIPT="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
ic=$(/usr/share/pixmaps/porteus/porteus128.png)
echo '
<window title="UPS - Update by Porteus Scripts" icon="system-settings">
<vbox>
<hbox>
      <pixmap icon_size="5">
        <input file stock="gtk-info"></input>
      </pixmap>
	'`txtcolor 400 darkcyan x-large normal "Updating $ap2i"`'
	'`hsep`'
</hbox>
	<frame>
		<terminal argv0="/bin/sh"
		envv0="WELCOME=Welcome to theUpdate by Porteus Scripts "
		pointer-autohide="false"
		hscrollbar-policy="2"
		vscrollbar-policy="2">
		<variable>vte1</variable>
		<input>echo "sh /opt/porteus-scripts/update-'$ap2i'"</input>
		</terminal>
	</frame>
<hbox>
	'`butok`'
</hbox>
</vbox>
</window>
'|gtkdialog -s

}

zups_menu(){
    Title="Updating by Porteus Scripts"
    subTxt="Select an app to <b>Install / Update</b>
Check <span color=\"blue\"><b>USM</b></span>"

main=$(zenity --list  --radiolist --width=340 --height=490 --text="$subTxt" \
             --title="$Title" --column " ✔ " --column "Application"  --column "Status" --ok-label="Install" \ $flst)
             
# Buttons --------------------------------------------------------
    bex="$?"                    # Cancel
    if [[ "$bex" != "0" ]]
    then
    rm -rf /tmp/{zups1,zups2,zups3,zzz}
    rm -rf /tmp/{z3,z6,z9,z4}
    exit 0
    elif [[ -z "$main" ]]       # Install without a choose
          then
             zenity --info --width=250 --text '<span foreground="#008080" font="12">Please <b>select</b> something</span>'
             zups_menu
    fi
       
# Install app ----------------------------------------------------------   

      echo $main | grep '[a-zA-Z0-9]' > /tmp/zzz # If anything is selected
      if [ $? = 0 ];then
      zups_install && zups_menu
      fi
     
}
## main
zups_menu
... uff!! I think this is it...now just bugging around!! :twisted:
Thanks for all your patience.
I just ran the latest script in a Terminal and here is the output.

Code: Select all

guest@porteus:~/Downloads$ su
Password: 
root@porteus:/home/guest/Downloads# sh zups.sh
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

** (zenity:6540): WARNING **: AT-SPI: Could not obtain desktop path or name


** (zenity:6540): WARNING **: atk-bridge: GetRegisteredEvents returned message with unknown signature

** (zenity:6540): WARNING **: atk-bridge: get_device_events_reply: unknown signature

** (zenity:6540): WARNING **: atk-bridge: get_device_events_reply: unknown signature
root@porteus:/home/guest/Downloads# 
Is this a problem or not?
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Just made this script: UPS

Post#32 by Ed_P » 19 Oct 2016, 05:10

Jack wrote:I just ran the latest script in a Terminal and here is the output.

Code: Select all

guest@porteus:~/Downloads$ su
Password: 
root@porteus:/home/guest/Downloads# sh zups.sh
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

** (zenity:6540): WARNING **: AT-SPI: Could not obtain desktop path or name


** (zenity:6540): WARNING **: atk-bridge: GetRegisteredEvents returned message with unknown signature

** (zenity:6540): WARNING **: atk-bridge: get_device_events_reply: unknown signature

** (zenity:6540): WARNING **: atk-bridge: get_device_events_reply: unknown signature
root@porteus:/home/guest/Downloads# 
Is this a problem or not?
I get similar terminal output:

Code: Select all

guest@porteus:~$ ./zups.sh
glibtop(c=8442): [DEBUG] open.c:53 glibtop_open_l(): SIZEOF: 40 - 65648 - 248 - 65624 - 224 - 65624
glibtop(c=8442): [DEBUG] open.c:163 glibtop_open_l(): Calling sysdeps open function.
glibtop(c=8442): [DEBUG] init.c:229 glibtop_init_s(): init_s with features=0x7ffffff and flags=0
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

** (zenity:8496): WARNING **: AT-SPI: Could not obtain desktop path or name


** (zenity:8496): WARNING **: atk-bridge: GetRegisteredEvents returned message with unknown signature

** (zenity:8496): WARNING **: atk-bridge: get_device_events_reply: unknown signature

** (zenity:8496): WARNING **: atk-bridge: get_device_events_reply: unknown signature
guest@porteus:~$ 
But the Update GUI opens and seems ok.
Ed

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: Just made this script: UPS

Post#33 by Jack » 19 Oct 2016, 11:15

@ed_p,

Why I ask I didn't want to build something and find out it might not work. Then put put built modules on my download script modules area and make me look bad on building bad modules.
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Just made this script: UPS

Post#34 by Bogomips » 19 Oct 2016, 11:37

@ Jack If you are worried about this just do it the way you usually do, using brokenman's scripts. Then you will be sure that modules you put up are all good. :wink:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
normalGuy
Black ninja
Black ninja
Posts: 52
Joined: 06 Nov 2015, 23:36
Distribution: porteus 3.2 xfce archBang
Location: uk & portugal

Re: Just made this script: UPS

Post#35 by normalGuy » 19 Oct 2016, 12:53

Hello,

That's a normal terminal output for this dialogs, you can tried it with others an have the similar output. Jack.
I just mouse click the script et voilá no output.

I need to know if rather than that if it is working? The installed output maybe it's not well...

Code: Select all

ls /var/log/packages | grep $app
or

Code: Select all

command -pv $app
Thanks.

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: Just made this script: UPS

Post#36 by Jack » 19 Oct 2016, 13:42

Here is my screen shot. It looks nice but what install is not install. I do not have Chrome install. That why I'm asking and I want to use it.
Image
If anyone know please tell me.
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

User avatar
normalGuy
Black ninja
Black ninja
Posts: 52
Joined: 06 Nov 2015, 23:36
Distribution: porteus 3.2 xfce archBang
Location: uk & portugal

Re: Just made this script: UPS

Post#37 by normalGuy » 19 Oct 2016, 17:07

Hi, Jack

That is because the update-chrome name script ;
zups it's detecting chrome (from the update-script) and not google-chrome the real name of the app.

Or I delete the code for that and no status or change the name in the update-script, because it auto-uploads the names from the update-scripts availabe.

The brokenman scripts will allow you to install or/and update the google-chrome. So you can use it...

Edit --------
Ok tested again:
/opt/porteus-scripts/update-chrome to .../update-google-chrome detects not_Installed and it executes the script normally.

Maybe there is a simpler way... :)

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: Just made this script: UPS

Post#38 by Jack » 19 Oct 2016, 17:56

You can leave it if I can still build it and upload it to my download modules area on MediaFire.
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

User avatar
FURRY_NOVA
Black ninja
Black ninja
Posts: 84
Joined: 11 Aug 2016, 17:26
Distribution: Porteus XFCE v3.2 i586
Location: United Kingdom

Re: Just made this script: UPS

Post#39 by FURRY_NOVA » 21 Nov 2016, 21:10

Nice handy script. I don't know if someone already mentioned this, since I skimmed through the posts, that it works on my 32bit too.

@brokenman Just thinking why not have this appended to the iso with a link in the start menu? It looks user friendly for non-terminal users and is easy to use.
New to Linux but learning. Hoping to help out Porteus community. :)

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Just made this script: UPS

Post#40 by brokenman » 22 Nov 2016, 00:40

It has zenity as a dependency so I won't include it in the default ISO. If it were written entirely for gtkdialog or xdialog, then it could ship with the ISO.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Just made this script: UPS

Post#41 by Ed_P » 22 Nov 2016, 05:23

?? But it runs fine on 3.2 Cinnamon. Does Cinnamon contain zenity and other DE don't?
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Just made this script: UPS

Post#42 by brokenman » 22 Nov 2016, 13:02

Correct.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply