Magellan Linux

Diff of /alx-src/branches/alx-web-060/mageupgrade.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2018 by niro, Mon May 9 16:31:38 2011 UTC revision 2019 by niro, Mon May 9 18:49:28 2011 UTC
# Line 35  Line 35 
35   if($op=="calc")   if($op=="calc")
36   {   {
37   echo '<img src="pics/online.gif" align=top> '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...<br>');   echo '<img src="pics/online.gif" align=top> '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...<br>');
38   exec($sshcmd.' '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err);   exec($sshcmd.' '.$ip.' mage uppretend',$out,$err);
39   echo '<pre>';   echo '<pre>';
40   echo '<table border="0">';   echo '<table border="0">';
41   if (array_key_exists("0", $out))   if (array_key_exists("0", $out))
# Line 66  Line 66 
66   echo '<br>';   echo '<br>';
67   echo '<pre><div align=left class=left>';   echo '<pre><div align=left class=left>';
68   // hotfix copy a fixed mage.rc   // hotfix copy a fixed mage.rc
69   system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');   //system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');
70   // hotfix2 and a config.rc   // hotfix2 and a config.rc
71   system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');   //system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');
72   editvar("VERBOSE","off","/etc/mage.rc");   editvar("VERBOSE","off","/etc/mage.rc");
73    
74   // update rsync server location   // update rsync server location
# Line 93  Line 93 
93   // update samba update password   // update samba update password
94   $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');   $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');
95   editvar("SMB_UPDATE_PASS",$smbpassword,"/etc/alxconfig-ng/config.rc");   editvar("SMB_UPDATE_PASS",$smbpassword,"/etc/alxconfig-ng/config.rc");
96   system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage update"');   system($sshcmd.' '.$ip.' "NOCOLORS=true mage update"');
97    
98   echo '</div></pre>';   echo '</div></pre>';
99   echo '<script language="JavaScript">alert(\'Database-update successfully completed on client #'.$client.' .\')</script>';   echo '<script language="JavaScript">alert(\'Database-update successfully completed on client #'.$client.' .\')</script>';
# Line 105  Line 105 
105   echo '<pre><div align=left class=left>';   echo '<pre><div align=left class=left>';
106   #echo 'forcing verbose=off <br>';   #echo 'forcing verbose=off <br>';
107   // hotfix copy a fixed mage.rc   // hotfix copy a fixed mage.rc
108   system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');   //system('scp '.$magerc.' root@'.$ip.':/etc/mage.rc');
109   // hotfix2 and a config.rc   // hotfix2 and a config.rc
110   system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');   //system('scp '.$configrc.' root@'.$ip.':/etc/alxconfig-ng/config.rc');
111   editvar("VERBOSE","off","/etc/mage.rc");   editvar("VERBOSE","off","/etc/mage.rc");
112    
113   // update rsync server location   // update rsync server location
# Line 134  Line 134 
134    
135    
136   # check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first   # check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first
137   exec($sshcmd.' '.$ip.' "[ -x /usr/sbin/update-alx ] && exit 0 || exit 1"',$outarr,$err);   exec($sshcmd.' '.$ip.' "[ -x $(which update-alx) ] && exit 0 || exit 1"',$outarr,$err);
138   if($err!=0)   if($err!=0)
139   {   {
140   echo '"/usr/sbin/update-alx" missing on client "'.$client.'". Updating mage-alx and alxconfig-ng-alx first ...<br>';   echo '"update-alx" missing on client "'.$client.'". Updating mage and alxconfig-ng first ...<br>';
141   system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage install mage-alx"');   system($sshcmd.' '.$ip.' "NOCOLORS=true mage install mage"');
142   system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage install alxconfig-ng-alx"');   system($sshcmd.' '.$ip.' "NOCOLORS=true mage install alxconfig-ng"');
143   }   }
144   //system($sshcmd.' '.$ip.' "NOCOLORS=true /usr/sbin/update-alx"');   //system($sshcmd.' '.$ip.' "NOCOLORS=true update-alx"');
145   exec($sshcmd.' '.$ip.' "NOCOLORS=true /usr/sbin/update-alx && exit 0 || exit 1"',$outarr,$err);   exec($sshcmd.' '.$ip.' "NOCOLORS=true update-alx && exit 0 || exit 1"',$outarr,$err);
146   echo '</div></pre>';   echo '</div></pre>';
147   if ($err!=0) echo '<script language="JavaScript">alert(\'Upgrade *failed* on client #'.$client.' .\')</script>';   if ($err!=0) echo '<script language="JavaScript">alert(\'Upgrade *failed* on client #'.$client.' .\')</script>';
148   else echo '<script language="JavaScript">alert(\'Upgrade successfully installed on client #'.$client.' .\')</script>';   else echo '<script language="JavaScript">alert(\'Upgrade successfully installed on client #'.$client.' .\')</script>';

Legend:
Removed from v.2018  
changed lines
  Added in v.2019