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.

69 lines
1.6 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../udev/scripts/cdsymlink_helper.sh
  6. # Copyright (C) 2006 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. ########################################################################
  16. #
  17. # Description : cdsymlink_helper.sh
  18. #
  19. # Authors : Jim Gifford
  20. #
  21. # Version : 00.00
  22. #
  23. # Notes :
  24. #
  25. ########################################################################
  26. . /lib/udev/helper.functions
  27. . /etc/sysconfig/udev_helper
  28. KERN_NAME="$1"
  29. BUS="$2"
  30. test=0
  31. if [ "$KERN_NAME" = "" ]; then
  32. mesg Bad invocation: \$1 is not set
  33. exit 1
  34. fi
  35. if [ "$BUS" = "ide" ]; then
  36. FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep '\.' `"
  37. for file in $FILES; do
  38. TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c $KERN_NAME`"
  39. if [ "$TEST" = "1" ]; then
  40. link="`echo $file | cut -f2 -d.`"
  41. while [ $test -lt 1 ] ; do
  42. if [ -e /dev/cdrom$link ]; then
  43. link=$[$link+1]
  44. else
  45. test=1
  46. echo $link
  47. fi
  48. done
  49. fi
  50. done
  51. fi
  52. if [ "$BUS" = "scsi" ]; then
  53. link=$KERN_NAME
  54. while [ $test -lt 1 ] ; do
  55. if [ -e /dev/cdrom$link ]; then
  56. link=$[$link+1]
  57. else
  58. test=1
  59. echo $link
  60. fi
  61. done
  62. fi