Index: make_factory_package.sh |
diff --git a/make_factory_package.sh b/make_factory_package.sh |
index 9a44f71dd24d6d9e8a4a48495365578492c13b6d..6b4ad0757d665f21260ef403795495b991360167 100755 |
--- a/make_factory_package.sh |
+++ b/make_factory_package.sh |
@@ -166,7 +166,34 @@ fi |
if [ -n "${FLAGS_subfolder}" ] && \ |
[ -f "${OMAHA_DIR}"/miniomaha.conf"" ] ; then |
# Remove the ']' from the last line of the file so we can add another config. |
- sed -i '$d' ${OMAHA_DIR}/miniomaha.conf |
+ while [ true ] |
Hung-Te
2010/11/10 05:10:27
you don't need the []. Simply a "while true; do" w
|
+ do |
+ # If the last line is null |
+ if [ -z `tail -1 ${OMAHA_DIR}/miniomaha.conf` ]; |
Hung-Te
2010/11/10 05:10:27
Please use -z "$(tail -l "${OMAHA_DIR}/miniomaha.c
|
+ then |
+ sed '$d' < ${OMAHA_DIR}/miniomaha.conf > /tmp/tmp.txt |
+ mv /tmp/tmp.txt ${OMAHA_DIR}/miniomaha.conf |
Hung-Te
2010/11/10 05:10:27
Please replace this by
sed -i '$d' "${OMAHA_DIR}/m
|
+ else |
+ # If the last line is some other character that is not ] then it is |
+ # garbage and we don't need it |
+ if [ `tail -1 ${OMAHA_DIR}/miniomaha.conf` != ']' ]; |
+ then |
Hung-Te
2010/11/10 05:10:27
"if []; then" is better.
|
+ sed '$d' < ${OMAHA_DIR}/miniomaha.conf > /tmp/tmp.txt |
+ mv /tmp/tmp.txt ${OMAHA_DIR}/miniomaha.conf |
Hung-Te
2010/11/10 05:10:27
Please replace sed+mv with "sed -i"
|
+ else |
+ # Otherwise it is the ] we are looking for |
+ sed '$d' < ${OMAHA_DIR}/miniomaha.conf > /tmp/tmp.txt |
+ mv /tmp/tmp.txt ${OMAHA_DIR}/miniomaha.conf |
Hung-Te
2010/11/10 05:10:27
Please replace sed+mv by "sed -i"
|
+ break |
+ fi |
+ fi |
+ # If the file is empty, add what we need and break |
+ if [ ! -s ${OMAHA_DIR}/miniomaha.conf ]; |
+ then |
+ echo -e "config = [" > ${OMAHA_DIR}/miniomaha.conf |
Hung-Te
2010/11/10 05:10:27
You don't need the "-e" since you don't have escap
|
+ break |
+ fi |
+ done |
else |
echo -e "config = [" > ${OMAHA_DIR}/miniomaha.conf |
fi |