> /tmp/php.apt_history.log"); exec('cat /tmp/php.apt_history.log |egrep --regexp=\'^Commandline:\sapt-get\s[(install)(remove)(purge)]\'|awk \'{print $3" "$4}\'', $list); $i = 0; $j = 0; foreach($list as $entry) { $history=explode(" ", $entry); if($history[0] == "autoremove" || $history[0] == "upgrade")continue; $history[0] == "install" ? ($packages[$history[1]]=true):($packages[$history[1]]=false); } foreach($packages as $package => $stat) { $stat ? ($ipackage[$i ++] = $package):($rpackage[$j ++] = $package); } $i = sizeOf($ipackage); $j = sizeOf($rpackage); $l = $i > $j ? $i:$j; echo "Custom package activities(apt-get):\n"; echo "+---------------------------------------------------------+\n"; echo "| Package(s) installed | Package(s) removed |\n"; echo "|----------------------------+----------------------------|\n"; $ll = .5*(strlen("+---------------------------------------------------------+") - 3); for($k = 0; $k < $l; $k ++) { $il = str_pad($k < $i ? $ipackage[$k]:"", $ll, " ", STR_PAD_BOTH); $rl = str_pad($k < $j ? $rpackage[$k]:"", $ll, " ", STR_PAD_BOTH); echo "|$il|$rl|\n"; } echo "+---------------------------------------------------------+\n";