Linux Lite Forums
Development => Linux Lite Software Development => Topic started by: Jerry on November 20, 2014, 05:36:09 AM
-
Hi folks,
I would like some volunteers to try this update script I have been working on and off for some months now.
This would require you to create this file first so that there is no interruption in the update process:
(source http://raphaelhertzog.com/2010/09/21/debian-conffile-configuration-file-managed-by-dpkg/ (http://raphaelhertzog.com/2010/09/21/debian-conffile-configuration-file-managed-by-dpkg/))
sudo leafpad /etc/apt/apt.conf.d/local
Dpkg::Options {
"--force-confdef";
"--force-confold";
}
save and close.
Here is the script:
leafpad ~/updatestest
copy into the following, then save and close, and make executable:
#!/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
sudo killall -9 synaptic
killall -9 gdebi-gtk
# Need a check here to see if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available'
# Erase existing available info
sudo dpkg --clear-avail
# 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 )
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)
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
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
Then open terminal and run:
gksudo ./updatestest
and let me know how you get on.
Thanks :)
-
I'm going to run this on 2.2 Final on my own computer for several months until 2.4 is released to see if it stands the test of time. If this works well and is stable, I hope to include it in 2.4 next year, being such a critical piece of software, it has to work well over a long period of time.
-
JB
I would be happy too help with the script test; however, I am unable to do so because since I installed the updates on my Dell D620, that you did the remote install on (11/06/14) I have no wireless access too the network. I tried the on board help too locate a fix or a method of trouble shooting. Failing too find a fix I did as you advised and posted my problem on the forum but to date haven't received a reply. With God's help I am doing my best too find out why installing the updates would wipe out my wifi access too the network and as soon as I find the answer I will post it and should you still need a script tester be more than happy too help. God bless you.
tnx john
-
@Jerry - Testing the script now. I'll have some feedback soon.
-
The script is running well for me (LL 2.2/64 Beta on VBox). Possibly one small issue (see note at bottom). After running the new script(updatestest) the original script "install updates" will generate an error:
(http://i.imgur.com/rtOXdZk.png)
Commenting out these in "install updates" will fix it or at least stop the error.
killall -9 synaptic
killall -9 gdebi-gtk
Some troubleshooting I tried
logout/login didn't help
reboot didn't didn't help
Note. I say this is a possible issue because when this script is released I assume the orginal script "install updates" will be removed.
-
It looks like the update error above (reply #4) in the screenshot has nothing to do with the updatestest script but with package:
lite-software 1.0-0330-linuxlite.
This line in the updates script seems to be the cause
sudo killall -9 synaptic && killall -9 gdebi-gtk && sudo apt-get update && sudo apt-get upgrade
Specifically these commands
killall -9 synaptic && killall -9 gdebi-gtk
~Scott
-
@Scott, that particular 'error' stems from the script closing gdebi or synaptic if they are open so that Install Updates completes uninterrupted. It was an addition I made recently as I've noticed newbies posting Install Updates doesn't complete, in the end only to find out they have another package manager open. I need to fine tune it and put an 'if, else' statement in there to suppress the reported 'error'. Thank you for helping with the testing :)
@jabbott, this thread is specifically about a new GUI updates script. Which area of the forum did you originally post your thread? I see nothing under the Hardware Support > Network section in your name. If you have not started one there yet, please do so to receive the correct Support. Thank you.
-
Quick fix for the updates. Replace the line 15 in /usr/scripts/updates with this.
sudo killall -9 synaptic || echo ok && killall -9 gdebi-gtk || echo ok && sudo apt-get update && sudo apt-get upgrade
-
Thanks misko, a good quick fix there, What we need long term is a if-else statement that suppresses any errors :)
-
Apologies if I was a bit enthusiastic :) with my postings. Couldn't sleep last night and had too much time on my hands.
-
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. :)
#!/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
-
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. :)
#!/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 :)
-
New versions uploaded, credits to misko in the updates script.
First post script updated too.
-
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.
#!/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
-
I have 1.06 can i run the script or? /ivar
-
I have 1.06 can i run the script or? /ivar
You can.
-
Some nice additions there misko :) I think we should remove the checklist though, new folk could interrupt this incorrectly.
-
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:
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:
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:
gksudo /usr/scripts/updatestest
with
(http://i.imgur.com/eFfjkiL.png)
-
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.
#!/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
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
#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
-
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:
(http://i.imgur.com/afOCnyA.png)
-
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.
#!/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
(http://i.imgur.com/tWMkzi8.png)
-
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 :)
-
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
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
What 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
#!/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
-
Nice additions there misko :) I have changed some of the text and code to have us finish up with this:
#!/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)
# Check 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="Linux Lite Updates" --width=780 --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
(http://i.imgur.com/utPPpqO.png)
-
Nice touch there Jerry :)
OK should be changed to update
zenity --text-info --ok-label="Update" --cancel-label="Drink beer"
We could also remove the folowing question
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."
Cheers :)
-
How's this?
#!/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)
# Check 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 Update 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 --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="/tmp/updateslist"
if [ "$?" -eq "0" ];then
# 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 --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi
exit 0
-
I was thinking to remove the zenity question dialog.
There is no need to click on yes after you click on update.#!/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)
# Check 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 Update 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 --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="/tmp/updateslist"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite"
#remove tmp file
rm /tmp/updateslist
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
# Halt updates script if user selects Cancel
else
rm /tmp/updateslist
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 --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi
exit 0
Cheers :)
-
Excellent :)
-
Changed line 70:
x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
to
x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
to suppress debconf errors, that don't actually mean anything is wrong, but may raise questions about updates errors from people.
-
Smart move Jerry :)
What do yo think about adding the list dialog to copy the log file? Something like the list in the new system report.
-
Hi Jerry, misko and sysdrum,
I have been following your threads on the GUI Updates & System Reporting Scripts with interest.
I don't know if it's possible.??
Once they are defined "stable", would it be possible to add them into the "How To's..."
How to add:
Update GUI
System Reporting
It would be great for the folks who are either sticking on LL2.0 or not quite ready to make the move.
Just a thought...
Dave
-
Smart move Jerry :)
What do yo think about adding the list dialog to copy the log file? Something like the list in the new system report.
Can you please give me an example? (full script code)
-
Just out of curiosity, what's the benefit of using this script vs. HardInfo?
Edit: Sorry, wrong topic. Please see this one instead: https://www.linuxliteos.com/forums/index.php?topic=1237
-
Can you please give me an example? (full script code)
Almost forgot.
I've changed line 70 to x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
Example:
#!/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)
# Check 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 Update 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 --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="/tmp/updateslist"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite"
#remove tmp file
rm /tmp/updateslist
x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive 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
# Halt updates script if user selects Cancel
else
rm /tmp/updateslist
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 --ok-label="Save Updates Log" --cancel-label="Close" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
if [ $? -ne 0 ]; then
exit;
else
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --title="System Report Save Location" --list --radiolist --text="Select save location:" --column="Select" --column="Save file location:" --width=325 --height=300 "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
exit
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/var/log/llupdates.log,g')
#Checks if the file exists. If it does asks for confirmation.
if [ ! -z "$(echo $SAVE_PATH)" ]; then
if zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="file ${SAVE_PATH} allready exists.\nWould you like to overwite the file?"; then
cp /var/log/llupdates.log $save_location
else
exit
fi
else
cp /var/log/llupdates.log $save_location
fi
fi
fi
fi
exit
-
Love the scripts . Save some time .
Dont know where to put it , please post where needed : can someone add sudo apt-get clean ; sudo apt-get autoclean ; sudo apt-get autoremove at the end of this script somehow !
Just an idea in order to cleanup LL . For what it s worth .
-
@Altman
I believe that the Lite Cleaner handles those tasks.
~Scott
-
Hey cool , tought of a combo between both of these maybe , anyhow , I can do with these . lol , forgot about Lite Cleaner , good call .
-
8) No problem. I confused the two a few times myself.
-
Hey cool , Saved some space just doing L Cleaner .
-
Hi Jerry, misko and sysdrum,
I have been following your threads on the GUI Updates & System Reporting Scripts with interest.
I don't know if it's possible.??
Once they are defined "stable", would it be possible to add them into the "How To's..."
How to add:
Update GUI
System Reporting
It would be great for the folks who are either sticking on LL2.0 or not quite ready to make the move.
Just a thought...
Dave
We can certainly do that :) See the first post of this thread for the Updates instructions.
-
Quote from: Wirezfree on 02 December 2014, 05:18:52
Hi Jerry, misko and sysdrum,
I have been following your threads on the GUI Updates & System Reporting Scripts with interest.
I don't know if it's possible.??
Once they are defined "stable", would it be possible to add them into the "How To's..."
How to add:
Update GUI
System Reporting
It would be great for the folks who are either sticking on LL2.0 or not quite ready to make the move.
Just a thought...
Dave
We can certainly do that :) See the first post of this thread for the Updates instructions.
Hi Jerry,
Thanks... O.K on instructions
The actual script went through a number of updates/iterations..
Is the script in 1st post also the latest.?
Thanks... Dave
-
The latest will be whatever is the last full posting of the code (#33) in this case.
-
The latest will be whatever is the last full posting of the code (#33) in this case.
O.K,
Will give it a try later... Dave
-
Update
Changes
¤ Display only the last 64 chars when the output is parsed to the progress dialogs (this way the progress bar width will not increase)
¤ Variables are now unset before exit
¤ Package list is now preset to a variable (safer)
¤ Ownership of the report now changes to the user
¤ added apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: 2015
# 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
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)
# 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
APTUPDATE=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e 's/^.*\(.\{64\}\)$/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #' s/^.*\(.\{64\}\)$/\1/' Display only the last 64 chars
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )
unset APTUPDATE
# 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 $UPDATES)
# Check 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 $UPDATES
exit 0
fi
# Insert text into /tmp/updateslist
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n' $UPDATES
# Erase existing available info
sudo dpkg --clear-avail
else
exit 0
fi
# Call the zenity dialog to show update list
zenity --text-info --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="$UPDATES"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite Updates"
#remove tmp file
rm $UPDATES
RUNUPDATES=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e 's/^.*\(.\{64\}\)$/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #' s/^.*\(.\{64\}\)$/\1/' Display only the last 64 chars
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
# Halt updates script if user selects Cancel
else
rm $UPDATES
unset UPDATES
unset RUNUPDATES
exit 0
fi
unset UPDATES
unset RUNUPDATES
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 --ok-label="Save Updates Log" --cancel-label="Close" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
if [ $? -ne 0 ]; then
exit;
else
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --title="System Report Save Location" --list --radiolist --text="Select save location:" --column="Select" --column="Save file location:" --width=325 --height=300 "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
unset LL_LIST_D
unset LL_LIST_H
unset save_location
exit 0
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/var/log/llupdates.log,g')
#Checks if the file exists. If it does asks for confirmation.
if [ ! -z "$(echo $SAVE_PATH)" ]; then
if zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="file ${SAVE_PATH} allready exists.\nWould you like to overwite the file?"; then
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
else
unset save_location
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
exit 1
fi
else
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
fi
fi
fi
fi
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
unset save_location
exit 0
-
@Jerry:
If the next script handles *.conf files in a way it doesn't install the package maintainer's versions on a fresh install, the previous script will probably work in the same way.
#!/bin/bash
# Authors: Misko2083, Jerry Bezencon
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 -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
echo ""
echo "Updates complete."
echo "This window will now close."
sleep 5
#exit
-
Your code in post #43 gives 'No updates available' whilst my currently working script below does:
#!/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
#-----------------------------------------------------------------------------------------
# Ensure multi-language support
export LANG=C
# 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)
# Check 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 Update 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 --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="/tmp/updateslist"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite"
#remove tmp file
rm /tmp/updateslist
x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive 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
# Halt updates script if user selects Cancel
else
rm /tmp/updateslist
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 --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi
exit 0
-
Ah O.o , ok found it.
The list is there just used `cat /tmp/updatelist` instead of `cat $UPDATES` when checking if there are any updates.
fixed :)
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: 2015
# 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
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)
# 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
APTUPDATE=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e 's/^.*\(.\{64\}\)$/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #' s/^.*\(.\{64\}\)$/\1/' Display only the last 64 chars, to dispay the first 64, change to 's/^\(.\{64\}\).*/\1/'
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )
unset APTUPDATE
# 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 $UPDATES)
# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [ -z "$(cat $UPDATES)" ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm $UPDATES
exit 0
fi
# Insert text into /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n' $UPDATES
# Erase existing available info
sudo dpkg --clear-avail
else
exit 0
fi
# Call the zenity dialog to show update list
zenity --text-info --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="$UPDATES"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite Updates"
#remove tmp file
rm $UPDATES
RUNUPDATES=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e 's/^.*\(.\{64\}\)$/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #' s/^.*\(.\{64\}\)$/\1/' Display only the last 64 chars, to dispay the first 64, change to 's/^\(.\{64\}\).*/\1/'
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
# Halt updates script if user selects Cancel
else
rm $UPDATES
unset UPDATES
unset RUNUPDATES
exit 0
fi
unset UPDATES
unset RUNUPDATES
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 --ok-label="Save Updates Log" --cancel-label="Close" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
if [ $? -ne 0 ]; then
exit;
else
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --title="System Report Save Location" --list --radiolist --text="Select save location:" --column="Select" --column="Save file location:" --width=325 --height=300 "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
unset LL_LIST_D
unset LL_LIST_H
unset save_location
exit 0
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/var/log/llupdates.log,g')
#Checks if the file exists. If it does asks for confirmation.
if [ ! -z "$(echo $SAVE_PATH)" ]; then
if zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="file ${SAVE_PATH} allready exists.\nWould you like to overwite the file?"; then
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
else
unset save_location
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
exit 1
fi
else
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
fi
fi
fi
fi
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
unset save_location
exit 0
-
This is good :) The only thing is that the 64 character string cuts off some of the output at the beginning, example http://xxxxxx becomes tp://xxxxxx
-
Yes, but we could show only the first 64 characters of the strings. It doesn't need to be 64 you can tweak that at your end.
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: 2015
# 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
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)
# 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
APTUPDATE=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e 's/^\(.\{64\}\).*/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #sed 's/^\(.\{64\}\).*/\1/' Display only the first 64 characters
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )
unset APTUPDATE
# 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 $UPDATES)
# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [ -z "$(cat $UPDATES)" ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm $UPDATES
exit 0
fi
# Insert text into /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n' $UPDATES
# Erase existing available info
sudo dpkg --clear-avail
else
exit 0
fi
# Call the zenity dialog to show update list
zenity --text-info --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="$UPDATES"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite Updates"
#remove tmp file
rm $UPDATES
RUNUPDATES=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e 's/^\(.\{64\}\).*/\1/' -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
# Halt updates script if user selects Cancel
else
rm $UPDATES
unset UPDATES
unset RUNUPDATES
exit 0
fi
unset UPDATES
unset RUNUPDATES
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 --ok-label="Save Updates Log" --cancel-label="Close" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
if [ $? -ne 0 ]; then
exit;
else
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --title="System Report Save Location" --list --radiolist --text="Select save location:" --column="Select" --column="Save file location:" --width=325 --height=300 "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
unset LL_LIST_D
unset LL_LIST_H
unset save_location
exit 0
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/var/log/llupdates.log,g')
#Checks if the file exists. If it does asks for confirmation.
if [ ! -z "$(echo $SAVE_PATH)" ]; then
if zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="file ${SAVE_PATH} allready exists.\nWould you like to overwite the file?"; then
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
else
unset save_location
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
exit 1
fi
else
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
fi
fi
fi
fi
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
unset save_location
exit 0
-
I certainly appreciate the work thats gone into the log file changes, but I think there is now too much user interaction.
Ideally, they will:
Choose to update or not > updates will run > have the option at the end to view the log which should reside in /var/log.
-
OK how about now? First dialog is removed.
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: 2015
# 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
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)
# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"
APTUPDATE=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e 's/^\(.\{64\}\).*/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #sed 's/^\(.\{64\}\).*/\1/' Display only the first 64 characters
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )
unset APTUPDATE
# 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 $UPDATES)
# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [ -z "$(cat $UPDATES)" ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm $UPDATES
exit 0
fi
# Insert text into /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n' $UPDATES
# Erase existing available info
sudo dpkg --clear-avail
# Call the zenity dialog to show update list
zenity --text-info --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="$UPDATES"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite Updates"
#remove tmp file
rm $UPDATES
RUNUPDATES=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e 's/^\(.\{64\}\).*/\1/' -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
# Halt updates script if user selects Cancel
else
rm $UPDATES
unset UPDATES
unset RUNUPDATES
exit 0
fi
unset UPDATES
unset RUNUPDATES
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 --ok-label="Save Updates Log" --cancel-label="Close" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
if [ $? -ne 0 ]; then
exit;
else
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --title="System Report Save Location" --list --radiolist --text="Select save location:" --column="Select" --column="Save file location:" --width=325 --height=300 "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
unset LL_LIST_D
unset LL_LIST_H
unset save_location
exit 0
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/var/log/llupdates.log,g')
#Checks if the file exists. If it does asks for confirmation.
if [ ! -z "$(echo $SAVE_PATH)" ]; then
if zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="file ${SAVE_PATH} allready exists.\nWould you like to overwite the file?"; then
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
else
unset save_location
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
exit 1
fi
else
cp /var/log/llupdates.log $save_location
chown $LL_USER $SAVE_PATH # Change the ownership to LL_USER
fi
fi
fi
fi
unset LL_LIST_D
unset LL_LIST_H
unset SAVE_PATH
unset LL_USER
unset save_location
exit 0
-
A bit of a misunderstanding here :) I'll break it down:
Choose to update or not > this refers to the original first dialogue, line 32:
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."
This is kept because someone may have clicked on the wrong item in the Menu, or decided against updating.
updates will run > self explanatory.
have the option at the end to view the log which should reside in /var/log - the default dialogue at the end of the file:
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 --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi
So we want to retain the original first dialogue and original logging method :) If there is a bug, then the intuitive place to look is /var/log.
-
Latest iteration:
- Added line 91
- Reverted to original log and first dialogue processes
#!/bin/bash
#-----------------------------------------------------------------------------------------
# Name: Linux Lite Updates
# Description: A GUI tool to easily install Updates in Linux Lite.
# Authors: Misko_2083, Jerry Bezencon
# Date: February 21st, 2015
# 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
# Updates log variable
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)
# 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
APTUPDATE=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e 's/^\(.\{128\}\).*/\1/' -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p' | #sed 's/^\(.\{128\}\).*/\1/' Display only the first 128 characters
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )
unset APTUPDATE
# 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 $UPDATES)
# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [ -z "$(cat $UPDATES)" ]; then
zenity --info --window-icon="/usr/share/icons/zenity-llcc.png" --title="Linux Lite Updates" \
--text="No Updates Available"
rm $UPDATES
exit 0
fi
# Insert text into /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n' $UPDATES
# Erase existing available info
sudo dpkg --clear-avail
else
exit 0
fi
# Call the zenity dialog to show update list
zenity --text-info --ok-label="Update" --cancel-label="Cancel" --title="Linux Lite Updates" --width=780 --height=300 --filename="$UPDATES"
if [ "$?" -eq "0" ];then
# Continue script if no halt
INSTALL_ICON="/usr/share/icons/zenity-llcc.png"
APPNAME="Linux Lite Updates"
# Remove tmp file
rm $UPDATES
RUNUPDATES=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
stdbuf -oL sed -n -e 's/^\(.\{128\}\).*/\1/' -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 have failed."
exit 0
fi
# Halt updates script if user selects Cancel
else
rm $UPDATES
unset UPDATES
unset RUNUPDATES
zenity --info --title="Updates Cancelled" --window-icon="${INSTALL_ICON}" --text="Updates Cancelled."
exit 0
fi
unset UPDATES
unset RUNUPDATES
PROCEED=$(zenity --question --title="$APPNAME" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME log?"; echo $?)
if [ ${PROCEED} -eq 1 ]; then
zenity --info --title="$APPNAME" --window-icon="${INSTALL_ICON}" --text="$APPNAME Complete."
exit;
else
zenity --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
fi
exit 0