Changes

From SME Server
Jump to navigationJump to search
2,614 bytes removed ,  12:28, 7 April 2017
Reduce page to a single script / save original script(s) on the talk page.
Line 14: Line 14:  
Yum doesn't do this job in one command but small scripts must be used for this purpose.
 
Yum doesn't do this job in one command but small scripts must be used for this purpose.
   −
===Scripts===
+
===yumcheck.sh===
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 can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
Line 47: Line 44:  
* 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.
 
* 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.
 
* Arguments starting with "@" are stripped out and handled separately.  If *all* arguments start with "@", the default "check-update -q" will be passed to yum.
 
* Arguments starting with "@" are stripped out and handled separately.  If *all* arguments start with "@", the default "check-update -q" will be passed to yum.
  −
====script 1====
  −
  −
#!/bin/bash
  −
  −
echo "List of available repos beside SME:";
  −
#list the disabled repos
  −
for repo in $(yum repolist disabled |awk  '$1 !~ /id|Modules|repolist:/ {print $1}'); do
  −
  −
      echo $repo;
  −
  −
done
  −
echo "";
  −
  −
# repo selection
  −
index=0;
  −
repos="";
  −
proceed="proceed";
  −
  −
until [ "$repos" == "$proceed" ]; do
  −
  −
        repos[$index]=$repos;
  −
        ((index=index+1));
  −
        read -p 'Enter 1x repo name for selection or "proceed" to start the updating: ' repos;
  −
  −
done
  −
  −
# remove the repo "proceed"
  −
repos=("${repos[@]:1}");
  −
  −
  −
for repo in "${repos[@]}"; do
  −
        echo "";
  −
        echo "======================================";
  −
        echo -e "\tUPDATE from repo: "$repo;
  −
        echo "======================================";
  −
  −
        # 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
  −
  −
# updating
  −
        yum --enablerepo=$repo update $rpms;
  −
  −
done
  −
  −
exit 0
  −
  −
Using this script is very easy:
  −
* you get the list of all available repositories
  −
* enter 1 by 1 the name of the repo you want to update from
  −
* enter 'proceed' after the last repo
  −
* for each repo, yum show the list of rpms that could be updated and ask (Y/N) before starting
  −
  −
eg.:
  −
List of available repos beside SME:
  −
centosplus
  −
contrib
  −
epel
  −
extras
  −
fasttrack
  −
fws
  −
remi
  −
smecontribs
  −
smedev
  −
smetest
  −
smeupdates-testing
  −
sogo3
  −
  −
Enter 1x repo name for selection or "proceed" to start the updating: epel
  −
Enter 1x repo name for selection or "proceed" to start the updating: fws
  −
Enter 1x repo name for selection or "proceed" to start the updating: proceed
  −
  −
====script 2====
  −
This script is much shorter, runs faster and doesn't require to enter the name of the several repos:
  −
  −
#!/bin/bash
  −
  −
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
  −
  −
        echo -e "\n\n===";
  −
        echo -e "Repo: "$repo;
  −
        echo -e "\nIncludePkgs: "$rpms;
  −
        echo "===";
  −
        # updating
  −
        yum --enablerepo=$repo --setopt="$repo.includepkgs='$rpms'" update
  −
  −
done
  −
  −
exit 0
  −
  −
The script
  −
* runs 'newrpms' to get all repos that have been used to install non-standard packages
  −
* creates a list of rpms for each such repo
  −
* uses "--setopts" to specify "includepkgs" for each repo during update
  −
* asks for Y/N and runs the update
         
===Related Information===
 
===Related Information===
 +
====Alternative Scripts====
 +
: [https://wiki.contribs.org/Talk:Update_contribs Original scripts]
 
====Forum====
 
====Forum====
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]

Navigation menu