-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
47 lines (38 loc) · 917 Bytes
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
LOCAL_FILES_DIR=$(pwd)
REPO_URL="https://github.com/fatedier/frp.git"
REPO_DIR="/tmp/frp"
if [ -d "source" ]; then
rm -rf source
fi
mkdir source
# 克隆 GitHub 仓库
if [ -d "$REPO_DIR" ]; then
rm -rf "$REPO_DIR"
fi
git clone "$REPO_URL" "$REPO_DIR"
cd "$REPO_DIR" || exit 1
# 将本地文件复制到仓库目录
cp -r "$LOCAL_FILES_DIR"/* "$REPO_DIR"
rm -rf init.sh
# 检查并合并文件
git add .
# 提交更改
git commit -m "合并代码" || {
echo "没有修改"
}
cp -r "$REPO_DIR"/* "$LOCAL_FILES_DIR"/source
# 解决冲突(如果有)
if git status | grep -q "conflict"; then
git status
else
cd "$LOCAL_FILES_DIR"/source
go get github.com/shirou/gopsutil/cpu
go get github.com/shirou/gopsutil/disk
go get github.com/shirou/gopsutil/host
go get github.com/shirou/gopsutil/load
go get github.com/shirou/gopsutil/mem
cd $LOCAL_FILES_DIR
echo "cd source"
echo "make"
fi