MIAOU-BASH is a collection of settings and helpers for leveraging BASH. Developer-friendly, it may be used as solo package with or without the miaou project.
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.

39 lines
916 B

8 months ago
8 months ago
  1. #!/bin/bash
  2. function install() {
  3. [ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1
  4. if [[ ! $CURDIR == '/opt/miaou-bash' ]]; then
  5. # download and fullfill /opt/miaou-bash, then run it from folder
  6. if [[ -L /opt/miaou-bash ]]; then
  7. cd /opt/miaou-bash && ./install.sh
  8. exit 0
  9. else
  10. rm -rf /opt/miaou-bash
  11. TEMP=$(mktemp -d)
  12. cd "$TEMP" || return
  13. echo "$TEMP"
  14. wget https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz
  15. tar -xzf main.tar.gz
  16. mv miaou-bash /opt/
  17. cd /opt/miaou-bash || return
  18. ./install.sh "$PARAM1"
  19. rm -rf "$TEMP"
  20. exit 0
  21. fi
  22. else
  23. apt-get update
  24. apt-get install -y "${REQUIRED_PKGS[@]}"
  25. ./init.sh
  26. fi
  27. }
  28. ## MAIN
  29. CURDIR=$PWD
  30. REQUIRED_PKGS=(file git bc)
  31. install