更新工具箱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/ cp -rf install.sh mbfiles/
- name: Push changes - name: Push changes
env: env:
GH_REF: ${{ secrets.GH_REF }} GH_REF: github.com/monlor/mbfiles
CO_REF: ${{ secrets.CO_REF }} 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}') BRANCH_NAME: $(cd .. && git branch | awk '$1 == "*"{print $2}')
run: | run: |
cd mbfiles/ cd mbfiles/
@@ -64,5 +66,5 @@ jobs:
git add . git add .
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a 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 branch | grep -q "${BRANCH_NAME}" || git checkout -b "${BRANCH_NAME}""
eval "git push "${GH_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f" eval "git push "https://${GH_TOKEN}@${GH_REF}" "${BRANCH_NAME}":"${BRANCH_NAME}" -f"
# eval "git push "${CO_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 ``` 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 ``` 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`工具箱 #### 卸载`Monlor Tools`工具箱
``` shell ``` 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

@@ -136,6 +136,7 @@ backup() {
cp -rf ${mbroot}/apps/${line}/$file $mbbackup/${line}/$file &> /dev/null cp -rf ${mbroot}/apps/${line}/$file $mbbackup/${line}/$file &> /dev/null
done done
done done
cp -rf ${mbroot}/config/applist.txt $mbbackup/applist.txt
cp -rf ${mbroot}/scripts/userscript.sh $mbbackup/userscript.sh cp -rf ${mbroot}/scripts/userscript.sh $mbbackup/userscript.sh
cp -rf ${mbroot}/mbdb $mbbackup/mbdb cp -rf ${mbroot}/mbdb $mbbackup/mbdb
tar zcvf "$mbbackup".tar.gz $mbbackup > /dev/null 2>&1 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" supports="linux_arm,linux_mips,linux_x86_64"
appinfo="一款支持多平台多架构的Shell工具箱" appinfo="一款支持多平台多架构的Shell工具箱"
newinfo="新增base64_encode工具" newinfo="新增base64_encode工具"
version="0.1.8" version="0.1.9"

View File

@@ -59,3 +59,19 @@ base_decode() {
fi fi
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 read answer
#check root #check root
# [ "$USER" != "root" ] && logsh "【Tools】" "请使用root用户安装工具箱" && exit 1 # [ "$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" mbtmp="/tmp/mbtmp"
[ ! -d "${mbtmp}" ] && mkdir -p ${mbtmp} [ ! -d "${mbtmp}" ] && mkdir -p ${mbtmp}
model=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]') model=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
@@ -55,7 +55,7 @@ else
fi fi
[ "$result" != "200" ] && logsh "【Tools】" "文件下载失败!" && exit 1 [ "$result" != "200" ] && logsh "【Tools】" "文件下载失败!" && exit 1
logsh "【Tools】" "解压工具箱文件" 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 [ $? -ne 0 ] && logsh "【Tools】" "文件解压失败!" && exit 1
# 安装工具箱文件 # 安装工具箱文件
cp -rf ${mbtmp}/mixbox ${mbroot} cp -rf ${mbtmp}/mixbox ${mbroot}