From 7e7fb10565a04e82c507d83ddaa0061c725cb294 Mon Sep 17 00:00:00 2001 From: mcrane Date: Sat, 13 Jun 2009 15:01:06 -0600 Subject: Backup and TFTP package change backup directory to /root/backup/ --- config/tftp/tftp.inc | 9 +++++++-- config/tftp/tftp.xml | 2 +- config/tftp/tftp_files.tmp | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 14 deletions(-) (limited to 'config/tftp') diff --git a/config/tftp/tftp.inc b/config/tftp/tftp.inc index 40aed550..a6d91af9 100644 --- a/config/tftp/tftp.inc +++ b/config/tftp/tftp.inc @@ -118,6 +118,11 @@ function php_install_command() // Create the tftp directory exec("mkdir /usr/local/www/packages/tftp"); } + + if (!is_dir('/root/backup/')) { + // Create the backup directory + exec("mkdir /root/backup/"); + } //rename PHP files from .tmp to .php @@ -225,8 +230,8 @@ function php_install_command() $filename = 'tftp.bak.tgz'; //extract a specific directory to /usr/local/freeswitch - if (file_exists('/tmp/'.$filename)) { - system('cd /; tar xvpfz /tmp/tftp.bak.tgz'); + if (file_exists('/root/backup/'.$filename)) { + system('cd /; tar xvpfz /root/backup/tftp.bak.tgz'); system('chmod -R 744 /tftpboot/*'); unset($filename); } diff --git a/config/tftp/tftp.xml b/config/tftp/tftp.xml index d8f1ea0b..9496363e 100644 --- a/config/tftp/tftp.xml +++ b/config/tftp/tftp.xml @@ -41,7 +41,7 @@ Describe your package requirements here Currently there are no FAQ items provided. tftp Settings - 1.0.5 + 1.0.6 TFTP: Settings /usr/local/pkg/tftp.inc diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp index a5fb5ecc..92d34e70 100644 --- a/config/tftp/tftp_files.tmp +++ b/config/tftp/tftp_files.tmp @@ -33,14 +33,14 @@ require("/usr/local/pkg/tftp.inc"); $filename = $_GET['filename']; if (($_GET['a'] == "download") && $_GET['t'] == "backup") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'tftp.bak.tgz'; - system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot'); + system('cd /;tar cvzf /root/backup/tftp.bak.tgz tftpboot'); } -if (($_GET['a'] == "download") && file_exists("/tmp/".$filename)) { +if (($_GET['a'] == "download") && file_exists("/root/backup/".$filename)) { session_cache_limiter('public'); - $fd = fopen("/tmp/".$filename, "rb"); + $fd = fopen("/root/backup/".$filename, "rb"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); @@ -48,7 +48,7 @@ if (($_GET['a'] == "download") && file_exists("/tmp/".$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("/tmp/".$filename)); + header("Content-Length: " . filesize("/root/backup/".$filename)); fpassthru($fd); exit; } @@ -56,13 +56,13 @@ if (($_GET['a'] == "download") && file_exists("/tmp/".$filename)) { if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'tftp.bak.tgz'; //extract a specific directory to /tftpboot - if (file_exists('/tmp/'.$filename)) { + if (file_exists('/root/backup/'.$filename)) { //echo "The file $filename exists"; - system('cd /; tar xvpfz /tmp/'.$filename); + system('cd /; tar xvpfz /root/backup/'.$filename); system('chmod -R 744 /tftpboot/*'); header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ; } @@ -164,14 +164,14 @@ if ($savemsg) { echo "\n"; echo "\n"; echo "Backup / Restore
\n"; - echo "The 'backup' button will tar gzip /tftpboot/ to /tmp/tftp.bak.tgz it then presents a file to download. \n"; - echo "If the backup file does not exist in /tmp/tftp.bak.tgz then the 'restore' button will be hidden. \n"; + echo "The 'backup' button will tar gzip /tftpboot/ to /root/backup/tftp.bak.tgz it then presents a file to download. \n"; + echo "If the backup file does not exist in /root/backup/tftp.bak.tgz then the 'restore' button will be hidden. \n"; echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n"; echo "

\n"; echo "\n"; echo "\n"; echo " \n"; - if (file_exists('/tmp/tftp.bak.tgz')) { + if (file_exists('/root/backup/tftp.bak.tgz')) { echo " \n"; } echo "\n"; -- cgit v1.2.3