commit 025c8efa5e9b329fbc52b4fa61b6ece3c71800d2
parent 1c34a1eaa405da8e0f5476beb983bb1fba429d4f
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Mon, 26 May 2014 11:12:33 +0200
print out rsync filters
Diffstat:
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/bin/fileset.awk b/bin/fileset.awk
@@ -42,6 +42,14 @@ function print_e(str) { # print end block
print indent str
}
+function print_rsfilter(str) {
+ if ("RSFILTER" in ENVIRON) {
+ print str >>ENVIRON["RSFILTER"]
+ } else {
+ print str >>"/dev/stderr"
+ }
+}
+
# take tab-delimited token from statement variable and return it
function get_till_tab( result) {
if(match(statement, /\t/)) {
@@ -77,6 +85,7 @@ function process_statement() {
# set current fname all subsequent operations will be performed on
if(cchar == "/") {
+ curpath = crest
# fix up the path
if(match(crest, "/+$")) {
crest = substr(crest, 1, length(crest) - RLENGTH)
@@ -90,6 +99,16 @@ function process_statement() {
continue
}
+ if(cchar == "+") {
+ print_rsfilter("+ /" curpath crest)
+ continue
+ }
+
+ if(cchar == "-") {
+ print_rsfilter("- /" curpath crest)
+ continue
+ }
+
if(cchar == "o") {
print_d("chown "crest" "fname)
continue