优化模板用户提示
This commit is contained in:
39
main.tf
39
main.tf
@@ -15,27 +15,27 @@ locals {
|
||||
}
|
||||
|
||||
data "coder_parameter" "clone_reference" {
|
||||
name = "克隆参考文档站点"
|
||||
name = "初始化荆棘鸟文学社参考文档"
|
||||
type = "bool"
|
||||
description = "是否克隆荆棘鸟参考文档站点"
|
||||
description = "是否初始化荆棘鸟参考文档"
|
||||
mutable = true
|
||||
default = "true"
|
||||
icon = "/emojis/1f4d6.png"
|
||||
}
|
||||
|
||||
data "coder_parameter" "clone_spbook" {
|
||||
name = "克隆高三特刊站点"
|
||||
name = "初始化荆棘鸟文学社高三特刊"
|
||||
type = "bool"
|
||||
description = "是否克隆荆棘鸟高三特刊站点"
|
||||
description = "是否初始化荆棘鸟文学社高三特刊"
|
||||
mutable = true
|
||||
default = "false"
|
||||
icon = "/emojis/1f4da.png"
|
||||
}
|
||||
|
||||
data "coder_parameter" "clone_main" {
|
||||
name = "克隆主站点"
|
||||
name = "初始化荆棘鸟文学社主站点"
|
||||
type = "bool"
|
||||
description = "是否克隆荆棘鸟主站点"
|
||||
description = "是否初始化荆棘鸟文学社主站点"
|
||||
mutable = true
|
||||
default = "false"
|
||||
icon = "/emojis/1f3e0.png"
|
||||
@@ -82,12 +82,13 @@ resource "coder_agent" "main" {
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
|
||||
# 生成 SSH 密钥对,不设置密码
|
||||
# 生成 SSH 密钥对
|
||||
ssh-keygen -t ed25519 -f ~/.ssh/git -N "" -C "${data.coder_workspace_owner.me.name}(${data.coder_workspace_owner.me.email})-${data.coder_workspace.me.name}"
|
||||
|
||||
# 创建 SSH 配置文件
|
||||
cat > ~/.ssh/config <<EOF
|
||||
Host ssh.lionhao.top
|
||||
StrictHostKeyChecking accept-new
|
||||
Port 4022
|
||||
User git
|
||||
IdentityFile ~/.ssh/git
|
||||
@@ -98,8 +99,9 @@ EOF
|
||||
chmod 600 ~/.ssh/git
|
||||
chmod 644 ~/.ssh/git.pub
|
||||
|
||||
echo "SSH key pair created. Your public key is:"
|
||||
echo "SSH 密钥对创建成功,你的公钥是:"
|
||||
cat ~/.ssh/git.pub
|
||||
echo "请将以上公钥添加到 Gitea 个人 SSH 密钥中"
|
||||
|
||||
# 添加 git 全局配置
|
||||
git config --global user.name "${data.coder_workspace_owner.me.name}"
|
||||
@@ -109,35 +111,32 @@ EOF
|
||||
|
||||
# 拉取仓库
|
||||
if [ "${data.coder_parameter.clone_reference.value}" = "true" ]; then
|
||||
echo "正在克隆 reference 仓库..."
|
||||
echo "正在克隆 荆棘鸟文学社参考文档站点仓库..."
|
||||
git clone https://gitea.lionhao.top/jjnwxs/jingji_reference.git
|
||||
echo "reference 仓库克隆完成"
|
||||
# 修改远程仓库地址为SSH
|
||||
echo "荆棘鸟文学社参考文档站点仓库 克隆完成"
|
||||
cd jingji_reference
|
||||
git remote set-url origin git@ssh.lionhao.top:jjnwxs/jingji_reference.git
|
||||
echo "reference 仓库远程地址已更新为SSH"
|
||||
echo "荆棘鸟文学社参考文档站点仓库 远程地址设置成功"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if [ "${data.coder_parameter.clone_spbook.value}" = "true" ]; then
|
||||
echo "正在克隆 spbook 仓库..."
|
||||
echo "正在克隆 荆棘鸟文学社高三特刊站点仓库..."
|
||||
git clone https://gitea.lionhao.top/jjnwxs/jingji_spbook.git
|
||||
echo "spbook 仓库克隆完成"
|
||||
# 修改远程仓库地址为SSH
|
||||
echo "荆棘鸟文学社高三特刊站点仓库 克隆完成"
|
||||
cd jingji_spbook
|
||||
git remote set-url origin git@ssh.lionhao.top:jjnwxs/jingji_spbook.git
|
||||
echo "spbook 仓库远程地址已更新为SSH"
|
||||
echo " 荆棘鸟文学社高三特刊站点仓库 远程地址设置成功"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if [ "${data.coder_parameter.clone_main.value}" = "true" ]; then
|
||||
echo "正在克隆 main 仓库..."
|
||||
echo "正在克隆 荆棘鸟文学社主站点仓库..."
|
||||
git clone https://gitea.lionhao.top/jjnwxs/jingji_main.git
|
||||
echo "main 仓库克隆完成"
|
||||
# 修改远程仓库地址为SSH
|
||||
echo "荆棘鸟文学社主站点仓库 克隆完成"
|
||||
cd jingji_main
|
||||
git remote set-url origin git@ssh.lionhao.top:jjnwxs/jingji_main.git
|
||||
echo "main 仓库远程地址已更新为SSH"
|
||||
echo "荆棘鸟文学社主站点仓库 远程地址设置成功"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user