This repository has been archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.bak.sh
executable file
·61 lines (59 loc) · 1.76 KB
/
update.bak.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
function Update() {
GetOSName
local OSType=$?
echo "更新APT仓库中..."
if [ "$OSType" == "0" ]; then
echo "正在安装reprepro"
sudo dnf install reprepro -y
elif [ "$OSType" == "1" ]; then
echo "正在安装reprepro"
sudo apt install reprepro -y
fi
reprepro -C main -b ./deb includedeb nini ./download/*.deb
echo "APT仓库更新完成"
echo "更新RPM仓库中..."
mv ./download/*.rpm ./rpm/dist/
if [ "$OSType" == "0" ]; then
echo "正在安装createrepo"
sudo dnf install createrepo -y
elif [ "$OSType" == "1" ]; then
echo "正在安装createrepo"
sudo apt install createrepo -y
fi
createrepo --update ./rpm/dist
echo "RPM仓库更新完成"
echo "All done~"
}
function GetOSName() {
if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
Name='CentOS'
OS=0
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
Name='Debian'
OS=1
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
Name='Ubuntu'
OS=2
else
Name='unknow'
fi
if [ $Name != 'unknow' ]; then
echo -e '检测到您的系统为: '$Name''
return $OS
else
echo -e '不支持的操作系统,请更换为 CentOS / Debian / Ubuntu 后重试。'
exit 1
fi
}
Update
LatestVer="${GITHUB_REF#"refs/tags/"}"
git config --local user.name 'github-actions[bot]'
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add --all
git commit -m "update to $LatestVer"
echo $LatestVer | sed 's/-/~/g' > LatestVer
git tag -d "$LatestVer"
git tag "$LatestVer"
git push
git push --tags