init.example 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # 先克隆 shell-kit 仓库(如果不存在)
  3. if [ ! -d "/workspace/shell-kit" ]; then
  4. echo "正在克隆 shell-kit 仓库..."
  5. if git clone https://github.com/Kit/shell-kit.git /workspace/shell-kit; then
  6. echo "shell-kit 仓库克隆完成"
  7. else
  8. echo "错误:shell-kit 仓库克隆失败"
  9. exit 1
  10. fi
  11. else
  12. echo "shell-kit 仓库已存在,跳过克隆"
  13. fi
  14. # 配置SSH服务
  15. if [ -f "/workspace/shell-kit/setup-ssh.sh" ]; then
  16. echo "正在配置 SSH 服务..."
  17. chmod +x /workspace/shell-kit/setup-ssh.sh
  18. /workspace/shell-kit/setup-ssh.sh
  19. else
  20. echo "警告:SSH 配置脚本不存在,跳过 SSH 配置"
  21. fi
  22. # 安装 trunk 工具并初始化
  23. if [ -f "/workspace/shell-kit/setup-trunk.sh" ]; then
  24. echo "正在安装 trunk 工具并初始化..."
  25. chmod +x /workspace/shell-kit/setup-trunk.sh
  26. /workspace/shell-kit/setup-trunk.sh
  27. else
  28. echo "警告:trunk 安装脚本不存在,跳过 trunk 安装和初始化"
  29. fi
  30. # 安装 gentool 工具
  31. if [ -f "/workspace/shell-kit/setup-gentool.sh" ]; then
  32. echo "正在安装 gentool 工具..."
  33. chmod +x /workspace/shell-kit/setup-gentool.sh
  34. /workspace/shell-kit/setup-gentool.sh
  35. else
  36. echo "警告:gentool 安装脚本不存在,跳过 gentool 安装"
  37. fi
  38. # 安装 MySQL CLI 工具
  39. if [ -f "/workspace/shell-kit/setup-mysql-cli.sh" ]; then
  40. echo "正在安装 MySQL CLI 工具..."
  41. chmod +x /workspace/shell-kit/setup-mysql-cli.sh
  42. /workspace/shell-kit/setup-mysql-cli.sh
  43. else
  44. echo "警告:MySQL CLI 安装脚本不存在,跳过 MySQL CLI 安装"
  45. fi
  46. # 安装 pnpm 包管理器
  47. if [ -f "/workspace/shell-kit/setup-pnpm.sh" ]; then
  48. echo "正在安装 pnpm 包管理器并清理缓存..."
  49. chmod +x /workspace/shell-kit/setup-pnpm.sh
  50. /workspace/shell-kit/setup-pnpm.sh
  51. else
  52. echo "警告:pnpm 安装脚本不存在,跳过 pnpm 安装和缓存清理"
  53. fi