install 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #! /bin/bash
  2. # Link everthing in '$PWD' to a dir in '~/$PWD'
  3. #
  4. # Usage:
  5. # install [options]
  6. #
  7. # options from link2home.sh. Default
  8. #
  9. # --remove --debug --verbose
  10. #
  11. # Any files listed (one per line) in .install.ignore will be ignored
  12. ARGC=$# # Number of args, not counting $0
  13. # get the directory of this script
  14. WHERE_AM_I="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  15. cd ${WHERE_AM_I}
  16. # Extract the directory name of this file
  17. BASEDIR=`basename $WHERE_AM_I`
  18. if [ -e ${HOME}/bin/link2home.sh ]; then
  19. LINK2HOME="${HOME}/bin/link2home.sh"
  20. elif [ -e ${WHERE_AM_I}/link2home.sh ]; then
  21. LINK2HOME="${WHERE_AM_I}/link2home.sh"
  22. else
  23. echo "Can't find link2home.sh"
  24. exit 1
  25. fi
  26. echo Linking evertying in "${WHERE_AM_I}" into "~/""${BASEDIR}"
  27. if [[ $ARGC -gt 1 ]]; then
  28. echo using args ${LINK2HOME} $*
  29. else
  30. # default args
  31. ${LINK2HOME} --verbose --debug --remove
  32. fi
  33. # any directory specific post-processing (permissions, etc) goes here.