npaste is a simple pastebin for text and images, supporting end-to-end encryption using GPG.
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.

63 lines
1.6 KiB

  1. #!/bin/bash
  2. #########################################################
  3. #
  4. # curl https://src.grytoyr.io/kim/npaste/raw/branch/master/cli-script/setup.sh | sudo env CFG_DIR=/home/user/.config/npaste bash
  5. #
  6. #########################################################
  7. ## Get correct group name
  8. case "$(uname -s)" in
  9. Darwin*) GROUPNAME=staff;;
  10. *) GROUPNAME="$SUDO_USER";;
  11. esac
  12. if [ -z "$TAG" ]; then
  13. TAG=v0.6.5
  14. fi
  15. if [ -z "$CFG_DIR" ]; then
  16. CFG_DIR=$HOME/.config/npaste
  17. fi
  18. if [ -z "$INSTALL_DIR" ]; then
  19. INSTALL_DIR=$HOME/bin
  20. fi
  21. if [ ! -d "$INSTALL_DIR" ]; then
  22. echo "INSTALL_DIR not found. You need to create it first ($INSTALL_DIR)"
  23. exit
  24. fi
  25. if [ ! -d "$CFG_DIR" ]; then
  26. echo "Creating $CFG_DIR ..."
  27. mkdir -p "$CFG_DIR"
  28. chown $SUDO_USER:$GROUPNAME "$CFG_DIR"
  29. else
  30. echo "$CFG_DIR already exists ..."
  31. fi
  32. if [ ! -f "$CFG_DIR/cli.conf" ]; then
  33. echo "Creating config file ..."
  34. curl -s -o "$CFG_DIR/cli.conf" "https://src.grytoyr.io/kim/npaste/raw/tag/$TAG/cli-script/cli.conf.example"
  35. chown $SUDO_USER:$GROUPNAME "$CFG_DIR/cli.conf"
  36. else
  37. echo "Config file already exists ..."
  38. fi
  39. if [ ! -f "$CFG_DIR/vaults" ]; then
  40. echo "Creating vaults file ..."
  41. touch "$CFG_DIR/vaults"
  42. chown $SUDO_USER:$GROUPNAME "$CFG_DIR/vaults"
  43. else
  44. echo "Vaults file already exists ..."
  45. fi
  46. echo "Downloading npaste script $TAG ..."
  47. curl -s -o "$INSTALL_DIR/npaste" "https://src.grytoyr.io/kim/npaste/raw/tag/$TAG/cli-script/npaste"
  48. chmod +x "$INSTALL_DIR/npaste"
  49. echo
  50. echo "Installation complete! Remember to edit the config file:"
  51. echo " $CFG_DIR/cli.conf"
  52. echo