[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#642396: live-config: In function Cmdline file existence is ignored during _SCRIPTS list construction.



2011/9/22 Daniel Baumann <daniel.baumann@progress-technologies.net>:
> On 09/22/2011 02:53 PM, Stanislav Bogatyrev wrote:
>>
>> Here is the better patch.
> if you would like me to apply the patch literally, you would need to change
> the following things:
>
>  * fix broken indenting
done

>  * use '2> /dev/null', not '2>/dev/null'
done

>  * add proper commit message according to the pattern:
>    'Doing foo to fix bar (Closes: #nnnnnn).'
done

> plus adding the if check when sourcing the scripts at the end, otherwise
> it's solving the problem only half (though you can make two commits if you
> want, i don't mind).
There is no need to do that since non-existent files are not added to the list.
Also I have found that in some cases the resulting list contains
duplicated items in unsorted order.
Since it's the part of the same _scripts list construction problem
let's do the sorting in the end.

Thank You for your patience!

-- 
WBR realloc()
commit 7ec2dfcdd81965c5cb4333f9b1316247ad111809
Author: Stanislav Bogatyrev <realloc@realloc.spb.ru>
Date:   Thu Sep 22 16:42:57 2011 +0400

    Check file existence during _SCRIPTS list construction and make sure the resulting list has only unique items (Closes: #642396).

diff --git a/scripts/config.sh b/scripts/config.sh
index a8c1c00..73a76d3 100755
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -91,7 +91,7 @@ Cmdline ()
 	then
 		for _CONFIG in $(echo ${LIVE_CONFIGS} | sed -e 's|,| |g')
 		do
-			_SCRIPTS="${_SCRIPTS} $(ls /lib/live/config/???-${_CONFIG})"
+			_SCRIPTS="${_SCRIPTS} $(ls /lib/live/config/???-${_CONFIG} 2> /dev/null || true)"
 		done
 	fi
 
@@ -100,7 +100,7 @@ Cmdline ()
 	then
 		for _NOCONFIG in $(echo ${LIVE_NOCONFIGS} | sed -e 's|,| |g')
 		do
-			_SCRIPTS="$(echo ${_SCRIPTS} | sed -e "s|$(ls /lib/live/config/???-${_NOCONFIG})||")"
+			_SCRIPTS="$(echo ${_SCRIPTS} | sed -e "s|$(ls /lib/live/config/???-${_NOCONFIG} 2> /dev/null || echo none)||")"
 		done
 	fi
 }
@@ -191,6 +191,8 @@ Main ()
 		set -x
 	fi
 
+	_SCRIPTS="$(echo ${_SCRIPTS} | sed -e 's/ /\n/g' | sort | uniq)"
+
 	# Configuring system
 	for _SCRIPT in ${_SCRIPTS}
 	do

Reply to: