summaryrefslogtreecommitdiff
path: root/3_configure.sh
blob: af63fa2334d821bea07cec022856b3d4905b3cbf (plain)
  1. #!/bin/sh
  2. set -e
  3. . ./config-DEFAULTS || exit 1
  4. . ./config-HOST || exit 1
  5. . ./config-TARGET || exit 1
  6. . ./config-MANDATED || exit 1
  7. . ./functions || exit 1
  8. # Check if already installed
  9. if ! ./chroot.sh grep -q 'root::' "/etc/passwd"; then
  10. echo 'ERROR: rootfd already (halfway?) configured!' >&2
  11. exit 1
  12. fi
  13. # Install MBR, GRUB and SYSLINUX
  14. [ -n "$grubdev_host" ] && mkgrubdevmap "$usbdev_host" >>"$baseworkdir/grub_host_device.map"
  15. if [ "$MBR" = "yes" ]; then
  16. [ "$MBR" = "yes" ] && install-mbr "$usbdev_host"
  17. # [ -n "$syslinuxdev_host" ] && syslinux "$bootdev_host"
  18. [ -n "$syslinuxdev_host" ] && makebootfat -o "$syslinuxdev_host" -X -P -b /usr/lib/syslinux/ldlinux.bss -c /usr/lib/syslinux/ldlinux.sys "$targettemp_fat"
  19. [ -n "$grubdev_host" ] && echo -e "root ($grubdev_grub)\nsetup ($grubdev_grub)" | grub --batch --device-map="$baseworkdir/grub_host_device.map"
  20. elif [ -n "$grubdev_host" ]; then
  21. echo -e "root ($grubdev_grub)\nsetup ($usbdev_grub)" | grub --batch --device-map="$baseworkdir/grub_host_device.map"
  22. elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "ext2fs" ]; then
  23. makebootfat -o "$syslinuxdev_host" -X -P -b /usr/lib/syslinux/ldlinux.bss -c /usr/lib/syslinux/ldlinux.sys "$targettemp_fat"
  24. elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "dosfs" ]; then
  25. # This should make sticks be recognized as both USB-FDD and USB-HDD.
  26. # (VIA EPIA mobos will boot only as USB-ZIP, however :-( )
  27. makebootfat -o "$usbdev_host" -X -D -b /usr/lib/syslinux/ldlinux.bss -m /usr/lib/makebootfat/mbrfat.bin -F -c /usr/lib/syslinux/ldlinux.sys "$targettemp_isofs"
  28. elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "isofs" ]; then
  29. # This should make sticks be recognized as both USB-FDD and USB-HDD.
  30. # (VIA EPIA mobos will boot only as USB-ZIP, however :-( )
  31. makebootfat -o "$usbdev_host" -X -D -b /usr/lib/syslinux/ldlinux.bss -m /usr/lib/makebootfat/mbrfat.bin -F -c /usr/lib/syslinux/ldlinux.sys "$targettemp_isofs"
  32. else
  33. echo "WARNING: Sorry: don't know how to handle this choice of bootloaders." >&2
  34. exit 1
  35. fi
  36. # Tweak /etc/passwd to sanity
  37. ./chroot.sh shadowconfig on
  38. ./chroot.sh passwd root
  39. echo "Creating SSH2 RSA/DSA keys; this may take some time ..."
  40. ./chroot.sh ssh-keygen -q -f "/etc/ssh/ssh_host_rsa_key" -t rsa #-N ""
  41. ./chroot.sh ssh-keygen -q -f "/etc/ssh/ssh_host_dsa_key" -t dsa #-N ""
  42. echo 'Done configuring rootfs!'