From d2a1bba6b9f54a57a3f3b3ce01d500e2a4ece5b3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 28 Dec 2004 16:40:32 +0000 Subject: Allow additional files to be defined, downloaded and un tarred if need be. --- usr/local/www/pkg_mgr_install.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php index 49124c0..a8d4bb7 100755 --- a/usr/local/www/pkg_mgr_install.php +++ b/usr/local/www/pkg_mgr_install.php @@ -2,6 +2,7 @@ /dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/VPN >/dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/Status >/dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/Diagnostics >/dev/null 2>&1"); +mwexec("mkdir /usr/local/pkg >/dev/null 2>&1"); update_progress_bar($pb_percent); $pb_percent += 10; @@ -290,12 +292,26 @@ update_progress_bar($pb_percent); $pb_percent += 10; if ($pkgent['depends_on_package_base_url'] <> "") { - update_status("Downloading and installing " . $pkgent['name'] . " - " . $pkgent['depends_on_package_base_url'] . " and its dependencies ... This could take a moment ..."); + update_status("Downloading and installing " . $pkgent['name'] . " and its dependencies ... This could take a moment ..."); $text = exec_command_and_return_text("cd /tmp/ && /usr/sbin/pkg_add -r " . $pkgent['depends_on_package_base_url'] . "/" . $pkgent['depends_on_package']); update_output_window($text); fwrite($fd_log, "cd /tmp/ && /usr/sbin/pkg_add -r " . $pkgent['depends_on_package_base_url'] . "/" . $pkgent['depends_on_package'] . "\n" . $text);; } +// fetch additional files needed for package if defined +// and uncompress if needed. +if ($pkgent['additional_files_needed'] <> "") { + foreach($pkgent['additional_files_needed']['item'] as $afn) { + update_progress_bar($pb_percent); + $pb_percent += 10; + $filename = get_filename_from_url($afn['url']); + update_status("Downloading additional files needed for package " . $filename . " ..."); + system("cd /usr/local/pkg && /usr/bin/fetch " . $afn['url']); + if(stristr($filename, '.tgz') <> "") + system("cd /usr/local/pkg && tar xzvf " . $filename); + } +} + update_progress_bar($pb_percent); $pb_percent += 10; @@ -413,6 +429,12 @@ function add_text_to_file($file, $text) { fclose($fd); } +function get_filename_from_url($url) { + $filenamesplit = split("/", $url); + foreach($filenamesplit as $fn) $filename = $fn; + return $filename; +} + ?> -- cgit v1.1