0 Members and 2 Guests are viewing this topic.
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
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
#!/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 runningif [ "$(pidof synaptic)" ] then sudo killall -9 synaptic else echo""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else killall -9 gdebi-gtkfi# Linux Lite default dialog iconic="/usr/share/icons/zenity-llcc.png"# Get list of available updated packages then populate them to /tmp/updateslistzenity --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" ];thenx=$( 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/updateslistLISTNAMES=$(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/updateslistif [ -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 0fi#Insert text into /tmp/updateslistsed -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 infosudo dpkg --clear-avail else exit 0 fi# Call the zenity dialog to show update listzenity --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 Cancelelse rm /tmp/updateslist exit 0fi# 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" ]; thenx=$( 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 fiPROCEED=$(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"fiexit 0
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:
#!/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 runningif [ "$(pidof synaptic)" ] then sudo killall -9 synaptic else echo""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else killall -9 gdebi-gtkfi# Linux Lite default dialog iconic="/usr/share/icons/zenity-llcc.png"# Get list of available updated packages then populate them to /tmp/updateslistzenity --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" ];thenx=$( 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/updateslistLISTNAMES=$(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/updateslistif [ -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 0fi#Insert text into /tmp/updateslistsed -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 infosudo dpkg --clear-avail else exit 0 fi# Call the zenity dialog to show update listzenity --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 Cancelelse rm /tmp/updateslist exit 0fi# 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" ]; thenx=$( 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 fiPROCEED=$(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"fiexit 0
Some nice additions there misko I think we should remove the checklist though, new folk could interrupt this incorrectly.
#!/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 secondsif [ "$(pidof synaptic)" ]then TIMEOUT=10(SEC=$TIMEOUT;while [[ $SEC -ge 0 ]]; doecho `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 ""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else TIMEOUT=10(SEC=$TIMEOUT;while [[ $SEC -ge 0 ]]; doecho `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-gtkfi# Linux Lite default dialog iconic="/usr/share/icons/zenity-llcc.png"# Get list of available updated packages then populate them to /tmp/updateslistzenity --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" ];thenx=$( 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/updateslistLISTNAMES=$(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/updateslistif [ -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 0fi#Insert text into /tmp/updateslistsed -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 infosudo dpkg --clear-avail else exit 0 fi# Call the zenity dialog to show update listzenity --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 Cancelelse rm /tmp/updateslist exit 0fi# 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" ]; thenx=$( 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 fiPROCEED=$(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"fiexit 0
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 "
#Insert text into /tmp/updateslistsed -i -e '1 i\######### List of available Updates ##############' -e '1 i\######### Click OK to continue or Cancel to stop the update process ##############' /tmp/updateslist
sudo cp ~/updatestest /usr/scripts
gksudo /usr/scripts/updatestest
I have 1.06 can i run the script or? /ivar
#!/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 runningif [ "$(pidof synaptic)" ] then sudo killall -9 synaptic else echo ""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else killall -9 gdebi-gtkfi# Linux Lite default dialog iconic="/usr/share/icons/zenity-llcc.png"# Get list of available updated packages then populate them to /tmp/updateslistzenity --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" ];thenx=$( 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/updateslistLISTNAMES=$(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/updateslistif [ -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 0fi# Erase existing available infosudo dpkg --clear-availelse exit 0fi# Get the list from /tmp/updateslist and call the zenity dialog to show update listUPDATELIST=(`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 Cancelelse exit 0fi# 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" ]; thenx=$( 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 fiPROCEED=$(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"fiexit 0
Quote from: Jerry on November 20, 2014, 05:16:24 PMThanks 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/bashbold=`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""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else killall -9 gdebi-gtkfisudo apt-get update && sudo apt-get upgradeecho ""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
#!/bin/bashbold=`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""fiif [ -z "$(pgrep gdebi-gtk)" ]then echo ""else killall -9 gdebi-gtkfisudo apt-get update && sudo apt-get upgradeecho ""echo "Updates complete."echo "This window will now close."sleep 5