build 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh -e
  2. sinfo() {
  3. echo ${BASH:+-e} "\033[1;37;43m$@\033[0m"
  4. }
  5. # Must have root directory as an argument
  6. # "fresh" parameter can be given in subsequent invocation
  7. # (erasing ${LIVECD}/src will do the same)
  8. if [ -z "$1" -o \( -n "$2" -a "$2" != fresh \) ]; then
  9. echo "$0 <livecd root> [fresh]"
  10. exit 1
  11. fi
  12. if [ `id -u` != 0 -o `id -g` != 0 ]; then
  13. echo "Must be root"
  14. exit 1
  15. fi
  16. # Variables
  17. SRC=`dirname $0`
  18. LIVECD=$1
  19. # If "fresh" parameter is passed, rewrites ${LIVECD}/src
  20. sinfo "Downloading and extracting stage3 and portage snapshots"
  21. ${SRC}/mkroot ${LIVECD} $2
  22. # If "fresh" parameter is passed, rebuilds system from scratch
  23. sinfo "Installing packages and configuring system"
  24. ${SRC}/enter ${LIVECD} -c "./setup $2"
  25. # Reverse emerge rewriting /etc files during full build
  26. # Destructive operations are done on ${LIVECD}/copy
  27. sinfo "Restoring configuration and copying the live tree"
  28. ${SRC}/enter ${LIVECD} -c "./mkimage copy"
  29. # Cleans up ${LIVECD}/copy from inside
  30. sinfo "Uninstalling development packages"
  31. ${SRC}/enter ${LIVECD} copy -c ./setup-copy
  32. # Cleans up ${LIVECD}/copy from outside
  33. # Builds "liberte" dir in ${LIVECD}/dist to deploy
  34. sinfo "Mastering deployment directory"
  35. ${SRC}/enter ${LIVECD} -c ./mkimage
  36. # OK to copy "liberte" dir and run setup.sh
  37. sinfo "Done: ZIP archive in ${LIVECD}/dist"