@filemtime($cache) && $section == "main" || isset($_GET['debug'])) { if (is_dir("{$path}")) { $cache_extra = $config['data']."files/{$version}_{$class}_extra_{$arch}.txt"; system(" ( date touch $cache kill \$(ps ax | grep -v grep | grep 'dpkg-scanpackages -a $arch $class' | cut -b-5) 2>/dev/null cd $path echo 'cd $path; dpkg-scanpackages -a $arch $class' ( dpkg-scanpackages -a $arch $class test $? != 0 -a $? != 143 && dpkg-scanpackages -a $arch $class 2>&1 >/dev/null | mail -s 'Control file error for $arch $class' devel@clausmuus.de ) > $cache.$$.$$ sed '/Package: \(" . implode("\|", $GLOBALS['config']['extra_addons']) . "\)$/,/^$/d' $cache.$$.$$ > $cache.$$ touch -r $cache $cache.$$ mv -f $cache.$$ $cache sed -n '/Package: \(" . implode("\|", $GLOBALS['config']['extra_addons']) . "\)$/,/^$/p' $cache.$$.$$ > $cache_extra.$$ touch -r $cache $cache_extra.$$ mv -f $cache_extra.$$ $cache_extra rm -f $cache.$$.$$ echo ) >>{$config['data']}/addons.log 2>&1 &"); //system("cd {$path}/{$class}; dpkg-scanpackages {$arch} /dev/null {$class}/ 2>/dev/null > $cache"); } } if (!is_file($cache)) { $cache = "/dev/null"; } if (preg_match("/.bz2$/", $file)) { system("bzcat -z $cache 2>/dev/null"); } else { system("cat $cache 2>/dev/null"); } } if ($file == "InRelease") { $sections = array("main", "extra"); $archs = array(); if ($d = @dir("$path/$class/")) { if ($d = @dir("$path/$class/")) { while ($arch = $d->read()) { if (is_dir($d->path . $arch) && $arch != "." && $arch != "..") { $archs[] = $arch; } } } } else { $archs[] = "none"; } date_default_timezone_set('UTC'); $release = "Origin: MLD\nLabel: MiniDVBLinux Distribution\nSuite: $class\nVersion: $version\nDate: ".date("r")."\nArchitectures: ".implode(' ', $archs)."\nComponents: ".implode(' ', $sections)."\nDescription: MiniDVBLinux Distribution\nSHA256:\n"; foreach ($sections as $section) { foreach ($archs as $arch) { $cache = $config['data']."files/{$version}_{$class}_{$section}_{$arch}.txt"; if (!is_file("$cache")) { $cache = "/dev/null"; } $release .= " ".hash_file("sha256", "$cache")." ".filesize("$cache")." $section/binary-$arch/Packages\n"; } } system("echo '$release' | gpg2 --homedir /var/www/.gnupg --clearsign --digest-algo SHA256 --local-user 'minidvblinux' 2>/dev/null"); } if ($file == "archive.key") { system("gpg2 --homedir /var/www/.gnupg --armor --export 'minidvblinux' 2>/dev/null"); } } } } function listaddons($path, $dir) { $db = new Database ("data", $GLOBALS['config']['db']); $groupstates = array(); if ($d = @dir($path)) { while ($f = $d->read()) { if (is_dir($d->path . $f) && $f != "." && $f != "..") { listaddons($d->path . $f . "/", $dir); } else if (is_file($d->path . $f) && preg_match("/\d{2}_?MLD.*\.tgz$|MLD.*\.sfs$|MLD.*\.gz$/", $f, $erg) && (isset ($_GET['extra']) && $_GET['extra'] == "all" || !preg_match("/_" . implode("-|_", $GLOBALS['config']['extra_addons']) . "-/", $f, $erg)) ) { $state = 0; if ($db->query("SELECT state from state WHERE filename='$f'")) { $state = $db['state']; } if ($state == 0 && preg_match("/.+-.+_(.+)-(.+)_(.+)-.+_.+\.sfs/", $f, $erg)) { if (!isset ($groupstates[$erg[1]])) { if ($db->query("SELECT state FROM state WHERE name='$erg[1]' AND state>0 AND version LIKE '$erg[2]_%'")) { $groupstates[$erg[1]] = $db['state']; } else { $groupstates[$erg[1]] = 0; } } if ($groupstates[$erg[1]] > 0 && $db->query("SELECT state, version FROM state WHERE name='$erg[3]' AND state>0 ORDER BY version DESC LIMIT 1")) { $state = $groupstates[$erg[1]]; } } if (empty($class) || $class == "all" || $class == "devel" && $state >= 0 || $class == "stable" && $state > 0) { echo $_SERVER['ORIGIN'] . "/download.php?file=" . substr($d->path . $f . "\n", strlen($dir)); } } } $d->close(); } } ?>