aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-13 12:23:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-13 12:23:49 +0000
commitbea787945d73807372db96147bdd1e0795b334cc (patch)
tree94500b1f5d054ae7feb1e725ac64a07369850b8f
parentc50dc147dc31f551994ec06b1be5b49e98867746 (diff)
downloadpaludis-bea787945d73807372db96147bdd1e0795b334cc.tar.gz
paludis-bea787945d73807372db96147bdd1e0795b334cc.tar.xz
Quoting fixes
-rw-r--r--ebuild/builtin_init.bash5
-rw-r--r--ebuild/builtin_merge.bash8
-rwxr-xr-xebuild/utils/merge18
-rwxr-xr-xebuild/utils/unmerge14
4 files changed, 24 insertions, 21 deletions
diff --git a/ebuild/builtin_init.bash b/ebuild/builtin_init.bash
index 959205b..ebf289e 100644
--- a/ebuild/builtin_init.bash
+++ b/ebuild/builtin_init.bash
@@ -19,10 +19,12 @@
builtin_init()
{
+ export ROOT="${ROOT//+(\/)//}"
+
local a
for a in P PV PR PN PVR PF CATEGORY FILESDIR ECLASSDIR PORTDIR \
DISTDIR KV PALUDIS_TMPDIR PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR \
- USERLAND KERNEL ARCH CHOST PALUDIS_COMMAND ; do
+ USERLAND KERNEL ARCH CHOST PALUDIS_COMMAND ROOT ; do
[[ -z "${!a}" ]] && die "\$${a} unset or empty"
declare -r ${a}="${!a}"
done
@@ -46,6 +48,7 @@ builtin_init()
export HOME="${T}"
export D="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/image/"
+ export D="${D//+(\/)//}"
mkdir -p "${D}" || die "Couldn't create \$D (\"${D}\")"
declare -r D="${D}"
diff --git a/ebuild/builtin_merge.bash b/ebuild/builtin_merge.bash
index 3c1be6a..c727bad 100644
--- a/ebuild/builtin_merge.bash
+++ b/ebuild/builtin_merge.bash
@@ -25,7 +25,7 @@ builtin_merge()
local olddotglob=$?
shopt -s dotglob
- local dbdir="${ROOT}"/var/db/pkg/"${CATEGORY}/${PF}"
+ local dbdir="${ROOT%/}"/var/db/pkg/"${CATEGORY}/${PF}"
ebuild_section "Writing VDB entry to '${dbdir}'..."
install -d "${dbdir}" || die "couldn't make pkg db directory (\"${dbdir}\")"
@@ -65,15 +65,15 @@ builtin_merge()
done
fi
- install -d "${ROOT}/" || die "couldn't make \${ROOT} (\"${ROOT}\")"
+ install -d "${ROOT%/}/" || die "couldn't make \${ROOT} (\"${ROOT}\")"
if [[ -d "${D}" ]] ; then
- ${PALUDIS_EBUILD_MODULES_DIR}/utils/merge "${D}/" "${ROOT}/" "${dbdir}/CONTENTS" \
+ ${PALUDIS_EBUILD_MODULES_DIR}/utils/merge "${D%/}/" "${ROOT%/}/" "${dbdir}/CONTENTS" \
|| die "merge failed"
fi
fi
if [[ -n "${reinstall}" ]] ; then
- ${PALUDIS_EBUILD_MODULES_DIR}/utils/unmerge "${ROOT}/" "${dbdir}/OLDCONTENTS" \
+ ${PALUDIS_EBUILD_MODULES_DIR}/utils/unmerge "${ROOT%/}/" "${dbdir}/OLDCONTENTS" \
|| die "unmerge failed"
rm -f "${dbdir}/OLDCONTENTS"
fi
diff --git a/ebuild/utils/merge b/ebuild/utils/merge
index a6ae28e..a79fbdc 100755
--- a/ebuild/utils/merge
+++ b/ebuild/utils/merge
@@ -60,7 +60,7 @@ merge_this()
local f ff r=0
for f in "${1}/"* ; do
- ff=$(basename "${f}" )
+ ff=$(basename -- "${f}" )
echo ">>> ${2#${top_dst}}/${ff}"
if [[ -e "${f}" ]] || [[ -h "${f}" ]] ; then
@@ -76,23 +76,23 @@ merge_this()
fi
if [[ -L "${f}" ]] ; then
- if ( [[ -e "${2}/${ff}" ]] || [[ -h "${2}/${ff}" ]] ) && ! rm -f "${2}/${ff}" ; then
+ if ( [[ -e "${2}/${ff}" ]] || [[ -h "${2}/${ff}" ]] ) && ! rm -f -- "${2}/${ff}" ; then
echo "error removing ${2}/${ff} for link ${f}"
r=1
- elif ! ln -s "$(readlink ${f} )" "${2}/${ff}" ; then
+ elif ! ln -s -- "$(readlink -- ${f} )" "${2}/${ff}" ; then
echo "error installing link ${f}"
r=1
else
echo -n "sym ${2#${top_dst}}/${ff} -> " >> ${contents}
- echo -n "$(readlink ${2}/${ff} ) " >> ${contents}
- echo -n "$(stat -c '%Y' ${2}/${ff} )" >> ${contents}
+ echo -n "$(readlink -- ${2}/${ff} ) " >> ${contents}
+ echo -n "$(stat -c '%Y' -- ${2}/${ff} )" >> ${contents}
echo >> ${contents}
fi
elif [[ -d ${f} ]] ; then
local ok=
if [[ -d "${2}/${ff}"/ ]] ; then
:
- elif ! mkdir "${2}/${ff}" ; then
+ elif ! mkdir -- "${2}/${ff}" ; then
echo "error installing directory ${f}"
ok=no
fi
@@ -107,14 +107,14 @@ merge_this()
r=1
fi
else
- if ! cp --remove-destination -pR "${f}" "${2}"/ ; then
+ if ! cp --remove-destination -pR -- "${f}" "${2}"/ ; then
echo "error installing file ${f}"
r=1
else
if [[ -f "${f}" ]] ; then
echo -n "obj ${2#${top_dst}}/${ff} " >> ${contents}
- echo -n "$(md5sum ${2}/${ff} | cut -d' ' -f1 ) " >> ${contents}
- echo -n "$(stat -c '%Y' ${2}/${ff} )" >> ${contents}
+ echo -n "$(md5sum -- ${2}/${ff} | cut -d' ' -f1 ) " >> ${contents}
+ echo -n "$(stat -c '%Y' -- ${2}/${ff} )" >> ${contents}
echo >> ${contents}
else
echo "misc ${2#${top_dst}}/${ff}" >> ${contents}
diff --git a/ebuild/utils/unmerge b/ebuild/utils/unmerge
index 06c1868..b12a3ba 100755
--- a/ebuild/utils/unmerge
+++ b/ebuild/utils/unmerge
@@ -53,22 +53,22 @@ while read entry ; do
sym)
if ! [[ -L "${ROOT}/${items[1]}" ]] ; then
echo "skip !type ${items[1]}"
- elif [[ $(readlink "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
+ elif [[ $(readlink -- "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
echo "skip !dest ${items[1]}"
- elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[4]}" ]] ; then
+ elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[4]}" ]] ; then
echo "skip !time ${items[1]}"
else
echo "remove ${items[1]}"
- rm -f "${ROOT}/${items[1]}"
+ rm -f -- "${ROOT}/${items[1]}"
fi
;;
obj)
if ! [[ -f "${ROOT}/${items[1]}" ]] ; then
echo "skip !type ${items[1]}"
- elif [[ $(md5sum "${ROOT}/${items[1]}" | cut -d' ' -f1 ) != "${items[2]}" ]] ; then
+ elif [[ $(md5sum -- "${ROOT}/${items[1]}" | cut -d' ' -f1 ) != "${items[2]}" ]] ; then
echo "skip !md5 ${items[1]}"
- elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
+ elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
echo "skip !time ${items[1]}"
else
echo "remove ${items[1]}"
@@ -79,7 +79,7 @@ while read entry ; do
misc)
if [[ -f "${ROOT}/${items[1]}" ]] ; then
echo "skip !type ${items[1]}"
- elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[2]}" ]] ; then
+ elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[2]}" ]] ; then
echo "skip !time ${items[1]}"
else
echo "remove ${items[1]}"
@@ -105,7 +105,7 @@ while read entry ; do
echo "skip !empty ${items[1]}"
else
echo "remove ${items[1]}"
- rm -fr "${ROOT}/${items[1]}"
+ rm -fr -- "${ROOT}/${items[1]}"
fi
;;
esac