Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

102 rindas
2.8 KiB

  1. #!/bin/bash -e
  2. IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
  3. INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info"
  4. on_chroot << EOF
  5. if [ -x /etc/init.d/fake-hwclock ]; then
  6. /etc/init.d/fake-hwclock stop
  7. fi
  8. if hash hardlink 2>/dev/null; then
  9. hardlink -t /usr/share/doc
  10. fi
  11. EOF
  12. if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then
  13. chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config"
  14. fi
  15. rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
  16. rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static"
  17. if [ "${USE_QEMU}" != "1" ]; then
  18. if [ -e "${ROOTFS_DIR}/etc/ld.so.preload.disabled" ]; then
  19. mv "${ROOTFS_DIR}/etc/ld.so.preload.disabled" "${ROOTFS_DIR}/etc/ld.so.preload"
  20. fi
  21. fi
  22. rm -f "${ROOTFS_DIR}/etc/network/interfaces.dpkg-old"
  23. rm -f "${ROOTFS_DIR}/etc/apt/sources.list~"
  24. rm -f "${ROOTFS_DIR}/etc/apt/trusted.gpg~"
  25. rm -f "${ROOTFS_DIR}/etc/passwd-"
  26. rm -f "${ROOTFS_DIR}/etc/group-"
  27. rm -f "${ROOTFS_DIR}/etc/shadow-"
  28. rm -f "${ROOTFS_DIR}/etc/gshadow-"
  29. rm -f "${ROOTFS_DIR}/etc/subuid-"
  30. rm -f "${ROOTFS_DIR}/etc/subgid-"
  31. rm -f "${ROOTFS_DIR}"/var/cache/debconf/*-old
  32. rm -f "${ROOTFS_DIR}"/var/lib/dpkg/*-old
  33. rm -f "${ROOTFS_DIR}"/usr/share/icons/*/icon-theme.cache
  34. rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id"
  35. true > "${ROOTFS_DIR}/etc/machine-id"
  36. ln -nsf /proc/mounts "${ROOTFS_DIR}/etc/mtab"
  37. find "${ROOTFS_DIR}/var/log/" -type f -exec cp /dev/null {} \;
  38. rm -f "${ROOTFS_DIR}/root/.vnc/private.key"
  39. rm -f "${ROOTFS_DIR}/etc/vnc/updateid"
  40. update_issue "$(basename "${EXPORT_DIR}")"
  41. install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"
  42. cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
  43. {
  44. if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then
  45. firmware=$(zgrep "firmware as of" \
  46. "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
  47. head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
  48. printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware"
  49. kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")"
  50. printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel"
  51. uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")"
  52. printf "Uname string: %s\n" "$uname"
  53. fi
  54. printf "\nPackages:\n"
  55. dpkg -l --root "$ROOTFS_DIR"
  56. } >> "$INFO_FILE"
  57. ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')"
  58. unmount "${ROOTFS_DIR}"
  59. zerofree "${ROOT_DEV}"
  60. unmount_image "${IMG_FILE}"
  61. mkdir -p "${DEPLOY_DIR}"
  62. rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip"
  63. rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
  64. if [ "${DEPLOY_ZIP}" == "1" ]; then
  65. pushd "${STAGE_WORK_DIR}" > /dev/null
  66. zip "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip" \
  67. "$(basename "${IMG_FILE}")"
  68. popd > /dev/null
  69. else
  70. cp "$IMG_FILE" "$DEPLOY_DIR"
  71. fi
  72. cp "$INFO_FILE" "$DEPLOY_DIR"