diff options
author | mcrane <mctch@yahoo.com> | 2009-06-13 15:01:06 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-06-13 15:02:26 -0600 |
commit | 7e7fb10565a04e82c507d83ddaa0061c725cb294 (patch) | |
tree | 34e832d3cd1ab73e4bbd733548b8af92132e0dcc /config | |
parent | d3eaa1837b5e99e8377658b7bc48a29abd7ac15c (diff) | |
download | pfsense-packages-7e7fb10565a04e82c507d83ddaa0061c725cb294.tar.gz pfsense-packages-7e7fb10565a04e82c507d83ddaa0061c725cb294.tar.bz2 pfsense-packages-7e7fb10565a04e82c507d83ddaa0061c725cb294.zip |
Backup and TFTP package change backup directory to /root/backup/
Diffstat (limited to 'config')
-rw-r--r-- | config/backup/backup.inc | 5 | ||||
-rw-r--r-- | config/backup/backup.tmp | 22 | ||||
-rw-r--r-- | config/backup/backup.xml | 2 | ||||
-rw-r--r-- | config/freeswitch/freeswitch.inc | 6 | ||||
-rw-r--r-- | config/tftp/tftp.inc | 9 | ||||
-rw-r--r-- | config/tftp/tftp.xml | 2 | ||||
-rw-r--r-- | config/tftp/tftp_files.tmp | 22 |
7 files changed, 39 insertions, 29 deletions
diff --git a/config/backup/backup.inc b/config/backup/backup.inc index fa2783d6..b6adfbc9 100644 --- a/config/backup/backup.inc +++ b/config/backup/backup.inc @@ -95,6 +95,11 @@ function php_install_command() if (!is_dir('/usr/local/www/packages/backup/')) { exec("mkdir /usr/local/www/packages/backup/"); } + + //create the backup directory + if (!is_dir('/root/backup/')) { + exec("mkdir /root/backup/"); + } //rename PHP files from .tmp to .php exec("cp /tmp/backup.tmp /usr/local/www/packages/backup/backup.php"); diff --git a/config/backup/backup.tmp b/config/backup/backup.tmp index 546f9c3e..10e03db3 100644 --- a/config/backup/backup.tmp +++ b/config/backup/backup.tmp @@ -46,9 +46,9 @@ if ($_GET['act'] == "del") { if ($_GET['a'] == "download") { if ($_GET['t'] == "backup") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'pfsense.bak.tgz'; - //system('cd /usr/local/;tar cvzf /tmp/pfsense.bak.tgz freeswitch'); + //system('cd /usr/local/;tar cvzf /root/backup/pfsense.bak.tgz freeswitch'); $i = 0; if (count($a_backup) > 0) { @@ -79,13 +79,13 @@ if ($_GET['a'] == "download") { if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'pfsense.bak.tgz'; //extract the tgz file - 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.' '); header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ; } else { @@ -98,9 +98,9 @@ if ($_GET['a'] == "other") { if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { $filename = 'pfsense.bak.tgz'; - move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tmp/" . $filename); - $savemsg = "Uploaded file to /tmp/" . htmlentities($_FILES['ulfile']['name']); - system('cd /; tar xvpfz /tmp/'.$filename.' '); + move_uploaded_file($_FILES['ulfile']['tmp_name'], "/root/backup/" . $filename); + $savemsg = "Uploaded file to /root/backup/" . htmlentities($_FILES['ulfile']['name']); + system('cd /; tar xvpfz /root/backup/'.$filename.' '); } @@ -183,13 +183,13 @@ if ($_GET["savemsg"]) { echo "<tr>\n"; echo "<td width='80%'>\n"; echo "<b>Backup / Restore</b><br />\n"; - echo "The 'backup' button will tar gzip the directories that are listed below to /tmp/pfsense.bak.tgz it then presents a file to download. \n"; - echo "If the backup file does not exist in /tmp/pfsense.bak.tgz then the 'restore' button will be hidden. \n"; + echo "The 'backup' button will tar gzip the directories that are listed below to /root/backup/pfsense.bak.tgz it then presents a file to download. \n"; + echo "If the backup file does not exist in /root/backup/pfsense.bak.tgz then the 'restore' button will be hidden. \n"; 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='backup.php?a=download&t=backup';\" />\n"; - if (file_exists('/tmp/pfsense.bak.tgz')) { + if (file_exists('/root/backup/pfsense.bak.tgz')) { echo " <input type='button' value='restore' onclick=\"document.location.href='backup.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; diff --git a/config/backup/backup.xml b/config/backup/backup.xml index a0f72ba2..b48a8e28 100644 --- a/config/backup/backup.xml +++ b/config/backup/backup.xml @@ -41,7 +41,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>Backup Settings</name> - <version>0.1.5</version> + <version>0.1.6</version> <title>Settings</title> <include_file>/usr/local/pkg/backup.inc</include_file> <menu> diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index cc8a00ea..6930c31f 100644 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -3202,9 +3202,9 @@ function freeswitch_php_install_command() if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } - - // if backup file exists restore it - if (!is_dir('/root/backup/')) { + + //create the backup directory + if (!is_dir('/root/backup/')) { exec("mkdir /root/backup/"); } 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 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>tftp Settings</name> - <version>1.0.5</version> + <version>1.0.6</version> <title>TFTP: Settings</title> <include_file>/usr/local/pkg/tftp.inc</include_file> <menu> 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 "<tr>\n"; echo "<td width='80%'>\n"; echo "<b>Backup / Restore</b><br />\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 "<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='/packages/tftp/tftp_files.php?a=download&t=backup';\" />\n"; - if (file_exists('/tmp/tftp.bak.tgz')) { + if (file_exists('/root/backup/tftp.bak.tgz')) { echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; |