You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



GUI Updates script

Author (Read 31626 times)

0 Members and 2 Guests are viewing this topic.

Re: GUI Updates script
« Reply #23 on: November 25, 2014, 03:28:55 AM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Can you insert a blank line after: #########  Click OK to continue or Cancel to stop the update process         ############## to separate the title and the list of updates? Cheers :)
Just add '\n' at the end of the line :) #########  Click OK to continue or Cancel to stop the update process         ##############\n
Code: [Select]
sed -i -e '1 i\#########                     List of available Updates                                           ##############' -e '1 i\#########  Click OK to continue or Cancel to stop the update process         ##############\n' /tmp/updateslistWhat do you think about adding line numbers to the updates?
I've also changed the title in this script (removed those hashtags)
I think it looks better now
Code: [Select]
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: Nov 20th, 2014
# Website: https://www.linuxliteos.com
#-----------------------------------------------------------------------------------------

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
else
   echo""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
   echo ""
else
   killall -9 gdebi-gtk
fi


# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages then populate them to /tmp/updateslist
zenity --question --title="Linux Lite Updates" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )


# Creates a list in /tmp/updateslist
LISTNAMES=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | awk '{print NR,"\t"$0}' | tee /tmp/updateslist)


# A check here to see if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist
if [  -z "$(cat /tmp/updateslist)"  ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm /tmp/updateslist
exit 0
fi

#Insert text into  /tmp/updateslist
sed -i -e '1 i\                              List of available Updates' -e '1 i\           Click OK to continue or Cancel to stop the update process\n'  /tmp/updateslist

# Erase existing available info
sudo dpkg --clear-avail



  else
       exit 0
  fi

# Call the zenity dialog to show update list
zenity --text-info --title="List of available Updates - Click OK to continue or Cancel to stop the update process" --width=700 --height=300 --filename="/tmp/updateslist"
   if [ "$?" -eq "0" ];then

# Main window dialogue.
 INSTALLER_TITLE="Linux Lite Updates
-----------------------------------------------------------------------------------------------------------

Please make sure all software installation programs like
<b>Synaptic Package Manager</b> and <b>Gdebi</b> are closed before proceeding.

When you click on <b>Yes</b>, this window will close and the updates will begin.

-----------------------------------------------------------------------------------------------------------
Click on <b>Yes</b> to continue or <b>No</b> to cancel the updates process."

# Halt updates script if user selects Cancel
else
rm /tmp/updateslist
       exit 0
fi

# Continue script if no halt
 INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
 APPNAME="Linux Lite"
       
        zenity --question --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="${INSTALLER_TITLE}"

                if [ "$?" -eq "0" ]; then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating..." --pulsate \
--width=600 --auto-close )

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then
                       
                                        zenity --error \
                                        --title="Error" --text="$APPNAME Updates have failed."
                                        exit 0
                                fi

                else

                                        exit 0
                fi

PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
if [ ${PROCEED} -eq 1 ]; then
   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
   exit;
else
   zenity --text-info --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi

exit 0
 

Re: GUI Updates script
« Reply #22 on: November 24, 2014, 11:40:07 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Much better, plus the error is gone :) People will compare this new method to the old in terms of the time it takes, if we can take about the same amount of time with the new as we did with the old, there less to whinge about :) Can you insert a blank line after: #########  Click OK to continue or Cancel to stop the update process         ############## to separate the title and the list of updates? Cheers :)
 

Re: GUI Updates script
« Reply #21 on: November 24, 2014, 10:53:30 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
I think I prefer the existing method of handling the gdebi/synaptic check, it's simpler and quicker.
I thought it would be nice to have an opportunity to stop the kill switch. :)
Whatever you think it's best.
It's definitelly quicker. :)
Also running your new code I still get the 'List of available Updates - Click OK to continue or Cancel to stop the update process' existing dialog, not your new one, but this time it's empty when there are lots of updates for my machine:
Arrrgh. :(
Why can't 'zenity --text-info' tell when you use the wrong filename.
I've entered
--filename="/tmp/updateslist "
instead of
--filename="/tmp/updateslist"
No error messages at all...
It took me some time to figure it out.

I've swithed back to the existing method of handling the gdebi/synaptic check.
Code: [Select]
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: Nov 20th, 2014
# Website: https://www.linuxliteos.com
#-----------------------------------------------------------------------------------------

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
else
   echo""
fi
if [ -z "$(pgrep gdebi-gtk)" ]
then
   echo ""
else
   killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages then populate them to /tmp/updateslist
zenity --question --title="Linux Lite Updates" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )


# Creates a list in /tmp/updateslist
LISTNAMES=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | tee /tmp/updateslist)


# A check here to see if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist
if [  -z "$(cat /tmp/updateslist)"  ]; then
     zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
        --text="No Updates Available"
    rm /tmp/updateslist
    exit 0
fi

#Insert text into  /tmp/updateslist
sed -i -e '1 i\#########                     List of available Updates                                           ##############' -e '1 i\#########  Click OK to continue or Cancel to stop the update process         ##############' /tmp/updateslist

# Erase existing available info
sudo dpkg --clear-avail



  else
       exit 0
  fi

# Call the zenity dialog to show update list
zenity --text-info --title="List of available Updates - Click OK to continue or Cancel to stop the update process" --width=700 --height=300 --filename="/tmp/updateslist"
   if [ "$?" -eq "0" ];then

# Main window dialogue.
 INSTALLER_TITLE="Linux Lite Updates
-----------------------------------------------------------------------------------------------------------

Please make sure all software installation programs like
<b>Synaptic Package Manager</b> and <b>Gdebi</b> are closed before proceeding.

When you click on <b>Yes</b>, this window will close and the updates will begin.

-----------------------------------------------------------------------------------------------------------
Click on <b>Yes</b> to continue or <b>No</b> to cancel the updates process."

# Halt updates script if user selects Cancel
else
    rm /tmp/updateslist
       exit 0
fi

# Continue script if no halt
 INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
 APPNAME="Linux Lite"
       
        zenity --question --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="${INSTALLER_TITLE}"

                if [ "$?" -eq "0" ]; then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating..." --pulsate \
--width=600 --auto-close )

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then
                       
                                        zenity --error \
                                        --title="Error" --text="$APPNAME Updates have failed."
                                        exit 0
                                fi

                else

                                        exit 0
                fi

PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
if [ ${PROCEED} -eq 1 ]; then
   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
   exit;
else
   zenity --text-info --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi

exit 0
 

Re: GUI Updates script
« Reply #20 on: November 24, 2014, 09:25:34 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
I think I prefer the existing method of handling the gdebi/synaptic check, it's simpler and quicker.
Also running your new code I still get the 'List of available Updates - Click OK to continue or Cancel to stop the update process' existing dialog, not your new one, but this time it's empty when there are lots of updates for my machine:

 

Re: GUI Updates script
« Reply #19 on: November 24, 2014, 12:14:31 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Some nice additions there misko :) I think we should remove the checklist though, new folk could interrupt this incorrectly.
OK, checklist is removed :)
Some minor improvements to the script.
First open sinaptic and/or gdebi-gtk to test this.
Code: [Select]
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: Nov 20th, 2014
# Website: https://www.linuxliteos.com
#-----------------------------------------------------------------------------------------

# Kill off any package managers that may be running
# Timeout in seconds
if [ "$(pidof synaptic)" ]
then
TIMEOUT=10
(
SEC=$TIMEOUT;
while [[ $SEC -ge 0 ]];
do
echo `expr \( \( $TIMEOUT - $SEC \) \* 100 / $TIMEOUT \)`;
echo "#synaptic will close in $SEC seconds.";
SEC=`expr $SEC - 1`;
sleep 1;
done;
) | /usr/bin/zenity --progress --auto-close
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
                       
                                        zenity --info \
                                        --title="Updates" --text="Close the synaptic package manager and try again."
                                        exit 0
                                fi
sudo killall -9 synaptic
else
echo ""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
echo ""
else
TIMEOUT=10
(
SEC=$TIMEOUT;
while [[ $SEC -ge 0 ]];
do
echo `expr \( \( $TIMEOUT - $SEC \) \* 100 / $TIMEOUT \)`;
echo "#gdebi package installer will be closed in $SEC seconds.";
SEC=`expr $SEC - 1`;
sleep 1;
done;
) | /usr/bin/zenity --progress --auto-close
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
                       
                                        zenity --info \
                                        --title="Updates" --text="Close the gdebi package installer and try again."
                                        exit 0
                                fi
killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages then populate them to /tmp/updateslist
zenity --question --title="Linux Lite Updates" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )


# Creates a list in /tmp/updateslist
LISTNAMES=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' |  tee /tmp/updateslist)


# A check here to see if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist
if [  -z "$(cat /tmp/updateslist)"  ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm /tmp/updateslist
exit 0
fi

#Insert text into  /tmp/updateslist
sed -i -e '1 i\#########                     List of available Updates                                           ##############' -e '1 i\#########  Click OK to continue or Cancel to stop the update process         ##############' /tmp/updateslist

# Erase existing available info
sudo dpkg --clear-avail



  else
       exit 0
  fi

# Call the zenity dialog to show update list
zenity --text-info --title="List of available Updates - Click OK to continue or Cancel to stop the update process" --width=700 --height=300 --filename="/tmp/updateslist "
   if [ "$?" -eq "0" ];then

# Main window dialogue.
 INSTALLER_TITLE="Linux Lite Updates
-----------------------------------------------------------------------------------------------------------

Please make sure all software installation programs like
<b>Synaptic Package Manager</b> and <b>Gdebi</b> are closed before proceeding.

When you click on <b>Yes</b>, this window will close and the updates will begin.

-----------------------------------------------------------------------------------------------------------
Click on <b>Yes</b> to continue or <b>No</b> to cancel the updates process."

# Halt updates script if user selects Cancel
else
rm /tmp/updateslist
       exit 0
fi

# Continue script if no halt
 INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
 APPNAME="Linux Lite"
       
        zenity --question --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="${INSTALLER_TITLE}"

                if [ "$?" -eq "0" ]; then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating..." --pulsate \
--width=600 --auto-close )

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then
                       
                                        zenity --error \
                                        --title="Error" --text="$APPNAME Updates have failed."
                                        exit 0
                                fi

                else

                                        exit 0
                fi

PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
if [ ${PROCEED} -eq 1 ]; then
   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
   exit;
else
   zenity --text-info --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi

exit 0

Here you've used the title to give info on the next step
Code: [Select]
zenity --text-info --title="List of available Updates - Click OK to continue or Cancel to stop the update process" --width=700 --height=300 --filename="/tmp/updateslist "
There is another approach
I've used stream editor in the script to insert two lines into /tmp/updateslist
Code: [Select]
#Insert text into  /tmp/updateslist
sed -i -e '1 i\#########                     List of available Updates                                           ##############' -e '1 i\#########  Click OK to continue or Cancel to stop the update process         ##############' /tmp/updateslist
 

Re: GUI Updates script
« Reply #18 on: November 24, 2014, 02:12:03 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
If you still want to use the existing Menu, Favorites, Install Updates entry to try the new beta method, here's how.

1) Open a  terminal do:

Code: [Select]
sudo cp ~/updatestest /usr/scripts
2) Then go to Menu, Settings, Main Menu. Highlight Install Updates in the right hand pane and click on Properties. Change the Command to:

Code: [Select]
gksudo /usr/scripts/updatestest
Now the new GUI will run from the Menu. To go back to the stock way of doing Updates, simply replace:

Code: [Select]
gksudo /usr/scripts/updatestest
with

 

Re: GUI Updates script
« Reply #17 on: November 22, 2014, 01:39:06 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Some nice additions there misko :) I think we should remove the checklist though, new folk could interrupt this incorrectly.
« Last Edit: November 22, 2014, 05:00:56 AM by Jerry »
 

Re: GUI Updates script
« Reply #16 on: November 22, 2014, 01:36:50 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
I have 1.06 can i run the script or? /ivar

You can.
 

Re: GUI Updates script
« Reply #15 on: November 21, 2014, 07:38:32 PM »
 

iwar

  • Occasional Poster
  • **
  • 66
    Posts
  • Reputation: 0
  • Linux Lite Member
    • View Profile
I have 1.06 can i run the script or? /ivar
 

Re: GUI Updates script
« Reply #14 on: November 21, 2014, 05:28:28 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Made some changes to the script.
Added: A check to see if any updates are available, if there are none, script pops up a dialog box saying 'No Updates Available'.
Changes: Script opens a list of available updates.
Note: The list of packages that have been kept back is not displaying.

Code: [Select]
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: Nov 20th, 2014
# Website: https://www.linuxliteos.com
#-----------------------------------------------------------------------------------------

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
sudo killall -9 synaptic
else
echo ""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
echo ""
else
killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages then populate them to /tmp/updateslist
zenity --question --title="Linux Lite Updates" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )


# Creates a list in /tmp/updateslist
LISTNAMES=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | tee /tmp/updateslist)

# A check here to see if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist
if [  -z "$(cat /tmp/updateslist)"  ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm /tmp/updateslist
exit 0
fi

# Erase existing available info
sudo dpkg --clear-avail



else
       exit 0
fi

# Get the list from /tmp/updateslist and call the zenity dialog to show update list
UPDATELIST=(`cat /tmp/updateslist | awk '{print "TRUE\n",$2,"\n",$4,"\n",$6}' `)
LIST=$(zenity --list --checklist --column="pick" --column="NAME" --column="INSTALLED" --column="AVAILABLE" "${UPDATELIST[@]}" --separator=" " --text="Text goes here." --width=800 --height=700)
   if [ "$?" -eq "0" ];then

# Main window dialogue.
 INSTALLER_TITLE="Linux Lite Updates
-----------------------------------------------------------------------------------------------------------

Please make sure all software installation programs like
<b>Synaptic Package Manager</b> and <b>Gdebi</b> are closed before proceeding.

When you click on <b>Yes</b>, this window will close and the updates will begin.

-----------------------------------------------------------------------------------------------------------
Click on <b>Yes</b> to continue or <b>No</b> to cancel the updates process."

# Halt updates script if user selects Cancel
else
       exit 0
fi

# Continue script if no halt
 INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
 APPNAME="Linux Lite"
       
        zenity --question --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="${INSTALLER_TITLE}"

                if [ "$?" -eq "0" ]; then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get install $LIST \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating..." --pulsate \
--width=600 --auto-close )

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then
                       
                                        zenity --error \
                                        --title="Error" --text="$APPNAME Updates have failed."
                                        exit 0
                                fi

                else

                                        exit 0
                fi

PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
if [ ${PROCEED} -eq 1 ]; then
   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
   exit;
else
   zenity --text-info --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi

exit 0
 

Re: GUI Updates script
« Reply #13 on: November 20, 2014, 05:48:13 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
New versions uploaded, credits to misko in the updates script.

First post script updated too.
« Last Edit: November 20, 2014, 05:50:49 PM by Jerry »
 

Re: GUI Updates script
« Reply #12 on: November 20, 2014, 05:42:48 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Thanks misko, a good quick fix there, What we need long term is a if-else statement that suppresses any errors :)
Here you go, pall. :)
Code: [Select]
#!/bin/bash

bold=`tput bold`
normal=`tput sgr0`

echo "${bold}**********************"
echo "Linux Lite 2.0 Updates"
echo "**********************${normal}"
echo ""
echo "Linux Lite will now search for updates for your computer."
echo "Once installed, your computer will be up to date."
echo "Simply follow the onscreen instructions."
echo ""
echo "Please enter your password to continue..."
if [ "$(pidof synaptic)" ]
then
sudo killall -9 synaptic
else
echo""
fi
if [ -z "$(pgrep gdebi-gtk)" ]
then
echo ""
else
killall -9 gdebi-gtk
fi
sudo apt-get update && sudo apt-get upgrade
echo ""
echo "Updates complete."
echo "This window will now close."
sleep 5

Beautiful misko! I'll upload the new deb's soon :)
 

Re: GUI Updates script
« Reply #11 on: November 20, 2014, 05:33:45 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Thanks misko, a good quick fix there, What we need long term is a if-else statement that suppresses any errors :)
Here you go, pall. :)
Code: [Select]
#!/bin/bash

bold=`tput bold`
normal=`tput sgr0`

echo "${bold}**********************"
echo "Linux Lite 2.0 Updates"
echo "**********************${normal}"
echo ""
echo "Linux Lite will now search for updates for your computer."
echo "Once installed, your computer will be up to date."
echo "Simply follow the onscreen instructions."
echo ""
echo "Please enter your password to continue..."
if [ "$(pidof synaptic)" ]
then
sudo killall -9 synaptic
else
echo""
fi
if [ -z "$(pgrep gdebi-gtk)" ]
then
echo ""
else
killall -9 gdebi-gtk
fi
sudo apt-get update && sudo apt-get upgrade
echo ""
echo "Updates complete."
echo "This window will now close."
sleep 5
 

Re: GUI Updates script
« Reply #10 on: November 20, 2014, 05:29:04 PM »
 

Scott

  • Global Moderator
  • Gold Level Poster
  • *****
  • 857
    Posts
  • Reputation: 186
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Intel Core i3 M 330

  • MEMORY: 6Gb

  • VIDEO CARD: Intel Integrated Graphics
Apologies if I was a bit enthusiastic :) with my postings. Couldn't sleep last night and had too much time on my hands.
 

Re: GUI Updates script
« Reply #9 on: November 20, 2014, 05:16:24 PM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8775
    Posts
  • Reputation: 801
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Thanks misko, a good quick fix there, What we need long term is a if-else statement that suppresses any errors :)
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section