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.
 
 
 
 
 

71 lines
2.0 KiB

  1. #!/bin/bash -e
  2. install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/"
  3. install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d"
  4. install -m 644 files/ttyoutput.conf "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/"
  5. install -m 644 files/50raspi "${ROOTFS_DIR}/etc/apt/apt.conf.d/"
  6. install -m 644 files/console-setup "${ROOTFS_DIR}/etc/default/"
  7. install -m 755 files/rc.local "${ROOTFS_DIR}/etc/"
  8. if [ -n "${PUBKEY_SSH_FIRST_USER}" ]; then
  9. install -v -m 0700 -o 1000 -g 1000 -d "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh
  10. echo "${PUBKEY_SSH_FIRST_USER}" >"${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
  11. chown 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
  12. chmod 0600 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
  13. fi
  14. if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then
  15. sed -i -Ee 's/^#?[[:blank:]]*PubkeyAuthentication[[:blank:]]*no[[:blank:]]*$/PubkeyAuthentication yes/
  16. s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config
  17. fi
  18. on_chroot << EOF
  19. gcc -march=native -Q --help=target
  20. echo "++++++++++++++++++++++++++++++++++++"
  21. systemctl disable hwclock.sh
  22. systemctl disable nfs-common
  23. systemctl disable rpcbind
  24. if [ "${ENABLE_SSH}" == "1" ]; then
  25. systemctl enable ssh
  26. else
  27. systemctl disable ssh
  28. fi
  29. systemctl enable regenerate_ssh_host_keys
  30. EOF
  31. if [ "${USE_QEMU}" = "1" ]; then
  32. echo "enter QEMU mode"
  33. install -m 644 files/90-qemu.rules "${ROOTFS_DIR}/etc/udev/rules.d/"
  34. on_chroot << EOF
  35. systemctl disable resize2fs_once
  36. EOF
  37. echo "leaving QEMU mode"
  38. else
  39. on_chroot << EOF
  40. systemctl enable resize2fs_once
  41. EOF
  42. fi
  43. on_chroot <<EOF
  44. for GRP in input spi i2c gpio; do
  45. groupadd -f -r "\$GRP"
  46. done
  47. for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do
  48. adduser $FIRST_USER_NAME \$GRP
  49. done
  50. EOF
  51. on_chroot << EOF
  52. setupcon --force --save-only -v
  53. EOF
  54. on_chroot << EOF
  55. usermod --pass='*' root
  56. EOF
  57. rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key*