3
0

install.sh 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. export LC_ALL=POSIX
  3. export LC_CTYPE=POSIX
  4. prefix=$1
  5. if [ "$prefix" = "" ]; then
  6. echo "No installation directory, aborting."
  7. exit 1;
  8. fi
  9. if [ "$2" = "--hardlinks" ]; then
  10. linkopts="-f"
  11. else
  12. linkopts="-fs"
  13. fi
  14. h=`sort busybox.links | uniq`
  15. rm -f $prefix/bin/busybox || exit 1
  16. mkdir -p $prefix/bin || exit 1
  17. install -m 755 busybox $prefix/bin/busybox || exit 1
  18. for i in $h ; do
  19. appdir=`dirname $i`
  20. mkdir -p $prefix/$appdir || exit 1
  21. if [ "$2" = "--hardlinks" ]; then
  22. bb_path="$prefix/bin/busybox"
  23. else
  24. case "$appdir" in
  25. /)
  26. bb_path="bin/busybox"
  27. ;;
  28. /bin)
  29. bb_path="busybox"
  30. ;;
  31. /sbin)
  32. bb_path="../bin/busybox"
  33. ;;
  34. /usr/bin|/usr/sbin)
  35. bb_path="../../bin/busybox"
  36. ;;
  37. *)
  38. echo "Unknown installation directory: $appdir"
  39. exit 1
  40. ;;
  41. esac
  42. fi
  43. echo " $prefix$i -> $bb_path"
  44. ln $linkopts $bb_path $prefix$i || exit 1
  45. done
  46. exit 0