diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-08 19:13:24 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-08 19:18:13 +0800 |
commit | d15d0a13317248af424191acc6e9f35bc89b6c60 (patch) | |
tree | 8a11880278d2f626648ad1cdba23ed69c963c18b | |
parent | 40ae47ab7f23597dcf71e23eacc3ff14dbb1114d (diff) | |
download | dfly-update-d15d0a13317248af424191acc6e9f35bc89b6c60.tar.bz2 |
Fix cpdup -X usage (2)
Note that 'cpdup -X' doesn't normalize multiple '/' to be one, so for
example, '/mnt/tmp/boot/loader.conf' is different to
'/mnt/tmp//boot/loader.conf'!
Also drop the unnecessary '-u' option.
-rwxr-xr-x | dfly-update | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dfly-update b/dfly-update index d910fe5..dad8990 100755 --- a/dfly-update +++ b/dfly-update @@ -240,14 +240,16 @@ install_system() { echo " => Collecting files to be ignored ..." cpignore=$(mktemp -t ${NAME}) || exit ${EC_TMPFILE} for file in ${FILES_IGNORE}; do - echo "${MNT_DIR}/${file}" >> ${cpignore} + # NOTE: 'cpdup -X' doesn't normalize multiple '/' to be one. + echo "${MNT_DIR%/}/${file#/}" >> ${cpignore} echo " * ${file} <ignored>" done echo " => Installing kernel and world ..." for item in ${INSTALL_LIST}; do echo -n " * Installing: ${item} ... " - ${CPDUP} -o -u -X ${cpignore} ${MNT_DIR}/${item} /${item} || + # NOTE: 'cpdup -X' doesn't normalize multiple '/' to be one. + ${CPDUP} -o -X ${cpignore} ${MNT_DIR%/}/${item#/} /${item} || exit ${EC_CPDUP} echo "ok" done @@ -266,7 +268,7 @@ upgrade_system() { [ -d "${CACHE_DIR}" ] || mkdir "${CACHE_DIR}" echo "Upgrading system ..." echo " => Coping new /etc to: ${etcdir}" - ${CPDUP} -o -u ${MNT_DIR}/etc.hdd ${etcdir} || exit ${EC_CPDUP} + ${CPDUP} -o ${MNT_DIR}/etc.hdd ${etcdir} || exit ${EC_CPDUP} echo " => Removing ignored files ..." for file_etc in ${FILES_IGNORE}; do @@ -294,7 +296,7 @@ upgrade_system() { done echo " => Installing new configurations ..." - ${CPDUP} -o -u ${etcdir} /etc || exit ${EC_CPDUP} + ${CPDUP} -o ${etcdir} /etc || exit ${EC_CPDUP} echo " => DONE!" rm -rf "${etcdir}" echo "+---------+" |