comparison Mercurial/CreathgRepos.sh @ 1:44d6d3cb28a0

fix:CreathgRepos.sh Delete Chinese and use English
author Pluto <meokcin@gmail.com>
date Tue, 03 Sep 2024 16:38:26 +0800
parents edd512324c03
children
comparison
equal deleted inserted replaced
0:edd512324c03 1:44d6d3cb28a0
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # 提示用户输入仓库名称 3 echo "Please enter the repository name (not in Chinese):"
4 echo "请输入仓库名称(不要中文):"
5 read repo_name 4 read repo_name
6 5
7 # 创建仓库目录
8 repo_path="/var/hg/$repo_name" 6 repo_path="/var/hg/$repo_name"
9 mkdir -p "$repo_path" 7 mkdir -p "$repo_path"
10 8
11 # 检查目录是否创建成功
12 if [ ! -d "$repo_path" ]; then 9 if [ ! -d "$repo_path" ]; then
13 echo "目录创建失败,请检查权限或磁盘空间。" 10 echo "Directory creation failed, please check permissions or disk space."
14 exit 1 11 exit 1
15 fi 12 fi
16 13
17 # 初始化Mercurial仓库
18 hg init "$repo_path" 14 hg init "$repo_path"
19 15
20 # 更改仓库所有者为www-data
21 sudo chown -R www-data:www-data "$repo_path" 16 sudo chown -R www-data:www-data "$repo_path"
22 17
23 # 更改仓库权限为755 18
24 sudo chmod -R 755 "$repo_path" 19 sudo chmod -R 755 "$repo_path"
25 20
26 # 提示用户输入description和contact的内容 21 echo "Please enter the description :"
27 echo "请输入description的内容:"
28 read description 22 read description
29 echo "请输入contact的内容:" 23 echo "Please enter the contact :"
30 read contact 24 read contact
31 25
32 # 构建hgrc文件内容
33 hgrc_content="[web] 26 hgrc_content="[web]
34 description = $description 27 description = $description
35 contact = $contact" 28 contact = $contact"
36 29
37 # 写入.hg/hgrc文件
38 hgrc_path="$repo_path/.hg/hgrc" 30 hgrc_path="$repo_path/.hg/hgrc"
39 echo "$hgrc_content" | sudo tee "$hgrc_path" > /dev/null 31 echo "$hgrc_content" | sudo tee "$hgrc_path" > /dev/null
40 32
41 echo "仓库已成功创建并配置在 $repo_path" 33 echo "New repositoryinitialized successfully in $repo_path"
42 echo "hgrc文件已更新。" 34 echo "The hgrc file has been updated."
备案号:苏ICP备2024087954号-2 | 渝公网安备50010402001513