]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- -f switch for rm and mv in %pre/%post
authorSebastian Zagrodzki <sebek@zagrodzki.net>
Mon, 19 Jun 2000 10:40:26 +0000 (10:40 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    adapter.awk -> 1.60

adapter.awk

index ce1c6fa4ff0edf17ebc7fe646ed0849dc3694f54..7685cf020d7a206f495faf8b256a408916ea074d 100644 (file)
@@ -176,11 +176,32 @@ defattr == 1 {
 }
 
 # Scripts
-/^%pre /, (/^[a-z]+$/ && !/^%pre /) { preamble = 0 }
-/^%preun/, (/^[a-z]+$/ && !/^%preun/) { preamble = 0 }
-/^%post /, (/^[a-z]+$/ && !/^%post /) {        preamble = 0 }
-/^%postun/, (/^[a-z]+$/ && !/^%postun/) { preamble = 0 }
-       
+script = 0
+/^%pre/, (/^[a-z]+$/ && !/^%pre/) { script = 1 }
+/^%preun/, (/^[a-z]+$/ && !/^%preun/) { script = 1 }
+/^%post/, (/^[a-z]+$/ && !/^%post/) {  script = 1 }
+/^%postun/, (/^[a-z]+$/ && !/^%postun/) { script = 1 }
+script == 1 {
+       preamble = 0
+       if ($1 ~ /^mv$/) {
+               if ($2 ~ /^-/)
+                       sub(/-[A-Za-z0-9]+ /, "", $0)
+               sub($1, "mv -f")
+       }
+       if ($1 ~ /^rm$/) {
+               recursive = 0
+               if ($2 ~ /^-/) {
+                       if (match($2, "r"))
+                               recursive = 1
+                       sub(/-[A-Za-z0-9]+ /, "", $0)
+               }
+               if (recursive)
+                       sub($1, "rm -rf")
+               else
+                       sub($1, "rm -f")
+       }
+}
+
 # %files section:
 /^%files/, (/^%[a-z \-]+$/ && !/^%files/) {
        preamble = 0
This page took 0.042408 seconds and 4 git commands to generate.