OpenSDE Packages Database (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.

63 lines
1.9 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../mkpkg/mkpkg.sh
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 2003 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. if [ "$#" -lt 2 -o -z "$1" -o -z "${1##-*}" ]; then
  17. echo ""
  18. echo "Usage: $0 <pkg-name> <install-command>"
  19. echo ""
  20. echo "E.g.:"
  21. echo ""
  22. echo " cd /usr/local/src/foobar-1.0"
  23. echo " ./configure && make"
  24. echo " mkpkg foobar make install"
  25. echo ""
  26. exit 1
  27. fi
  28. pkg=$1; shift
  29. slog=`mktemp` wlog=`mktemp` flog=`mktemp`
  30. strace -o $slog -F -f -q -e open,creat,`
  31. `mkdir,mknod,link,symlink,rename,utime,chdir,`
  32. `execve,fork,vfork,_exit,exit_group -p $$ &
  33. strace_pid=$!; sleep 1; cd $PWD
  34. "$@"
  35. sleep 1; kill -INT $strace_pid; sleep 1
  36. /usr/lib/fl_stparse -w $wlog < $slog
  37. touch /var/adm/flists/$pkg
  38. {
  39. /usr/lib/fl_wrparse -s -r / -p "$pkg" < $wlog
  40. for x in flists packages dependencies descs cksums md5sums ; do
  41. echo "$pkg: var/adm/$x/$pkg" ; done
  42. } | cat /var/adm/flists/$pkg - |
  43. egrep -v '^[^ ]+: (dev|proc|tmp)(/|$)' | sort -u > $flog
  44. cat $flog > /var/adm/flists/$pkg
  45. cd /
  46. egrep -v "^$pkg: var/adm/" var/adm/flists/$pkg | cut -f2- -d' ' | \
  47. xargs cksum > var/adm/cksums/$pkg
  48. egrep -v "^$pkg: var/adm/" var/adm/flists/$pkg | cut -f2- -d' ' | \
  49. xargs md5sum > var/adm/md5sums/$pkg
  50. touch var/adm/{dependencies,descs}/$pkg
  51. echo "Package Name and Version: $pkg 0000 mkpkg" > var/adm/packages/$pkg
  52. echo "[ Created package $pkg with" $( wc -l < $flog ) "files. ]"
  53. rm -f $wlog $slog $flog