[csw-devel] SF.net SVN: gar:[14390] csw/mgar/pkg/cswclassutils/trunk/files
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Apr 24 12:01:48 CEST 2011
Revision: 14390
http://gar.svn.sourceforge.net/gar/?rev=14390&view=rev
Author: wahwah
Date: 2011-04-24 10:01:48 +0000 (Sun, 24 Apr 2011)
Log Message:
-----------
pkg/cswclassutils/trunk: Potentially fixed a bug with tar invocations
Modified Paths:
--------------
csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswmigrateconf
csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh
Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswmigrateconf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswmigrateconf 2011-04-24 09:13:29 UTC (rev 14389)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswmigrateconf 2011-04-24 10:01:48 UTC (rev 14390)
@@ -168,8 +168,8 @@
exit 1
fi
- if [ -z "${MIGRATE_FILES}" ]; then
- echo "ERROR! \$MIGRATE_FILES variable is empty."
+ if [ -z "${MIGRATE_FILES:-}" ]; then
+ echo "ERROR! The \$MIGRATE_FILES variable is empty."
exit 1
fi
@@ -228,13 +228,17 @@
# moved already.
if [ -r "${srcpath}" ]
then
+ debug "'${srcpath}' exists, moving to '${archpath}'"
give_a_chance_to_stop
place_signpost_for "${srcpath}"
debug "Moving '${srcpath}' to '${archpath}'"
+ mkdir -p "${PKG_INSTALL_ROOT}/${archdir}"
mv "${srcpath}" "${archpath}"
if [ -r "${srcpath}" ]; then
echo "WARNING: '${srcpath}' still exists"
fi
+ else
+ debug "'${srcpath}' does not exist"
fi
# If the destination file is not there and the archived file is, copy it over.
@@ -249,13 +253,15 @@
# Directories are copied in whole
if [ -d "${archpath}" ]; then
- debug "(cd ${archpath}/..; tar cf - `basename ${archpath}` \
-| ( mkdir ${dstpath}; cd ${dstpath}; cd ..; tar xf -))"
- (cd ${archpath}/..; tar cf - `basename ${archpath}` \
- | ( mkdir ${dstpath}; cd ${dstpath}; cd ..; tar xf -) \
+ debug "(tar cf - -C "${archpath}/.." `basename "${archpath}"` \
+ | ( mkdir -p "${dstpath}"; cd "${dstpath}"; cd ..; tar xfp -) \
+ )"
+ (tar cf - -C "${archpath}/.." `basename "${archpath}"` \
+ | ( mkdir -p "${dstpath}"; cd "${dstpath}"; cd ..; tar xfp -) \
)
elif [ -f "${archpath}" ]; then
debug cp "${archpath}" "${dstpath}"
+ mkdir -p "${PKG_INSTALL_ROOT}${dstdir}"
cp "${archpath}" "${dstpath}"
else
echo "WARNING: ${archpath} is neither a file or directory."
Modified: csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh 2011-04-24 09:13:29 UTC (rev 14389)
+++ csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh 2011-04-24 10:01:48 UTC (rev 14390)
@@ -6,20 +6,21 @@
readonly CAS_DIR="files"
readonly CAS_UNDER_TEST="CSWcswclassutils.i.cswmigrateconf"
-readonly TMP_DIR="$(gmktemp -d castest.XXXXXXXXXX)"
-readonly SRC_DIR="${TMP_DIR}/src"
-PKG_INSTALL_ROOT="${TMP_DIR}/root"
+# readonly WORK_DIR="$(gmktemp -d /tmp/castest.XXXXXXXXXX)"
+readonly WORK_DIR="$(gmktemp -d castest.XXXXXXXXXX)"
+readonly SRC_DIR="${WORK_DIR}/src"
+PKG_INSTALL_ROOT="${WORK_DIR}/root"
readonly OLD_CONFDIR_ABS="${PKG_INSTALL_ROOT}/opt/csw/etc"
readonly NEW_CONFDIR_ABS="${PKG_INSTALL_ROOT}/etc/opt/csw"
cleanup() {
-tree "${TMP_DIR}"
+tree "${WORK_DIR}"
echo "To clean up:"
-echo "rm -rf \"${TMP_DIR}\""
+echo "rm -rf \"${WORK_DIR}\""
read -p "Clean? [y/n] > " ANSWER
if [[ "${ANSWER}" == y ]]
then
- rm -rf "${TMP_DIR}"
+ rm -rf "${WORK_DIR}"
else
echo "Not removing."
fi
@@ -27,18 +28,18 @@
trap cleanup EXIT
-echo "Working in '${TMP_DIR}'"
+echo "Working in '${WORK_DIR}'"
mkdir -p "${PKG_INSTALL_ROOT}"
mkdir -p "${SRC_DIR}"
# Place files
echo "MIGRATE_FILES=\"foo.conf bar.d\"" > "${SRC_DIR}/foo"
-echo "MIGRATE_FILES=\"bar.d\"" > "${SRC_DIR}/foo"
mkdir -p "${OLD_CONFDIR_ABS}"
echo "foo: bar" > "${OLD_CONFDIR_ABS}/foo.conf"
mkdir -p "${OLD_CONFDIR_ABS}/bar.d"
echo "I am the bar daemon." > "${OLD_CONFDIR_ABS}/bar.d/bar.conf"
+echo "I have two configuration files." > "${OLD_CONFDIR_ABS}/bar.d/baz.conf"
# And a directory
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list