X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=tar.php;h=342fc99fc8c7b044aa1dc3fcb3178e65307b19d1;hb=a1011831f5cf76e4cb8b1c0b5c5332cd82ca2d7b;hp=f514a6b95df47e510d28761b6fa9f4892327df6b;hpb=22d5fb7ab7d4ee86bd59e194387dca268bd577a1;p=wfpl.git diff --git a/tar.php b/tar.php index f514a6b..342fc99 100644 --- a/tar.php +++ b/tar.php @@ -50,11 +50,22 @@ function make_tar($dirname, $files, $extra = '') { } mkdir("$tmpdir/$dirname"); foreach($files as $filename => $file_data) { + if(substr($filename, -3) == ' ->') { + $filename = substr($filename, 0, -3); + $link = true; + } else { + $link = false; + } $filename_fixed = ereg_replace('[^a-zA-Z0-9_.-]', '', $filename); if($filename != $filename_fixed) { die("Invalid filename for tar archive"); } - write_file("$tmpdir/$dirname/$filename", $file_data); + if($link) { + $target = ereg_replace('[^a-zA-Z0-9_./-]', '', $file_data); + system("/bin/ln -s $file_data \"$tmpdir/$dirname/$filename\""); + } else { + write_file("$tmpdir/$dirname/$filename", $file_data); + } } if(function_exists($extra)) { @@ -73,9 +84,8 @@ function make_wfpl_tar($dirname, $files) { function add_wfpl_dir($dir) { mkdir("$dir/code"); - system("/bin/cp -HRp 'code/wfpl' '$dir/code/'", $return_code); + system("rsync -plr --exclude=\".git\" --exclude=\"*.swp\" 'code/wfpl/' '$dir/code/wfpl/'", $return_code); if($return_code != 0) { - die("ERROR: while trying to copy wfpl into archive: cp returned $return_code"); + die("ERROR: while trying to copy wfpl into archive: rsync returned $return_code"); } - system("/bin/rm -rf '$dir/code/wfpl/.git'"); }