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.

43 lines
993 B

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