On Thursday 23 July 2009 22:55:07 Daniel O'Connor wrote:
I wrapped portmaster, since -af has the same problem when something screws the
build (mostly plist problems and $me wanting backup packages, but also
classics like using sudo as PM_SU_CMD and trying to reinstall it).
Basically, I made a list of all the installed ports and sorted dep order, then
called portmaster -u for every port and if successful put an empty file
+PM_DONE in /var/db/pkg/<pkgname>/. On a restart the ports containing a
+PM_DONE file are skipped.
If the entire process finishes successfully, all +PM_DONE files are removed. I
briefly looked into building it into portmaster, but that looked to take
longer then I had time for. The main loop is at the bottom, perhaps Doug likes
the idea and has the time to integrate it.
Or your websites in /usr/local/www, your database in /usr/local/pgsql or your
squid conf and cache in /usr/local/squid. Especially when pkg_delete -af does
the right thing and leaves all this in tact, I don't see the value of rm -rf
/usr/local, other then a few minutes on a process that's likely going to be
several hours or days.
--
Mel
mark_done()
{
local _name
_name=$1
if test -d ${PKG_DBDIR}/${_name}; then
${SUDO} ${TOUCH} ${PKG_DBDIR}/${_name}/+PM_DONE
else
return 1;
fi
return 0;
}
for origin in ${LIST}; do
pkgname=$(make -C ${PORTSDIR}/${origin} -V PKGNAME)
if test -f ${PKG_DBDIR}/${pkgname}/+PM_DONE; then
echo "Already done: ${pkgname} (${LOOP}/${TOTAL})"
else
echo "===> Building ${pkgname}"
portmaster -u ${PORTSDIR}/${origin}
if test $? -eq 0; then
mark_done ${pkgname} || safe_abort
else
FAILED=$((${FAILED} + 1))
echo "Failed, continue? [n]"
read CONT
case "${CONT}" in
[yY]|[yY][eE]|[yY][eE][sS])
echo "===> Marking state as done"
mark_done ${pkgname} || safe_abort
;;
*) break;;
esac
fi
fi
done
if test ${FAILED} -eq 0; then
echo "===> Removing state files"
for FILE in ${PKG_DBDIR}/*/+PM_DONE; do
${SUDO} /bin/rm ${FILE}
done
echo "===> Removing origin list"
/bin/rm ${LISTFILE}
fi
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"