44 |
ssh_editvar('SMB_UPDATE_PASS', $smbpassword, '/etc/alxconfig-ng/config.rc'); |
ssh_editvar('SMB_UPDATE_PASS', $smbpassword, '/etc/alxconfig-ng/config.rc'); |
45 |
} |
} |
46 |
|
|
47 |
|
// get alx version info |
48 |
|
$alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$client); |
49 |
|
$alxos = $alxinfo[os]; |
50 |
|
$alxutils = $alxinfo[utils]; |
51 |
|
|
52 |
// always update the client settings first |
// always update the client settings first |
53 |
update_client_settings(); |
update_client_settings(); |
54 |
|
|
55 |
if($op=="calc") |
if($op=="calc") |
56 |
{ |
{ |
57 |
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>'); |
58 |
$out = sshdo('NOCOLORS=true /sbin/mage uppretend | egrep "\[.*\]" | sed "s:\[.*\]\ \(.*\):\1:" | sed "s:/:,:" | sed "s:\(.*\)-:\1,:" | sed "s:\(.*\)-:\1,:"', $ip); |
|
59 |
|
if($alxos >= '0.6.0') { |
60 |
|
$out = sshdo('NOCOLORS=true /sbin/mage uppretend | egrep "\[.*\]" | sed "s:\[.*\]\ \(.*\):\1:" | sed "s:/:,:" | sed "s:\(.*\)-:\1,:" | sed "s:\(.*\)-:\1,:"', $ip); |
61 |
|
} |
62 |
|
else { |
63 |
|
$out = sshdo('NOCOLORS=true /sbin/mageupgrade --calc-bash', $ip); |
64 |
|
} |
65 |
echo '<pre>'; |
echo '<pre>'; |
66 |
echo '<table border="0">'; |
echo '<table border="0">'; |
67 |
if (array_key_exists("0", $out[1])) |
if (array_key_exists("0", $out)) |
68 |
{ |
{ |
69 |
foreach( $out[1] as $i) |
foreach( $out as $i) |
70 |
{ |
{ |
71 |
$item=explode(",",$i); |
// element 0 is always 0 |
72 |
$pcat=$item[0]; |
if ($i=="0") continue; |
73 |
$pname=$item[1]; |
|
74 |
$pver=$item[2]; |
$row=explode("\n", $i); |
75 |
$pbuild=$item[3]; |
foreach( $row as $x) |
76 |
|
{ |
77 |
echo '<tr><td>'; |
//ignore empty rows |
78 |
echo '<font color=green>'.$pcat.'/'.$pname.'</font>'; |
//(the last one may empty) |
79 |
echo '<td>'; |
if ($x=="") continue; |
80 |
echo '<font color=blue> => [ '.$pver.'-'.$pbuild.' ] </font>'; |
|
81 |
echo '</td>'; |
$item=explode(",",trim($x)); |
82 |
echo '</td></tr>'; |
$pcat=$item[0]; |
83 |
|
$pname=$item[1]; |
84 |
|
$pver=$item[2]; |
85 |
|
$pbuild=$item[3]; |
86 |
|
|
87 |
|
echo '<tr><td>'; |
88 |
|
echo '<font color=green>'.$pcat.'/'.$pname.'</font>'; |
89 |
|
echo '<td>'; |
90 |
|
echo '<font color=blue> => [ '.$pver.'-'.$pbuild.' ] </font>'; |
91 |
|
echo '</td>'; |
92 |
|
echo '</td></tr>'; |
93 |
|
} |
94 |
} |
} |
95 |
} |
} |
96 |
else echo 'No updates for client '.$client.' available.'; |
else echo 'No updates for client '.$client.' available.'; |