home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / linux-headers-2.6.17-6 / examples / create_link
Encoding:
Text File  |  2006-08-11  |  1.6 KB  |  54 lines

  1. #! /bin/sh
  2. #                               -*- Mode: Sh -*- 
  3. # create_link --- 
  4. # Author           : Manoj Srivastava ( srivasta@glaurung.internal.golden-gryphon.com ) 
  5. # Created On       : Sun Nov  6 10:21:35 2005
  6. # Created On Node  : glaurung.internal.golden-gryphon.com
  7. # Last Modified By : Manoj Srivastava
  8. # Last Modified On : Sun Nov  6 10:21:35 2005
  9. # Last Machine Used: glaurung.internal.golden-gryphon.com
  10. # Update Count     : 0
  11. # Status           : Unknown, Use with caution!
  12. # HISTORY          : 
  13. # Description      : This is a pure example script, and is not actually used -- yet.
  14. # arch-tag: 493060cf-3945-44d1-a525-f891b25ac6c5 
  15. #
  16.  
  17. set -e
  18.  
  19. if [ $# -ne 2 ]; then
  20.     echo Usage: $0 version location
  21.     exit 2
  22. fi
  23.  
  24.  
  25. my_version="2.6.17-6";                # automatically substituted at build
  26. package_name="linux-headers-2.6.17-6";  # automatically substituted at build
  27.  
  28. version="$1"
  29. vmlinuz_location="$2"
  30.  
  31. # We should only do any work if the correct kernel image is being installed
  32. if [ "$my_version" != "$version" ]; then
  33.     exit 0;                     # Not a relevant version being installed
  34. fi
  35.  
  36. # If the build link exists, we should do nothing: the kernel image
  37. # postinst would have removed any dangling links by now, so any
  38. # existing link is valid -- perhaps the kernel was compiled on this
  39. # machine, and the link points to a real build tree?
  40. if [ -e "/lib/modules/$version/build" ]; then
  41.     exit 0
  42. fi
  43.  
  44. # We need to be run as root
  45. test $(id -u) = 0 || (echo need root priviledges; exit 1)
  46.  
  47. if [ -d "/lib/modules/$version" ] && [ -d "/usr/src/$package_name" ]; then
  48.     ln -s "/usr/src/$package_name" "/lib/modules/$version/build"
  49. fi
  50.  
  51. exit 0;
  52.  
  53.