make-bootstrap-file.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # build: Bootstrap a base Hyperbola GNU+Linux-libre system.
  3. set -e -u -o pipefail
  4. SCRIPT=$(readlink -f "$0")
  5. SCRIPT_PWD=$(dirname "$SCRIPT")
  6. CHROOT_DELETE='y'
  7. RESULTPATH=${SCRIPT_PWD}/
  8. ARCH="x86_64"
  9. # Hyperbola v0.4.2
  10. # REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing"
  11. # Hyperbola v0.4.1
  12. REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable"
  13. ROOTFS="$ARCH"
  14. # remove old archives
  15. rm -f "${RESULTPATH}/hyperbola-bootstrap.tar.gz" "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
  16. # bootstrap for v0.4
  17. bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.1.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
  18. # bootstrap for v0.3
  19. # bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.2.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
  20. cd "${ROOTFS}"
  21. # clean up package cache
  22. rm -rf var/cache/*
  23. # create new archive
  24. cd "${RESULTPATH}"
  25. tar --create --gzip --numeric-owner --xattrs --acls --file="hyperbola-bootstrap.tar.gz" "${ROOTFS}"
  26. # create shasum
  27. sha512sum "${RESULTPATH}/hyperbola-bootstrap.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
  28. # clean chroot temp
  29. case $CHROOT_DELETE in
  30. y) rm -rf "${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;;
  31. n) echo 'temporal chroot available' ;;
  32. *) echo 'invalid_option "$@"' ;;
  33. esac
  34. # report result
  35. echo "REPO: $REPO_URL"
  36. echo "ROOTFS: $ROOTFS"
  37. echo "RESULTPATH: $RESULTPATH"