IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.8KB

  1. #!/bin/sh
  2. if [ -z "$1" ]; then
  3. echo "Usage: focker-bsdinstall chroot_dir"
  4. exit 1
  5. fi
  6. BSDCFG_SHARE="/usr/share/bsdconfig"
  7. . $BSDCFG_SHARE/common.subr || exit 1
  8. : ${BSDINSTALL_TMPETC="/tmp/bsdinstall_etc"}; export BSDINSTALL_TMPETC
  9. : ${BSDINSTALL_TMPBOOT="/tmp/bsdinstall_boot"}; export BSDINSTALL_TMPBOOT
  10. : ${PATH_FSTAB="$BSDINSTALL_TMPETC/fstab"}; export PATH_FSTAB
  11. : ${BSDINSTALL_DISTDIR="/usr/freebsd-dist"}; export BSDINSTALL_DISTDIR
  12. : ${BSDINSTALL_CHROOT="/mnt"}; export BSDINSTALL_CHROOT
  13. echo "Began Installation at" "$( date )"
  14. export BSDINSTALL_CHROOT=$1
  15. error() {
  16. if [ -n "$1" ]; then
  17. echo "$1" >&2
  18. fi
  19. exit $FAILURE
  20. }
  21. rm -rf $BSDINSTALL_TMPETC
  22. mkdir $BSDINSTALL_TMPETC
  23. mkdir -p $1 || error "mkdir failed for $1"
  24. test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
  25. # echo "BSDINSTALL_DISTDIR: $BSDINSTALL_DISTDIR"
  26. # exit
  27. export DISTRIBUTIONS="base.txz"
  28. FETCH_DISTRIBUTIONS=""
  29. for dist in $DISTRIBUTIONS; do
  30. if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
  31. FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
  32. fi
  33. done
  34. FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space
  35. if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
  36. BSDINSTALL_DISTSITE=`focker-mirrorselect`
  37. export BSDINSTALL_DISTSITE
  38. fi
  39. if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
  40. bsdinstall distfetch || error "Failed to fetch distribution"
  41. fi
  42. bsdinstall checksum || error "Distribution checksum failed"
  43. bsdinstall distextract || error "Distribution extract failed"
  44. # bsdinstall rootpass || error "Could not set root password"
  45. echo "Setting random root password ..."
  46. openssl rand -base64 8 | md5 | head -c32 | chroot "$BSDINSTALL_CHROOT" pw user mod root -h 0
  47. bsdinstall config || error "Failed to save config"
  48. cp /etc/resolv.conf $1/etc
  49. cp /etc/localtime $1/etc
  50. bsdinstall entropy
  51. echo "Installation Completed at" "$(date)"
  52. exit $SUCCESS