OpenSDE Framework (without history before r20070)
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.

81 lines
1.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: target/early/build-initramfs.in
  5. # Copyright (C) 2007 - 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. INITRAMFS_POSTINSTALL_HOOK='early_adjust_initrd'
  15. # flatten
  16. ln -s . ${rootfs}/usr
  17. # don't break /tmp when flattening
  18. INITRAMFS_INSTALL_PATTERN="$INITRAMFS_INSTALL_PATTERN -e '/ usr\/tmp/d;'"
  19. INITRAMFS_EMPTY_PATTERN="-e '/\.\/rootfs/d;'"
  20. # initramfs_install <pkg_name> <sandbox> <rootfs>
  21. initramfs_install() {
  22. local root="$2" initrddir="$3"
  23. case "$1" in
  24. udev) cp -a "$root/lib/udev/devices"/* "$initrddir/dev/"
  25. return 0 ;;
  26. strace)
  27. cp "$root/usr/bin/strace" "$initrddir/bin/"
  28. ;;
  29. sysfiles)
  30. for x in etc/{,SDE-}VERSION etc/{passwd,group} etc/init.d/functions{,-ansi}.in; do
  31. cp "$root/$x" "$initrddir/$x"
  32. done
  33. for x in etc/{fstab,hosts,resolv.conf}; do
  34. touch "$initrddir/$x"
  35. done
  36. ;;
  37. dietlibc)
  38. # skip
  39. ;;
  40. *) return 0 ;;
  41. esac
  42. return 1
  43. }
  44. early_adjust_initrd() {
  45. echo_status "Tweaking initrd ..."
  46. for x in var/spool/{locks,mail} \
  47. usr/{doc,info,man,opt,spool} etc/init.d usr
  48. do
  49. rm ${rootfs}/$x
  50. done
  51. mkdir "${rootfs}/rootfs"
  52. set +x
  53. }
  54. initramfs_install_pattern() {
  55. local pkg_name="$1"; shift
  56. case "$pkg_name" in
  57. udev)
  58. echo -n "-n -e '/etc\/udev\//p;' -e '/lib.*\/udev\/devices\//p;' -e '/lib\/udev\/.*_id$/p;' "
  59. echo "-e '/sbin\/\(udevd\|udevadm\)$/P' -e '/lib\/udev\/rules.d\//p;'"
  60. ;;
  61. lvm2)
  62. echo "$@ -e '/sbin\/lvmdump$/d;'"
  63. ;;
  64. fhs)
  65. echo "-e '/\/local\(\|\/.*\)$/d;' $@"
  66. ;;
  67. *)
  68. echo "$@"
  69. ;;
  70. esac
  71. }