--- alx-src/branches/alx-web-060/mageupgrade.php 2011/05/09 18:49:28 2019
+++ alx-src/branches/alx-web-060/mageupgrade.php 2011/05/09 21:06:14 2020
@@ -35,23 +35,31 @@
if($op=="calc")
{
echo ' '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...
');
- exec($sshcmd.' '.$ip.' mage uppretend',$out,$err);
+ exec($sshcmd.' '.$ip.' NOCOLORS=true /sbin/mage uppretend | egrep "\[.*\]" | sed "s:\[.*\]\ \(.*\):\1:" | sed "s:/:,:" | sed "s:\(.*\)-:\1,:" | sed "s:\(.*\)-:\1,:"',$out,$err);
echo '
';
if (array_key_exists("0", $out))
{
foreach( $out as $i)
{
+ if(strstr($i,"Magellan")
+ {
+ continue;
+ }
+ if(strstr($i,"dependencies")
+ {
+ continue;
+ }
$item=explode(",",$i);
$pcat=$item[0];
$pname=$item[1];
- $opver=$item[2];
- $npver=$item[3];
+ $pver=$item[2];
+ $pbuild=$item[3];
echo '';
echo ''.$pcat.'/'.$pname.'';
echo ' | ';
- echo ' [ '.$opver.' -> '.$npver.' ] ';
+ echo ' => [ '.$pver.'-'.$pbuild.' ] ';
echo ' | ';
echo '
';
}
@@ -65,15 +73,10 @@
echo ' '.strtoupper('Fetching new mage database for client #'.$client.' ('.$ip.')...
');
echo '
';
echo '';
- // hotfix copy a fixed mage.rc
- //system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');
- // hotfix2 and a config.rc
- //system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');
editvar("VERBOSE","off","/etc/mage.rc");
// update rsync server location
- $rsync = sqlfirst('select client_locations.rsync from client_serials inner join client_locations on client_locations.location=client_serials.location and client_serials.serial='.$client, 'rsync');
- echo $rsync;
+ $rsync = sqlfirst('select client_locations.rsync from client_serials inner join client_locations on client_locations.location=client_serials.location and client_serials.serial='.$client, 'client_locations.rsync');
editvar("MAGE_RSYNC",$rsync,"/etc/alxconfig-ng/config.rc");
editvar("RSYNC",$rsync,"/etc/mage.rc");
@@ -93,7 +96,7 @@
// update samba update password
$smbpassword = sqlfirst('select client_locations.password from client_serials inner join client_locations on client_locations.location=client_serials.location and client_serials.serial='.$client, 'password');
editvar("SMB_UPDATE_PASS",$smbpassword,"/etc/alxconfig-ng/config.rc");
- system($sshcmd.' '.$ip.' "NOCOLORS=true mage update"');
+ system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage update"');
echo '
';
echo '';
@@ -103,11 +106,6 @@
echo ' '.strtoupper('Running update-alx on client #'.$client.' ('.$ip.')...
');
echo '
';
echo '';
- #echo 'forcing verbose=off
';
- // hotfix copy a fixed mage.rc
- //system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');
- // hotfix2 and a config.rc
- //system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');
editvar("VERBOSE","off","/etc/mage.rc");
// update rsync server location
@@ -134,15 +132,14 @@
# check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first
- exec($sshcmd.' '.$ip.' "[ -x $(which update-alx) ] && exit 0 || exit 1"',$outarr,$err);
+ exec($sshcmd.' '.$ip.' "[ -x /usr/sbin/update-alx ] && exit 0 || exit 1"',$outarr,$err);
if($err!=0)
{
echo '"update-alx" missing on client "'.$client.'". Updating mage and alxconfig-ng first ...
';
system($sshcmd.' '.$ip.' "NOCOLORS=true mage install mage"');
system($sshcmd.' '.$ip.' "NOCOLORS=true mage install alxconfig-ng"');
}
- //system($sshcmd.' '.$ip.' "NOCOLORS=true update-alx"');
- exec($sshcmd.' '.$ip.' "NOCOLORS=true update-alx && exit 0 || exit 1"',$outarr,$err);
+ exec($sshcmd.' '.$ip.' "NOCOLORS=true /usr/sbin/update-alx && exit 0 || exit 1"',$outarr,$err);
echo '
';
if ($err!=0) echo '';
else echo '';