if [ "$PUPMODE" = "2" ]; then #from BK's quirky6.1 #LN301-357 of /usr/local/petget/installpkg.sh (tahpup) - http://www.pearltrees.com/s243a/installpkg-sh-usr-local-petget/id20402080/item224130427 mkdir /audit/${DLPKG_NAME}DEPOSED echo -n '' > /tmp/petget/FLAGFND find ${DIRECTSAVEPATH}/ -mindepth 1 | sed -e "s%${DIRECTSAVEPATH}%%" | while read AFILESPEC do if [ -f "$AFILESPEC" ];then ADIR="$(dirname "$AFILESPEC")" mkdir -p /audit/${DLPKG_NAME}DEPOSED/${ADIR} cp -a -f "$AFILESPEC" /audit/${DLPKG_NAME}DEPOSED/${ADIR}/ echo -n '1' > /tmp/petget/FLAGFND fi done sync if [ -s /tmp/petget/FLAGFND ];then [ -f /audit/${DLPKG_NAME}DEPOSED.sfs ] && rm -f /audit/${DLPKG_NAME}DEPOSED.sfs #precaution, should not happen, as not allowing duplicate installs of same pkg. mksquashfs /audit/${DLPKG_NAME}DEPOSED /audit/${DLPKG_NAME}DEPOSED.sfs fi sync rm -rf /audit/${DLPKG_NAME}DEPOSED #now write temp-location to final destination... cp -a -f --remove-destination ${DIRECTSAVEPATH}/* / 2> /tmp/petget/install-cp-errlog sync #can have a problem if want to replace a folder with a symlink. for example, got this error: # cp: cannot overwrite directory '/usr/share/mplayer/skins' with non-directory #3builddistro has this fix... which is a vice-versa situation... #firstly, the vice-versa, source is a directory, target is a symlink... CNT=0 while [ -s /tmp/petget/install-cp-errlog ];do echo -n '' > /tmp/petget/install-cp-errlog2 echo -n '' > /tmp/petget/install-cp-errlog3 cat /tmp/petget/install-cp-errlog | grep 'cannot overwrite non-directory' | grep 'with directory' | tr '[`‘’]' "'" | cut -f 2 -d "'" | while read ONEDIRSYMLINK #ex: /usr/share/mplayer/skins do if [ -h "${ONEDIRSYMLINK}" ];then #source is a directory, target is a symlink... #adding that extra trailing / does the trick... cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}"/* "${ONEDIRSYMLINK}"/ 2>> /tmp/petget/install-cp-errlog2 else #source is a directory, target is a file... rm -f "${ONEDIRSYMLINK}" #delete the file! DIRPATH="$(dirname "${ONEDIRSYMLINK}")" cp -a -f ${DIRECTSAVEPATH}"${ONEDIRSYMLINK}" "${DIRPATH}"/ 2>> /tmp/petget/install-cp-errlog2 #copy directory (and contents). fi done cat /tmp/petget/install-cp-errlog2 >> /tmp/petget/install-cp-errlog3 cat /tmp/petget/install-cp-errlog3 > /tmp/petget/install-cp-errlog sync CNT=`expr $CNT + 1` [ $CNT -gt 10 ] && break #something wrong, get out. done #end 131220 rm -rf ${DIRECTSAVEPATH} #131229 131230 [ "$DL_SAVE_FLAG" != "true" ] && rm -f $DLPKG_BASE 2>/dev/null rm -f $DLPKG_MAIN.tar.gz 2>/dev/null #pkgname.files may need to be fixed... FIXEDFILES="`cat /root/.packages/${DLPKG_NAME}.files | grep -v '^\\./$'| grep -v '^/$' | sed -e 's%^\\.%%' -e 's%^%/%' -e 's%^//%/%'`" echo "$FIXEDFILES" > /root/.packages/${DLPKG_NAME}.files