mkspec 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. #
  3. # Output a simple RPM spec file.
  4. # This version assumes a minimum of RPM 4.13
  5. #
  6. # The only gothic bit here is redefining install_post to avoid
  7. # stripping the symbols from files in the kernel which we want
  8. #
  9. # Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
  10. #
  11. set -eu
  12. output=$1
  13. mkdir -p "$(dirname "${output}")"
  14. exec >"${output}"
  15. if grep -q CONFIG_MODULES=y include/config/auto.conf; then
  16. echo '%define with_devel %{?_without_devel: 0} %{?!_without_devel: 1}'
  17. else
  18. echo '%define with_devel 0'
  19. fi
  20. cat<<EOF
  21. %define ARCH ${ARCH}
  22. %define KERNELRELEASE ${KERNELRELEASE}
  23. %define pkg_release $("${srctree}/scripts/build-version")
  24. EOF
  25. cat "${srctree}/scripts/package/kernel.spec"
  26. # collect the user's name and email address for the changelog entry
  27. if [ "$(command -v git)" ]; then
  28. name=$(git config user.name) || true
  29. email=$(git config user.email) || true
  30. fi
  31. if [ ! "${name:+set}" ]; then
  32. name=${KBUILD_BUILD_USER:-$(id -nu)}
  33. fi
  34. if [ ! "${email:+set}" ]; then
  35. buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
  36. builduser=${KBUILD_BUILD_USER:-$(id -nu)}
  37. email="${builduser}@${buildhost}"
  38. fi
  39. cat << EOF
  40. %changelog
  41. * $(LC_ALL=C date +'%a %b %d %Y') ${name} <${email}>
  42. - Custom built Linux kernel.
  43. EOF