core: 添加脚本版本匹配检查
This commit is contained in:
parent
6486928f3a
commit
b9219cc0c7
13
reinstall.sh
13
reinstall.sh
@ -7,6 +7,9 @@ confhome=https://raw.githubusercontent.com/bin456789/reinstall/main
|
|||||||
confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
|
confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
|
||||||
# confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main
|
# confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main
|
||||||
|
|
||||||
|
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
||||||
|
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0001
|
||||||
|
|
||||||
# https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html
|
# https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
@ -16,8 +19,7 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
|
|||||||
|
|
||||||
# 记录日志
|
# 记录日志
|
||||||
exec > >(exec tee /reinstall.log) 2>&1
|
exec > >(exec tee /reinstall.log) 2>&1
|
||||||
|
THIS_SCRIPT=$(readlink -f "$0")
|
||||||
this_script=$(readlink -f "$0")
|
|
||||||
trap 'trap_err $LINENO $?' ERR
|
trap 'trap_err $LINENO $?' ERR
|
||||||
|
|
||||||
trap_err() {
|
trap_err() {
|
||||||
@ -25,7 +27,7 @@ trap_err() {
|
|||||||
ret_no=$2
|
ret_no=$2
|
||||||
|
|
||||||
error "Line $line_no return $ret_no"
|
error "Line $line_no return $ret_no"
|
||||||
sed -n "$line_no"p "$this_script"
|
sed -n "$line_no"p "$THIS_SCRIPT"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage_and_exit() {
|
usage_and_exit() {
|
||||||
@ -2821,6 +2823,11 @@ mod_initrd() {
|
|||||||
$(is_in_windows && echo --nonmatching 'dev/console' --nonmatching 'dev/null')
|
$(is_in_windows && echo --nonmatching 'dev/console' --nonmatching 'dev/null')
|
||||||
|
|
||||||
curl -Lo $initrd_dir/trans.sh $confhome/trans.sh
|
curl -Lo $initrd_dir/trans.sh $confhome/trans.sh
|
||||||
|
if ! grep -i "$SCRIPT_VERSION" $initrd_dir/trans.sh; then
|
||||||
|
error_and_exit "
|
||||||
|
This script is outdated, please download reinstall.sh again.
|
||||||
|
脚本有更新,请重新下载 reinstall.sh"
|
||||||
|
fi
|
||||||
curl -Lo $initrd_dir/alpine-network.sh $confhome/alpine-network.sh
|
curl -Lo $initrd_dir/alpine-network.sh $confhome/alpine-network.sh
|
||||||
chmod a+x $initrd_dir/trans.sh $initrd_dir/alpine-network.sh
|
chmod a+x $initrd_dir/trans.sh $initrd_dir/alpine-network.sh
|
||||||
|
|
||||||
|
4
trans.sh
4
trans.sh
@ -6,6 +6,10 @@
|
|||||||
# 出错后停止运行,将进入到登录界面,防止失联
|
# 出错后停止运行,将进入到登录界面,防止失联
|
||||||
set -eE
|
set -eE
|
||||||
|
|
||||||
|
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0001
|
||||||
|
|
||||||
# debian 安装版、ubuntu 安装版、el/ol 安装版不使用该密码
|
# debian 安装版、ubuntu 安装版、el/ol 安装版不使用该密码
|
||||||
PASSWORD=123@@@
|
PASSWORD=123@@@
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user