install.sh 736 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env sh
  2. set -e
  3. NAME="dotfm"
  4. CURRDIR=$(pwd)
  5. DESTBIN=/usr/local/bin
  6. DESTMAN=/usr/local/share/man/man1
  7. mkdir -p $DESTBIN $DESTMAN
  8. if [ "$1" = "-h" ]; then
  9. echo "usage: ./install.sh [-h|-l|-u]"
  10. echo ""
  11. echo "options:"
  12. echo " -h print this message"
  13. echo " -l link the install files from source (not copy)"
  14. echo " -u uninstall all install files"
  15. echo ""
  16. elif [ "$1" = "-l" ]; then
  17. ln -iv "$CURRDIR/src/$NAME.py" "$DESTBIN/$NAME"
  18. ln -iv "$CURRDIR/src/$NAME.1" "$DESTMAN"
  19. elif [ "$1" = "-u" ]; then
  20. rm -i "$DESTBIN/$NAME"
  21. rm -i "$DESTMAN/$NAME.1"
  22. else
  23. cp -v "$CURRDIR/src/$NAME.py" "$DESTBIN/$NAME"
  24. chmod +x "$DESTBIN/$NAME"
  25. chown root:wheel "$DESTBIN/$NAME"
  26. cp -v "$CURRDIR/src/$NAME.1" "$DESTMAN"
  27. fi