[scripts] mkloopcard.txt: make PATHS_TO_* env vars parsing more robust

This commit is contained in:
Fabio Erculiani 2011-12-30 00:25:58 +01:00
parent e14d4e5cf2
commit 774ee5debf

View File

@ -138,10 +138,8 @@ echo "rc-update add sshd default" | chroot "${tmp_dir}"
echo "rc-update add net.eth0 default" | chroot "${tmp_dir}" echo "rc-update add net.eth0 default" | chroot "${tmp_dir}"
# work out paths to empty and paths to remove # work out paths to empty and paths to remove
oldifs="${IFS}"
IFS=";"
if [ -n "${PATHS_TO_REMOVE}" ]; then if [ -n "${PATHS_TO_REMOVE}" ]; then
for path in ${PATHS_TO_REMOVE}; do for path in $(echo ${PATHS_TO_REMOVE} | tr ";" "\n"); do
path="${tmp_dir}/${path}" path="${tmp_dir}/${path}"
if [ -e "${path}" ]; then if [ -e "${path}" ]; then
echo "Removing: ${path}" echo "Removing: ${path}"
@ -150,7 +148,7 @@ if [ -n "${PATHS_TO_REMOVE}" ]; then
done done
fi fi
if [ -n "${PATHS_TO_EMPTY}" ]; then if [ -n "${PATHS_TO_EMPTY}" ]; then
for path in ${PATHS_TO_EMPTY}; do for path in $(echo ${PATHS_TO_EMPTY} | tr ";" "\n"); do
path="${tmp_dir}/${path}" path="${tmp_dir}/${path}"
if [ -d "${path}" ]; then if [ -d "${path}" ]; then
echo "Emptying: ${path}" echo "Emptying: ${path}"
@ -158,7 +156,6 @@ if [ -n "${PATHS_TO_EMPTY}" ]; then
fi fi
done done
fi fi
IFS="${oldifs}"
if [ -n "${RELEASE_FILE}" ]; then if [ -n "${RELEASE_FILE}" ]; then
release_file="${tmp_dir}"/"${RELEASE_FILE}" release_file="${tmp_dir}"/"${RELEASE_FILE}"