更新工具箱versioncmp,尝试使用gitee源

This commit is contained in:
monlor
2020-03-05 15:41:07 +08:00
parent 9244a96773
commit 0bb0ad279b
9 changed files with 31 additions and 12 deletions

View File

@@ -53,8 +53,10 @@ jobs:
cp -rf install.sh mbfiles/
- name: Push changes
env:
GH_REF: ${{ secrets.GH_REF }}
CO_REF: ${{ secrets.CO_REF }}
GH_REF: github.com/monlor/mbfiles
GE_REF: gitee.com/monlor/mbfiles
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GE_TOKEN: ${{ secrets.GE_TOKEN }}
BRANCH_NAME: $(cd .. && git branch | awk '$1 == "*"{print $2}')
run: |
cd mbfiles/
@@ -64,5 +66,5 @@ jobs:
git add .
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a
eval "git branch | grep -q "${BRANCH_NAME}" || git checkout -b "${BRANCH_NAME}""
eval "git push "${GH_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f"
# eval "git push "${CO_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f"
eval "git push "https://${GH_TOKEN}@${GH_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f"
eval "git push "https://${GE_TOKEN}@${GE_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f"

View File

@@ -88,19 +88,19 @@
#### 一键安装
``` shell
sh -c "$(curl -kfsSl https://cdn.jsdelivr.net/gh/monlor/mbfiles@master/install.sh)" && source /etc/profile &> /dev/null
sh -c "$(curl -kfsSl https://gitee.com/monlor/mbfiles/raw/master/install.sh)" && source /etc/profile &> /dev/null
```
### 手动更新命令
``` shell
sh -c "$(curl -kfsSl https://cdn.jsdelivr.net/gh/monlor/MIXBOX@master/apps/mixbox/scripts/update.sh)" && source /etc/profile &> /dev/null
sh -c "$(curl -kfsSl https://raw.githubusercontent.com/monlor/MIXBOX/master/apps/mixbox/scripts/update.sh)" && source /etc/profile &> /dev/null
```
#### 卸载`Monlor Tools`工具箱
``` shell
sh -c "$(curl -kfsSl https://cdn.jsdelivr.net/gh/monlor/mbfiles@master/temp/uninstall_old.sh)" && source /etc/profile &> /dev/null
sh -c "$(curl -kfsSl https://gitee.com/monlor/mbfiles/raw/master/temp/uninstall_old.sh)" && source /etc/profile &> /dev/null
```
#### 一键更新所有插件(请先更新工具箱)

View File

@@ -130,12 +130,13 @@ backup() {
cp -rf ${mbroot}/mbdb $mbbackup
applist installed -n | while read line; do
echo "$(mbdb get ${line}.main.backupfiles)" | tr ',' '\n' | while read file; do
[ -z "$file" ] && continue
[ -z "$file" ] && continue
savepath="$(dirname $mbbackup/${line}/$file)"
[ ! -d "$savepath" ] && mkdir -p $savepath
cp -rf ${mbroot}/apps/${line}/$file $mbbackup/${line}/$file &> /dev/null
done
done
cp -rf ${mbroot}/config/applist.txt $mbbackup/applist.txt
cp -rf ${mbroot}/scripts/userscript.sh $mbbackup/userscript.sh
cp -rf ${mbroot}/mbdb $mbbackup/mbdb
tar zcvf "$mbbackup".tar.gz $mbbackup > /dev/null 2>&1

Binary file not shown.

View File

@@ -4,4 +4,4 @@ needver=""
supports="linux_arm,linux_mips,linux_x86_64"
appinfo="一款支持多平台多架构的Shell工具箱"
newinfo="新增base64_encode工具"
version="0.1.8"
version="0.1.9"

View File

@@ -58,4 +58,20 @@ base_decode() {
echo -n "$*" | baseutil --b64 -d
fi
fi
}
}
# $1 > $2 => -1
# $1 < $2 => 1
# $1 = $2 => 0
versioncmp() {
[ "$1" = "$2" ] && echo -n "0" && return
if test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; then
echo -n "-1"
else
echo -n "1"
fi
}

View File

@@ -17,7 +17,7 @@ logsh "【Tools】" "请按任意键安装工具箱(Ctrl + C 退出)."
read answer
#check root
# [ "$USER" != "root" ] && logsh "【Tools】" "请使用root用户安装工具箱" && exit 1
mburl="https://monlor.coding.net/p/mbfiles/d/mbfiles/git/raw/master"
mburl="https://gitee.com/monlor/mbfiles/raw/master"
mbtmp="/tmp/mbtmp"
[ ! -d "${mbtmp}" ] && mkdir -p ${mbtmp}
model=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
@@ -55,7 +55,7 @@ else
fi
[ "$result" != "200" ] && logsh "【Tools】" "文件下载失败!" && exit 1
logsh "【Tools】" "解压工具箱文件"
tar -zxvf ${mbtmp}/mixbox.tar.gz -C ${mbtmp}
tar -zxvf ${mbtmp}/mixbox.tar.gz -C ${mbtmp} > /dev/null
[ $? -ne 0 ] && logsh "【Tools】" "文件解压失败!" && exit 1
# 安装工具箱文件
cp -rf ${mbtmp}/mixbox ${mbroot}