prepare_update.sh 810 B

12345678910111213141516171819202122232425262728293031323334
  1. #! /bin/sh
  2. TEMPROOT=${1:-/usr/local/storage/dest/temproot/`uname -m`}
  3. # Check for the temproot
  4. if [ ! -d "${TEMPROOT}" ]; then
  5. echo "Temproot ${TEMPROOT} missing"
  6. exit 1
  7. fi
  8. cd "${TEMPROOT}"
  9. if [ -e /etc/mk.conf ]; then
  10. XSRCDIR=${XSRCDIR:-`make -f /etc/mk.conf -V XSRCDIR`}
  11. fi
  12. SRCDIR=/usr/src # TODO: Ask /etc/mk.conf about this too
  13. XSRCDIR=${XSRCDIR:=/usr/xenocara}
  14. for DIR in ${SRCDIR} ${XSRCDIR} ; do
  15. if [ ! -d "${DIR}" ]; then
  16. echo "Ignoring directory ${DIR}"
  17. else
  18. cd "${DIR}" || exit 1
  19. if [ X"${DIR}" = X"${XSRCDIR}" ]; then
  20. env DESTDIR="${TEMPROOT}" sudo -E make bootstrap \
  21. || exit 1
  22. fi
  23. if [ X"${DIR}" = X"${SRCDIR}" ]; then
  24. ( cd etc/ && \
  25. env DESTDIR="${TEMPROOT}" sudo -E make distribution )
  26. fi
  27. env DESTDIR="${TEMPROOT}" sudo -E make install || exit 1
  28. fi
  29. done