#! /bin/sh TEMPROOT=${1:-/usr/local/storage/dest/temproot/`uname -m`} # Check that the temproot is there if [ ! -d "${TEMPROOT}" ]; then echo "Temproot ${TEMPROOT} missing" exit 1 fi cd "${TEMPROOT}" # First we must copy the /usr/lib content to /usr/lib so that all copied # binaries will find their libs if [ -d "usr/lib" ]; then tar cf - "usr/lib" | tar -C / -p -h -x -f - fi # Now copy everything over for DIR in /usr/{X11R6,bin,games,include,lib,libdata,libexec,mdec,sbin,share} ; do echo "${DIR}" if [ ! -d "${DIR}" ]; then echo "Ignoring directory ${DIR}" elif [ ! -d "${TEMPROOT}${DIR}" ]; then echo "Ignoring directory ${DIR}, source dir is missing" else RELDIR=`echo ${DIR} | sed 's/^\/*//g'`; mount | awk '{ print $3; }' | grep "^${DIR}$" >/dev/null let ISMOUNTPOINT=$? if [[ ${ISMOUNTPOINT} -eq 0 ]]; then mkdir "${DIR}/.old" \ && mv "${DIR}"/* "${DIR}/.old" \ && tar cf - ${RELDIR} | tar -C / -p -h -x -f - \ && rm -rf "${DIR}/.old" else mv "${DIR}" "${DIR}.old" \ && tar cf - ${RELDIR} | tar -C / -p -h -x -f - \ && rm -rf "${DIR}.old" fi sync fi done