Changes

Jump to navigation Jump to search
365 bytes removed ,  16:34, 18 March 2017
rename script3 as yumcheck.sh; correct some errors in the script itself
Line 16: Line 16:  
===Scripts===
 
===Scripts===
 
3 scripts are available at this time:
 
3 scripts are available at this time:
 +
 +
====yumcheck.sh====
 +
 +
yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
 +
 +
yumcheck.sh is an attachment to [[bugzilla:10158]]
 +
 +
Install at the sme server shell using:
 +
<nowiki>curl -s https://bugs.contribs.org/attachment.cgi?id=5827 |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
 +
chmod +x /usr/local/bin/yumcheck.sh
 +
</nowiki>
 +
 +
Usage:
 +
: <tt>yumcheck.sh</tt>
 +
:: Check for updates for all packages installed from non-standard repos.  Output only info for packages that need updates
 +
: <tt>yumcheck.sh update</tt>
 +
:: Run in verbose mode, do the updates, prompt the user after checking each repo if updates are pending
 +
: <tt>yumcheck.sh update -q -y</tt>
 +
:: Show only those items to be updated, do the updates, and answer 'yes' to each suggested update.
 +
 +
Notes:
 +
* Using the default settings will list updates from the enabled repositories multiple times (once for each disabled repo with installed packages)
 +
* Since this command starts from the output of <tt>/sbin/e-smith/audittools/newrpms</tt>, it is possible to get errors.  That is, if you configure a repository, install a package from it, then remove the configuration, this script will error.
    
====script 1====
 
====script 1====
Line 121: Line 144:  
* asks for Y/N and runs the update
 
* asks for Y/N and runs the update
   −
====script 3====
  −
This is similar to script 2, but modified to
  −
* accept arguments
  −
* default to "check-update -q"
  −
* be less verbose
  −
  −
<nowiki>#!/bin/bash
  −
if [ -z ${1+x} ]; then
  −
        YUMCMD="check-update -q"
  −
else
  −
        YUMCMD="$*"
  −
fi
  −
for repo in $(/sbin/e-smith/audittools/newrpms |grep \@ |awk ' {print $3}' |sort -u |sed s/@//); do
  −
  −
        # generate the list of rpm installed from the repo
  −
        for rpm in $(/sbin/e-smith/audittools/newrpms |awk -v repo_awk=@$repo 'repo_awk==$3 {print $1}'); do
  −
                rpms=$rpm' '$rpms
  −
        done
  −
  −
        if [[ ${YUMCMD} != *"-q"* ]]; then
  −
                echo -e "\n\n===";
  −
                echo -e "Repo: "$repo;
  −
                echo -e "\nIncludePkgs: "$rpms;
  −
                echo "===";
  −
        fi
  −
        # updating
  −
        yum --enablerepo=$repo --setopt="$repo.includepkgs='$rpms'" $YUMCMD
  −
  −
done
  −
  −
exit 0
  −
</nowiki>
  −
  −
Notes:
  −
* Using the default settings will list updates from the enabled repositories multiple times (once for each disabled repo with installed packages)
  −
* Since this command starts from the output of <tt>/sbin/e-smith/audittools/newrpms</tt>, it is possible to get errors.  That is, if you configure a repository, install a package from it, then remove the configuration, this script will error.
  −
* Examples (assuming you have created <tt>/usr/local/bin/yumcheck.sh</tt> containing this script and made it executable)
  −
:: <tt>yumcheck.sh</tt>
  −
::: Check for updates for all packages installed from non-standard repos.  Output info for packages that need updates
  −
:: <tt>yumcheck.sh update</tt>
  −
::: Run in verbose mode, do the updates, prompt the user after checking each repo if updates are pending
  −
:: <tt>yumcheck.sh update -q -y</tt>
  −
::: Show only those items to be updated, do the updates, and answer 'yes' to each suggested update.
     −
For more details, see the topic of the forum: https://forums.contribs.org/index.php/topic,52795.0.html
+
===Related Information===
 +
====Forum====
 +
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
 +
====Bugzilla====
 +
:{{#bugzilla:columns=id,product,component,summary
 +
|id=10158
 +
|sort=version,component,id
 +
|disablecache=1
 +
|noresultsmessage="Bug not found"
 +
|headers=show}}
    
[[Category: Howto]]
 
[[Category: Howto]]

Navigation menu