update.sh 675 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. set -e
  3. if [ $UID -ne 0 ]; then
  4. echo "请用root用户运行当前脚本 (su root)" && exit 1
  5. fi
  6. config_dir="/opt/minio-store/minio-store/config"
  7. if [ ! -d "$config_dir" ]; then
  8. echo "配置文件夹不存在,请检查是否安装了minio-store"
  9. exit
  10. fi
  11. echo "正在更新minio-store..."
  12. rm -rf /tmp/minio-store-tmp
  13. mkdir -p /tmp/minio-store-tmp
  14. cp -rf $config_dir /tmp/minio-store-tmp
  15. ./uninstall.sh
  16. ./install.sh
  17. echo "正在恢复配置文件..."
  18. rsync -a --delete /tmp/minio-store-tmp/config/ "$config_dir"
  19. chmod 777 -R "$config_dir"
  20. rm -rf /tmp/minio-store-tmp
  21. echo "更新完成!"
  22. systemctl start minio-store
  23. echo "minio-store已启动"