Commit 10bbec85 authored by Vitaly Lipatov's avatar Vitaly Lipatov

repack.d/common.h: skip *_file/dir with empty arg

parent c2dfa76a
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
remove_file() remove_file()
{ {
local file="$1" local file="$1"
[ -n "$file" ] || return
[ -e "$BUILDROOT$file" ] || [ -L "$BUILDROOT$file" ] || return [ -e "$BUILDROOT$file" ] || [ -L "$BUILDROOT$file" ] || return
rm -v "$BUILDROOT$file" rm -v "$BUILDROOT$file"
...@@ -13,6 +14,7 @@ remove_file() ...@@ -13,6 +14,7 @@ remove_file()
remove_dir() remove_dir()
{ {
local file="$1" local file="$1"
[ -n "$file" ] || return
[ -d "$BUILDROOT$file" ] || return [ -d "$BUILDROOT$file" ] || return
rm -rv "$BUILDROOT$file" rm -rv "$BUILDROOT$file"
...@@ -23,9 +25,11 @@ remove_dir() ...@@ -23,9 +25,11 @@ remove_dir()
# Usage: pack_file <path_to_file> # Usage: pack_file <path_to_file>
pack_file() pack_file()
{ {
grep -q "^$1$" $SPEC && return local file="$1"
grep -q "\"$1\"" $SPEC && return [ -n "$file" ] || return
subst "s|%files|%files\n$1|" $SPEC grep -q "^$file$" $SPEC && return
grep -q "\"$file\"" $SPEC && return
subst "s|%files|%files\n$file|" $SPEC
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment