13-aufs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #! /bin/sh
  2. set -e
  3. set -u
  4. echo "Building the aufs module"
  5. . /usr/share/amnesia/build/variables
  6. apt-get install --yes \
  7. build-essential \
  8. "linux-source-${KERNEL_SOURCE_VERSION}"
  9. # aufs build needs fs/mount.h, which is in linux-source-* but not
  10. # in linux-headers-*, so we'll symlink it.
  11. tar --directory=/usr/src \
  12. -xf "/usr/src/linux-source-${KERNEL_SOURCE_VERSION}.tar."*
  13. for arch in 686 amd64 ; do
  14. case "$arch" in
  15. 686)
  16. linux_headers_arch_pkg="linux-headers-${KERNEL_VERSION}-686"
  17. linux_headers_common_pkg="linux-headers-${KERNEL_VERSION}-common"
  18. ;;
  19. amd64)
  20. linux_headers_arch_pkg="linux-headers-${KERNEL_VERSION}-amd64:amd64"
  21. linux_headers_common_pkg="linux-headers-${KERNEL_VERSION}-common:amd64"
  22. ;;
  23. *)
  24. exit 1
  25. esac
  26. apt-get install --yes "$linux_headers_arch_pkg" "$linux_headers_common_pkg"
  27. ln -s \
  28. "/usr/src/linux-source-${KERNEL_SOURCE_VERSION}/fs" \
  29. "/usr/src/linux-headers-${KERNEL_VERSION}-${arch}/fs"
  30. (
  31. cd /usr/src/aufs4-standalone
  32. perl -pi -E \
  33. 's{\A CONFIG_AUFS_DEBUG \s* = \s* y $}{CONFIG_AUFS_DEBUG =}xms' \
  34. config.mk
  35. KDIR="/usr/src/linux-headers-${KERNEL_VERSION}-${arch}"
  36. make clean KDIR="$KDIR"
  37. make install KDIR="$KDIR"
  38. )
  39. depmod "${KERNEL_VERSION}-${arch}"
  40. apt-get remove --yes "$linux_headers_arch_pkg" "$linux_headers_common_pkg"
  41. done
  42. rm -r /usr/src/aufs4-standalone
  43. rm -r "/usr/src/linux-source-${KERNEL_SOURCE_VERSION}"