update my fedora computers from my own server.

Reindl Harald h.reindl at thelounge.net
Fri Aug 31 09:47:59 UTC 2012



Am 31.08.2012 04:35, schrieb Edward M:
> Hello,
> 
> 
> I'm wondering, if is possible to setup a fedora 17 rsync,etc server, download  new fedora 17 bugs/security updates
> to it, then update my fedora 17 computers from my fedora 17 rsync, etc server, so this way i dont have to use the
> internet to update
>  each one of them?

no need for a full rsync

install all the packages needed in your infrastructure on
teh local repo-server, just update it and refresh your repos
from yum-cache, i'm doing this since 2008 (Fedora 9) on all
machines which are in the meantime upgraded to F16 via YUM

the cleanup-script to get rid of old cahced packages is in
PHP because i am much faster since it is my "main-language"
______________________________

[root at buildserver:~]$ cat /buildserver/repo-cache.sh
#!/bin/bash
basearch=`uname -i`
releasever=`rpm -q --qf "%{version}\n" fedora-release`
for g in `ls -1b /var/cache/yum`
do
 if [ -d /var/cache/yum/$g/packages ]
 then
  echo "/var/cache/yum/$g/packages/ > /repo/cache/fc$releasever/"
  sudo cp --verbose /var/cache/yum/$g/packages/*.rpm /repo/cache/fc$releasever/ 2> /dev/null
 fi
done
createrepo -d /repo/cache/fc$releasever/
chmod -R 755 /repo/
______________________________

[root at buildserver:~]$ cat /buildserver/repo-clean.php
#!/usr/bin/php
<?php
 ob_start();
 passthru('rpm -q --qf "%{version}\n" fedora-release');
 $release = trim(ob_get_clean());
 ob_start();
 passthru('uname -i');
 $basearch = trim(ob_get_clean());
 clean_repo('/repo/cache/fc' . $release . '/');
 function clean_repo($path)
 {
  ob_start();
  passthru('/usr/bin/repomanage --old ' . escapeshellarg($path));
  $out = ob_get_clean();
  $files = explode("\n", $out);
  $deleted = 0;
  foreach($files as $file)
  {
   $file = trim($file);
   if(is_file($file))
   {
    if(@unlink($file))
    {
     echo "REMOVED: " . $file . "\n";
     $deleted++;
    }
    else
    {
     echo 'FAILED: ' . $file . "\n";
    }
   }
  }
  if($deleted > 0)
  {
   passthru('/usr/bin/createrepo -d ' . escapeshellarg($path));
   passthru('/bin/chmod -R 755 ' . escapeshellarg($path));
  }
 }
?>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20120831/4ee0ca90/attachment.sig>


More information about the users mailing list