From 0fa46e174897cd503da2ff023d47d130bcdc76e5 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 24 Apr 2015 14:08:28 -0300 Subject: Remove unused files --- config/tftp/tftp.inc | 296 --------------------------------------------- config/tftp/tftp.xml | 91 -------------- config/tftp/tftp_files.tmp | 257 --------------------------------------- 3 files changed, 644 deletions(-) delete mode 100644 config/tftp/tftp.inc delete mode 100644 config/tftp/tftp.xml delete mode 100644 config/tftp/tftp_files.tmp diff --git a/config/tftp/tftp.inc b/config/tftp/tftp.inc deleted file mode 100644 index e19d68bb..00000000 --- a/config/tftp/tftp.inc +++ /dev/null @@ -1,296 +0,0 @@ -10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; -} - - -function tftp_sync_package() -{ - - //global $config; - //sync_package_tftp_files(); - - //if (pkg_is_service_running('inetd')) { - // sync_package_tftp(); - //} - -} - - -function tftp_install_command() -{ - - global $config; - conf_mount_rw(); - config_lock(); - - if (!is_dir('/tftpboot')) { - // Create the directory - exec("mkdir /tftpboot"); - - //Set the directory permissions - exec("chmod -R 777 /tftpboot"); - - } - - 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"); - } - - if (!is_dir('/root/backup/')) { - // Create the backup directory - exec("mkdir /root/backup/"); - } - - - //rename PHP files from .tmp to .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 - $filename = "/etc/inetd.conf"; - $handle = fopen($filename,"rb"); - $contents = fread($handle, filesize($filename)); - fclose($handle); - - $handle = fopen($filename,"w"); - $contents = str_replace("#tftp", "tftp", $contents); - fwrite($handle, $contents); - unset($contents); - fclose($handle); - unset($filename); - - - // add a TFTP DHCP Option to the DHCP Server - $filename = "/usr/local/www/services_dhcp.php"; - $fout = fopen($filename,"r"); - $tmp = fread($fout, filesize($filename)); - fclose($fout); - - //tftp was not found in the string - if (strpos($tmp, "tftp") === false) { - $tmpsearch = "\$pconfig['netmask'] = \$config['dhcpd'][\$if]['netmask'];"; - $tmpreplace = "\$pconfig['netmask'] = \$config['dhcpd'][\$if]['netmask'];\n"; - $tmpreplace .= "\$pconfig['tftp'] = \$config['dhcpd'][\$if]['options']['tftp-server-name'];"; - $tmp = str_replace($tmpsearch, $tmpreplace, $tmp); - unset($tmpsearch, $tmpreplace); - - $tmpsearch = "\$config['dhcpd'][\$if]['filename'] = \$_POST['filename'];"; - $tmpreplace = "\$config['dhcpd'][\$if]['filename'] = \$_POST['filename'];\n"; - $tmpreplace .= " \$config['dhcpd'][\$if]['options']['tftp-server-name'] = \$_POST['tftp'];"; - $tmp = str_replace($tmpsearch, $tmpreplace, $tmp); - unset($tmpsearch, $tmpreplace); - - $tmpsearch = "function show_netboot_config() {"; - $tmpreplace = "function show_tftp_config() {\n"; - $tmpreplace .= " document.getElementById(\"showtftpbox\").innerHTML='';\n"; - $tmpreplace .= " aodiv = document.getElementById('showtftp');\n"; - $tmpreplace .= " aodiv.style.display = \"block\";\n"; - $tmpreplace .= "}\n"; - $tmpreplace .= "\n"; - $tmpreplace .= "function show_netboot_config() {"; - $tmp = str_replace($tmpsearch, $tmpreplace, $tmp); - unset($tmpsearch, $tmpreplace); - - $tmpsearch = "Enable Network booting"; - $tmpreplace .= ""; - //$tmpreplace = " \n"; - $tmpreplace .= "TFTP server\n"; - $tmpreplace .= " \n"; - $tmpreplace .= "
\n"; - $tmpreplace .= " - Show TFTP configuration\n"; - $tmpreplace .= "
\n"; - $tmpreplace .= "
\n"; - $tmpreplace .= " \">
\n"; - $tmpreplace .= "
\n"; - $tmpreplace .= " \n"; - $tmpreplace .= " \n"; - $tmpreplace .= "\n"; - $tmpreplace .= " \n"; - $tmpreplace .= " Enable Network booting"; - $tmpreplace .= "\n"; - $tmp = str_replace($tmpsearch, $tmpreplace, $tmp); - unset($tmpsearch, $tmpreplace); - - $fout = fopen($filename,"w"); - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); - } - unset($tmp, $filename); - - - - $filename = "/etc/inc/services.inc"; - $fout = fopen($filename,"r"); - $tmp = fread($fout, filesize($filename)); - fclose($fout); - - //tftp was not found in the string - if (strpos($tmp, "tftp") === false) { - $tmpsearch = "if (is_array(\$dhcpifconf['ntpserver']) && \$dhcpifconf['ntpserver'][0])"; - $tmpreplace = "if (isset(\$dhcpifconf['options']['tftp-server-name'])) {\n"; - $tmpreplace .= " \$dhcpdconf .= \" option tftp-server-name \\\"\".\$dhcpifconf['options']['tftp-server-name'].\"\\\";\".\"\\n\";\n"; - $tmpreplace .= " }\n"; - $tmpreplace .= " \n"; - $tmpreplace .= " if (is_array(\$dhcpifconf['ntpserver']) && \$dhcpifconf['ntpserver'][0])"; - $tmp = str_replace($tmpsearch, $tmpreplace, $tmp); - unset($tmpsearch, $tmpreplace); - - $fout = fopen($filename,"w"); - fwrite($fout, $tmp); - fclose($fout); - } - unset($tmp, $filename); - - - // if backup file exists restore it - $filename = 'tftp.bak.tgz'; - - //extract a specific directory to /usr/local/freeswitch - if (file_exists('/root/backup/'.$filename)) { - system('cd /; tar xvpfz /root/backup/tftp.bak.tgz'); - system('chmod -R 744 /tftpboot/*'); - unset($filename); - } - - write_rcfile(array( - "file" => "tftp.sh", - "start" => "/usr/sbin/inetd -l", - "stop" => "killall -9 inetd" - ) - ); - - - //tftp_sync_package(); - $handle = popen("/usr/sbin/inetd", "r"); - pclose($handle); - - //if (pkg_is_service_running('inetd')) { - // temp_sync_package(); - //} - - //conf_mount_ro(); - //config_unlock(); - -} - - -function tftp_deinstall_command() -{ - - //prepare inetd.conf for tftp - //tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot - - //pfsense 2.0 conflicting entry - //tftp dgram udp wait root /usr/local/sbin/tftp-proxy -v - - $filename = "/etc/inetd.conf"; - $handle = fopen($filename,"rb"); - $contents = fread($handle, filesize($filename)); - fclose($handle); - - $handle = fopen($filename,"w"); - $contents = str_replace("tftp dgram", "#tftp dgram", $contents); - $contents = str_replace("tftpd -l -s /tftpboot", "/usr/local/sbin/tftp-proxy -v", $contents); - fwrite($handle, $contents); - unset($contents); - fclose($handle); - unset($filename); - - exec("killall -9 inetd"); - - unlink_if_exists("/usr/local/pkg/tftp.xml"); - unlink_if_exists("/usr/local/pkg/tftp.inc"); - unlink_if_exists("/usr/local/www/packages/tftp/tftp_files.php"); - exec("rm -R /usr/local/www/packages/tftp/"); - - //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 deleted file mode 100644 index 18cf2e5a..00000000 --- a/config/tftp/tftp.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - Describe your package requirements here - Currently there are no FAQ items provided. - tftp Settings - 1.0.7 - TFTP: Settings - /usr/local/pkg/tftp.inc - - TFTP - Add or Remove files for TFTP. -
Services
- tftp.xml - /packages/tftp/tftp_files.php -
- - tftp - tftp.sh - inetd - TFTP daemon - - - - Files - /packages/tftp/tftp_files.php - - - installedpackages->package->$packagename->configuration->tftp - - /usr/local/pkg/ - 0755 - https://packages.pfsense.org/packages/config/tftp/tftp.inc - - - /tmp/ - 0755 - https://packages.pfsense.org/packages/config/tftp/tftp_files.tmp - - - - - tftp_sync_package(); - - - tftp_sync_package(); - - - tftp_install_command(); - - - tftp_deinstall_command(); - -
\ No newline at end of file diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp deleted file mode 100644 index a55e92c6..00000000 --- a/config/tftp/tftp_files.tmp +++ /dev/null @@ -1,257 +0,0 @@ - - - - -

TFTP: Files

- - - -
- - -
- -
- - - - \n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
- - - - - -

TFTP files
-
- Trivial File Transport Protocol is a very simple file transfer - protocol. Use the file upload to add files to the /tftpboot directory. - Click on the file from the file list below to download it. -

-
- - -
-
- - - - - - - - - - - -
File to upload: - -
    -
-
- - -
-
- - \n"; - echo "
\n"; - echo "Backup / Restore
\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"; - if (file_exists('/root/backup/tftp.bak.tgz')) { - echo " \n"; - } - echo "
\n"; - echo "

\n\n"; - ?> - - - - - - - - - - \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - - } - } - closedir($handle); - } - ?> - - - - - -
File Name (download)Last ModifiedSize
\n"; - echo " \n"; - echo " $file"; - echo " "; - echo " \n"; - echo date ("F d Y H:i:s", filemtime('/tftpboot/'.$file)); - echo " \n"; - echo " ".$tftp_filesize; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
- - -
-
-
-
-
-
- - - - - -
- - - - -- cgit v1.2.3