diff options
Diffstat (limited to 'config/tftp')
-rw-r--r-- | config/tftp/tftp.inc | 20 | ||||
-rw-r--r-- | config/tftp/tftp.xml | 6 | ||||
-rw-r--r-- | config/tftp/tftp_files.tmp | 29 |
3 files changed, 31 insertions, 24 deletions
diff --git a/config/tftp/tftp.inc b/config/tftp/tftp.inc index a7053df9..40aed550 100644 --- a/config/tftp/tftp.inc +++ b/config/tftp/tftp.inc @@ -109,14 +109,19 @@ function php_install_command() } - if (!is_dir('/usr/local/www/tftp')) { - // Create the directory - exec("mkdir /usr/local/www/tftp"); + if (!is_dir('/usr/local/www/packages/')) { + // Create the packages directory + exec("mkdir /usr/local/www/packages/"); + } + + if (!is_dir('/usr/local/www/packages/tftp')) { + // Create the tftp directory + exec("mkdir /usr/local/www/packages/tftp"); } //rename PHP files from .tmp to .php - exec("cp /tmp/tftp_files.tmp /usr/local/www/tftp/tftp_files.php"); + exec("cp /tmp/tftp_files.tmp /usr/local/www/packages/tftp/tftp_files.php"); unlink_if_exists("/tmp/tftp_files.tmp"); //prepare inetd.conf for tftp @@ -228,7 +233,7 @@ function php_install_command() write_rcfile(array( "file" => "tftp.sh", - "start" => "/usr/sbin/inetd", + "start" => "/usr/sbin/inetd -l", "stop" => "killall -9 inetd" ) ); @@ -268,9 +273,10 @@ function php_deinstall_command() unlink_if_exists("/usr/local/pkg/tftp.xml"); unlink_if_exists("/usr/local/pkg/tftp.inc"); - unlink_if_exists("/usr/local/www/tftp/tftp_files.php"); + unlink_if_exists("/usr/local/www/packages/tftp/tftp_files.php"); + exec("rm -R /usr/local/www/packages/tftp/"); - exec("rm -R /tftpboot"); + //exec("rm -R /tftpboot"); unlink_if_exists("/usr/local/etc/rc.d/tftp.sh"); unlink_if_exists("/tmp/pkg_mgr_tftp.log"); diff --git a/config/tftp/tftp.xml b/config/tftp/tftp.xml index e7b69d6b..d8f1ea0b 100644 --- a/config/tftp/tftp.xml +++ b/config/tftp/tftp.xml @@ -41,7 +41,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>tftp Settings</name> - <version>1.0.2</version> + <version>1.0.5</version> <title>TFTP: Settings</title> <include_file>/usr/local/pkg/tftp.inc</include_file> <menu> @@ -49,7 +49,7 @@ <tooltiptext>Add or Remove files for TFTP.</tooltiptext> <section>Services</section> <configfile>tftp.xml</configfile> - <url>/tftp/tftp_files.php</url> + <url>/packages/tftp/tftp_files.php</url> </menu> <service> <name>tftp</name> @@ -60,7 +60,7 @@ <tabs> <tab> <text>Files</text> - <url>/tftp/tftp_files.php</url> + <url>/packages/tftp/tftp_files.php</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->tftp</configpath> diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp index f49ea76e..a5fb5ecc 100644 --- a/config/tftp/tftp_files.tmp +++ b/config/tftp/tftp_files.tmp @@ -37,18 +37,18 @@ if (($_GET['a'] == "download") && $_GET['t'] == "backup") { $filename = 'tftp.bak.tgz'; system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot'); } -if (($_GET['a'] == "download") && file_exists("/tftpboot/".$filename)) { - +if (($_GET['a'] == "download") && file_exists("/tmp/".$filename)) { + session_cache_limiter('public'); - $fd = fopen("/tftpboot/".$filename, "rb"); + $fd = fopen("/tmp/".$filename, "rb"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize("/tftpboot/".$filename)); + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header("Content-Length: " . filesize("/tmp/".$filename)); fpassthru($fd); exit; } @@ -58,18 +58,18 @@ if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { $tmp = '/tmp/'; $filename = 'tftp.bak.tgz'; - + //extract a specific directory to /tftpboot if (file_exists('/tmp/'.$filename)) { //echo "The file $filename exists"; system('cd /; tar xvpfz /tmp/'.$filename); - system('chmod -R 744 /tftpboot/*'); + system('chmod -R 744 /tftpboot/*'); header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ; } else { header( 'Location: tftp_files.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; - } - + } + exit; } } @@ -99,7 +99,8 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <p class="pgtitle">TFTP: Files</p> -<?php +<?php +$savemsg = $_GET["savemsg"]; if ($savemsg) { print_info_box($savemsg); } @@ -111,7 +112,7 @@ if ($savemsg) { <?php $tab_array = array(); - $tab_array[] = array(gettext("Files"), false, "/tftp/tftp_files.php"); + $tab_array[] = array(gettext("Files"), false, "/packages/tftp/tftp_files.php"); display_top_tabs($tab_array); ?> @@ -169,9 +170,9 @@ if ($savemsg) { echo "<br /><br />\n"; echo "</td>\n"; echo "<td width='20%' valign='middle' align='right'>\n"; - echo " <input type='button' value='backup' onclick=\"document.location.href='/tftp/tftp_files.php?a=download&t=backup';\" />\n"; + echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=download&t=backup';\" />\n"; if (file_exists('/tmp/tftp.bak.tgz')) { - echo " <input type='button' value='restore' onclick=\"document.location.href='/tftp/tftp_files.php?a=other&t=restore';\" />\n"; + echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; echo "</tr>\n"; |