--- alx-src/trunk/alx-web/mageupgrade.php 2008/06/04 21:54:04 424 +++ alx-src/trunk/alx-web/mageupgrade.php 2008/06/04 22:35:14 425 @@ -1,111 +1,111 @@ - - include('include/config.inc.php'); - include('include/dbconn.php'); - include('include/basesql.php'); - - echo '
';
-?>
-
-
- function editvar($var, $value, $file)
- {
- global $ip;
- global $sshcmd;
-
- // sed cmd: ssh -l root 10.11.12.13 'sed -i -e "s|^(VAR=).*|\"VALUE\"| FILE'
- $str = $sshcmd.' -l root '.$ip.' \'sed -i -e "s|^\\('.$var.'=\\).*|\\1\\"'.$value.'\\"|" '.$file.'\'';
- system($str);
- }
-
- $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
- while ($row = mysql_fetch_row ($pubkey))
- {
- # schreiben der .ssh/known_hosts file mit dem public rsa key des client,
- # um die "yes" abfrage zu vermeiden
- $hostfile = fopen ($home."/.ssh/known_hosts","w");
- fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
- fclose($hostfile);
-
- # reboot des clients
- passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
- if($retval==0)
- {
- if($op=="calc")
- {
- echo ' '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')... '); - exec($sshcmd.' -l root '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); - echo ' '; - echo '
'); - echo ' '; - echo ' '; - echo ''; - } - elseif($op=="upgrade") - { - echo ' '.strtoupper('Running update-alx on client #'.$client.' ('.$ip.')... '); - echo ' '; - echo ' '; - echo ''; - } - else echo 'unkown operation'; - } - - else echo ' '.strtoupper('Client not online, try again later... '); - } - echo ' |
';
+?>
+
+
+ function editvar($var, $value, $file)
+ {
+ global $ip;
+ global $sshcmd;
+
+ // sed cmd: ssh -l root 10.11.12.13 'sed -i -e "s|^(VAR=).*|\"VALUE\"| FILE'
+ $str = $sshcmd.' -l root '.$ip.' \'sed -i -e "s|^\\('.$var.'=\\).*|\\1\\"'.$value.'\\"|" '.$file.'\'';
+ system($str);
+ }
+
+ $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
+ while ($row = mysql_fetch_row ($pubkey))
+ {
+ # schreiben der .ssh/known_hosts file mit dem public rsa key des client,
+ # um die "yes" abfrage zu vermeiden
+ $hostfile = fopen ($home."/.ssh/known_hosts","w");
+ fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
+ fclose($hostfile);
+
+ # reboot des clients
+ passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
+ if($retval==0)
+ {
+ if($op=="calc")
+ {
+ echo ' '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')... '); + exec($sshcmd.' -l root '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); + echo ' '; + echo '
'); + echo ' '; + echo ' '; + echo ''; + } + elseif($op=="upgrade") + { + echo ' '.strtoupper('Running update-alx on client #'.$client.' ('.$ip.')... '); + echo ' '; + echo ' '; + echo ''; + } + else echo 'unkown operation'; + } + + else echo ' '.strtoupper('Client not online, try again later... '); + } + echo ' |