Fix cleanup and diff.
[nethome.git] / bin / gdbunpack
index 04e23b9..49ec86a 100755 (executable)
@@ -44,26 +44,31 @@ for log in $args;do
        fi
        if ! (cd "$base";uudecode) <"$log";then
                echo >&2 "Error <$log>: uudecode"
+               rm -rf "$base"
                rc=1
                continue
        fi
        if echo -n "$base"/*|grep ' ';then
                echo >&2 "Error <$log>: Too many files in: $base"
+               rm -rf "$base"
                rc=1
                continue
        fi
        if ! (echo -n "$base"/*|grep -q '[.]tar[.]bz2$');then
                echo >&2 "Error <$log>: Invalid file:" "$base"/*
+               rm -rf "$base"
                rc=1
                continue
        fi
        if ! (cd "$base";tar xjf *);then
                echo >&2 "Error <$log>: tar xjf"
+               rm -rf "$base"
                rc=1
                continue
        fi
        rm -f "$base"/*.tar.bz2
        chmod -x "$base"/*
+       perl -i -pe 's{\Q'"$HOME"'\E/.*?/build/[^/]*/}{}g' "$base"/*
 #      if ! (echo "$base"/*|grep -q '^[^ ]*[.]log [^ ]*[.]sum$');then
 #              echo >&2 "Error <$log>: Not two files .log+.sum:" "$base"/*
 #              exit 1