From 8d795d1760f28bedfe605515c7c770389768b5fb Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 11 Aug 2011 06:28:16 +0000 Subject: lbu: do not edit users config Cope with empty lines in include/exclude without editing the file ref #713 --- lbu.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lbu.in') diff --git a/lbu.in b/lbu.in index a84e569..5d74b3d 100644 --- a/lbu.in +++ b/lbu.in @@ -265,7 +265,7 @@ cmd_package() { local rc=0 local owd="$PWD" local suff="apkovl.tar.gz" - local tmpdir tmppkg + local tmpdir tmppkg tmpexclude tmpinclude check_openssl init_tmpdir tmpdir @@ -284,6 +284,8 @@ cmd_package() { fi tmppkg="$tmpdir/$(basename $pkg)" + tmpexclude="$tmpdir"/exclude + tmpinclude="$tmpdir"/include cd "${ROOT:-/}" # remove old package.list @@ -293,8 +295,16 @@ cmd_package() { rm -f etc/lbu/packages.list fi # create tar archive - [ -f "$EXCLUDE_LIST" ] && sed -i '/^$/d' "$EXCLUDE_LIST" && excl="-X $EXCLUDE_LIST" - [ -f "$INCLUDE_LIST" ] && sed -i '/^$/d' "$INCLUDE_LIST" && incl="-T $INCLUDE_LIST" + if [ -f "$EXCLUDE_LIST" ]; then + # strip empty lines and lines with only whitespace + sed -e '/^[[:space:]]*$/d' "$EXCLUDE_LIST" > $tmpexclude + excl="-X $tmpexclude" + fi + if [ -f "$INCLUDE_LIST" ]; then + # strip empty lines and lines with only whitespace + sed -e '/^[[:space:]]*$/d' "$INCLUDE_LIST" > $tmpinclude + incl="-T $tmpinclude" + fi if [ -n "$VERBOSE" ]; then echo "Archiving the following files:" >&2 # we dont want to mess the tar output with the -- cgit v1.2.3