Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # LN# 359 to 369 of /usr/local/petget/installpkg.sh (tahrpup) - http://www.pearltrees.com/s243a/installpkg-sh-usr-local-petget/id20402080/item224130677
- else #-- anything other than PUPMODE 2 (full install) --
- [ "$DL_SAVE_FLAG" != "true" ] && rm -f $DLPKG_BASE 2>/dev/null
- rm -f $DLPKG_MAIN.tar.${EXT} 2>/dev/null #131122
- #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
- #120102 install may have overwritten a symlink-to-dir...
- #tar defaults to not following symlinks, for both dirs and files, but i want to follow symlinks
- #for dirs but not for files. so, fix here... (note, dir entries in .files have / on end)
- cat /root/.packages/${DLPKG_NAME}.files | grep '[a-zA-Z0-9]/$' | sed -e 's%/$%%' | grep -v '^/mnt' |
- while read ONESPEC
- do
- if [ -d "${DIRECTSAVEPATH}${ONESPEC}" ];then
- if [ ! -h "${DIRECTSAVEPATH}${ONESPEC}" ];then
- DIRLINK=""
- if [ -h "/initrd${PUP_LAYER}${ONESPEC}" ];then #120107
- DIRLINK="`readlink -m "/initrd${PUP_LAYER}${ONESPEC}" | sed -e "s%/initrd${PUP_LAYER}%%"`" #PUP_LAYER: see /etc/rc.d/PUPSTATE. 120107
- xDIRLINK="`readlink "/initrd${PUP_LAYER}${ONESPEC}"`" #120107
- fi
- if [ ! "$DIRLINK" ];then
- if [ -h "/initrd${SAVE_LAYER}${ONESPEC}" ];then #120107
- DIRLINK="`readlink -m "/initrd${SAVE_LAYER}${ONESPEC}" | sed -e "s%/initrd${SAVE_LAYER}%%"`" #SAVE_LAYER: see /etc/rc.d/PUPSTATE. 120107
- xDIRLINK="`readlink "/initrd${SAVE_LAYER}${ONESPEC}"`" #120107
- fi
- fi
- if [ "$DIRLINK" ];then
- if [ -d "$DIRLINK" ];then
- if [ "$DIRLINK" != "${ONESPEC}" ];then #precaution.
- mkdir -p "${DIRECTSAVEPATH}${DIRLINK}" #120107
- cp -a -f --remove-destination ${DIRECTSAVEPATH}"${ONESPEC}"/* "${DIRECTSAVEPATH}${DIRLINK}/" #ha! fails if put double-quotes around entire expression.
- rm -rf "${DIRECTSAVEPATH}${ONESPEC}"
- if [ "$DIRECTSAVEPATH" = "" ];then
- ln -s "$xDIRLINK" "${ONESPEC}"
- else
- DSOPATH="`dirname "${DIRECTSAVEPATH}${ONESPEC}"`"
- DSOBASE="`basename "${DIRECTSAVEPATH}${ONESPEC}"`"
- rm -f "${DSOPATH}/.wh.${DSOBASE}" #allow underlying symlink to become visible on top.
- fi
- fi
- fi
- fi
- fi
- fi
- done
- #121217 it seems that this problem is occurring in other modes (13 reported)...
- #121123 having a problem with multiarch symlinks in full-installation...
- #it seems that the symlink is getting replaced by a directory.
- if [ "$DISTRO_ARCHDIR" ];then #in /etc/rc.d/DISTRO_SPECS. 130112 change test from DISTRO_ARCHDIR. 130114 revert DISTRO_ARCHDIR_SYMLINKS==yes.
- if [ -d /usr/lib/${DISTRO_ARCHDIR} ];then
- if [ ! -h /usr/lib/${DISTRO_ARCHDIR} ];then
- cp -a -f --remove-destination /usr/lib/${DISTRO_ARCHDIR}/* /usr/lib/
- sync
- rm -r -f /usr/lib/${DISTRO_ARCHDIR}
- ln -s ./ /usr/lib/${DISTRO_ARCHDIR}
- fi
- fi
- if [ -d /lib/${DISTRO_ARCHDIR} ];then
- if [ ! -h /lib/${DISTRO_ARCHDIR} ];then
- cp -a -f --remove-destination /lib/${DISTRO_ARCHDIR}/* /lib/
- sync
- rm -r -f /lib/${DISTRO_ARCHDIR}
- ln -s ./ /lib/${DISTRO_ARCHDIR}
- fi
- fi
- if [ -d /usr/bin/${DISTRO_ARCHDIR} ];then
- if [ ! -h /usr/bin/${DISTRO_ARCHDIR} ];then
- cp -a -f --remove-destination /usr/bin/${DISTRO_ARCHDIR}/* /usr/bin/
- sync
- rm -r -f /usr/bin/${DISTRO_ARCHDIR}
- ln -s ./ /usr/bin/${DISTRO_ARCHDIR}
- fi
- fi
- fi
- #flush unionfs cache, so files in pup_save layer will appear "on top"...
- if [ "$DIRECTSAVEPATH" != "" ];then
- #but first, clean out any bad whiteout files...
- # 22sep10 shinobar: bugfix was not working clean out whiteout files
- find /initrd/pup_rw -mount -type f -name .wh.\* -printf '/%P\n'|
- while read ONEWHITEOUT
- do
- ONEWHITEOUTFILE="`basename "$ONEWHITEOUT"`"
- ONEWHITEOUTPATH="`dirname "$ONEWHITEOUT"`"
- if [ "$ONEWHITEOUTFILE" = ".wh.__dir_opaque" ];then
- [ "`grep "$ONEWHITEOUTPATH" /root/.packages/${DLPKG_NAME}.files`" != "" ] && rm -f "/initrd/pup_rw/$ONEWHITEOUT"
- continue
- fi
- ONEPATTERN="`echo -n "$ONEWHITEOUT" | sed -e 's%/\\.wh\\.%/%'`"'/*' ;#echo "$ONEPATTERN" >&2
- [ "`grep -x "$ONEPATTERN" /root/.packages/${DLPKG_NAME}.files`" != "" ] && rm -f "/initrd/pup_rw/$ONEWHITEOUT"
- done
- #111229 /usr/local/petget/removepreview.sh when uninstalling a pkg, may have copied a file from sfs-layer to top, check...
- cat /root/.packages/${DLPKG_NAME}.files |
- while read ONESPEC
- do
- [ "$ONESPEC" = "" ] && continue #precaution.
- if [ ! -d "$ONESPEC" ];then
- [ -e "/initrd/pup_rw${ONESPEC}" ] && rm -f "/initrd/pup_rw${ONESPEC}"
- fi
- done
- #now re-evaluate all the layers...
- busybox mount -t aufs -o remount,udba=reval unionfs / #remount with faster evaluation mode.
- [ $? -ne 0 ] && logger -s -t "installpkg.sh" "Failed to remount aufs / with udba=reval"
- sync
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment