Skip to content

Commit

Permalink
fix get version; refine docs;
Browse files Browse the repository at this point in the history
  • Loading branch information
northsea4 committed Dec 26, 2023
1 parent 62c3226 commit 36d48b1
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 47 deletions.
14 changes: 7 additions & 7 deletions .env.versions
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 本项目版本
PROJECT_VERSION=0.7.0
PROJECT_VERSION=0.7.1

#=== start === gui-base images ==========================

# `stainless403/gui-base`镜像版本
GUI_BASE_VERSION=0.4.0

# `stainless403/mdcx-builtin-gui-base`镜像版本
GUI_BASE_MDCX_BUILTIN_VERSION=120231219
GUI_BASE_MDCX_BUILTIN_VERSION=120231226

# `stainless403/mdcx-src-gui-base`镜像版本
GUI_BASE_MDCX_SRC_VERSION=0.2.0
GUI_BASE_MDCX_SRC_VERSION=0.2.1

#=== end === gui-base images ==========================

Expand All @@ -21,10 +21,10 @@ GUI_BASE_MDCX_SRC_VERSION=0.2.0
WEBTOP_BASE_VERSION=0.1.2

# `stainless403/mdcx-builtin-webtop-base`镜像版本
WEBTOP_BASE_MDCX_BUILTIN_VERSION=120231219
WEBTOP_BASE_MDCX_BUILTIN_VERSION=120231226

# `stainless403/mdcx-src-webtop-base`镜像版本
WEBTOP_BASE_MDCX_SRC_VERSION=0.2.0
WEBTOP_BASE_MDCX_SRC_VERSION=0.2.1

#=== end === webtop-base images ==========================

Expand All @@ -35,10 +35,10 @@ WEBTOP_BASE_MDCX_SRC_VERSION=0.2.0
BUILD_MDCX_BASE_VERSION=0.4.0

# `stainless403/build-mdcx`镜像版本
BUILD_MDCX_VERSION=120231219
BUILD_MDCX_VERSION=120231226

#=== end === build-mdcx images ==========================


# MDCx最新版本
MDCX_APP_VERSION=120231219
MDCX_APP_VERSION=120231226
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,4 @@ docker run -d --name mdcx \


## FAQ
请查看 [FAQ](https://github.com/northsea4/mdcx-docker/blob/main/FAQ.md)

## TODOs
- [ ] 更新部署文档
请查看 [FAQ](https://github.com/northsea4/mdcx-docker/blob/main/FAQ.md)
2 changes: 2 additions & 0 deletions gui-base/mdcx-builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ mkdir -p $MDCX_DOCKER_DIR && cd $MDCX_DOCKER_DIR
mkdir -p mdcx-config logs data
# 必须:配置文件目录标记文件
echo "/mdcx-config/config.ini" > mdcx-config/MDCx.config
# 确保有config.ini文件
touch mdcx-config/config.ini

docker run -d --name mdcx \
-p 5800:5800 `#Web访问端口` \
Expand Down
13 changes: 4 additions & 9 deletions gui-base/mdcx-src.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

> 优点是`轻量`,缺点是只支持通过网页查看,且没有文件管理。
> ⚠️ 请注意,因为上游项目已删库,所以已不支持部署`mdcx-src-gui-base`镜像。


## 1. mdcx-src示例
Expand Down Expand Up @@ -48,15 +46,12 @@ bash -c "$(wget https://raw.githubusercontent.com/northsea4/mdcx-docker/main/ins
```
mdcx-docker
|-- app ------应用源码目录
|-- Data
|-- Function
|-- Getter
|-- Img
|-- LICENSE
|-- MDCx_Main.py
|-- libs
|-- resources
|-- src
|-- main.py
|-- requirements.txt
|-- setup.py
|-- Ui
...
|-- data ------容器系统数据
...
Expand Down
25 changes: 19 additions & 6 deletions gui-base/update-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ compareVersion () {
return 0
}

# 从`appPath/config.ini.default`获取应用版本
# [modified_time]
# modified_time = 2023-12-19 23:53:41
# version = 120231219
getAppVersionFromConfig () {
local configPath="$1"
if [[ -f "$configPath" ]]; then
local version=$(cat $configPath | grep -oi 'version\s*=\s*[0-9]\+' | grep -oi '[0-9]\+$')
echo $version
else
echo 0
fi
}

appPath=$(echo "$appPath" | sed 's:/*$::')
isEmpty=0

Expand All @@ -115,14 +129,13 @@ if [[ -n "${appPath}" ]]; then
echo "⚠️ $appPath 不存在,现在创建"
mkdir -p $appPath
else
if [[ -f "$appPath/setup.py" ]]; then
# 'CFBundleShortVersionString': "20230201",
appVersion=$(cat $appPath/setup.py | grep -oi 'CFBundleShortVersionString.: "[a-z0-9]\+' | grep -oi '[a-z0-9]\+$')
echo "ℹ️ 从 $appPath/setup.py 检测到应用版本为 $appVersion"
else
appConfigPath="$appPath/config.ini.default"
appVersion=$(getAppVersionFromConfig "$appConfigPath")
if [[ $appVersion == 0 ]]; then
isEmpty=1
appVersion=0
echo "ℹ️ 本地应用版本: $appVersion"
else
echo "ℹ️ 从 $appConfigPath 检测到应用版本为 $appVersion"
fi
fi
else
Expand Down
2 changes: 2 additions & 0 deletions webtop-base/mdcx-builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ mkdir -p $MDCX_DOCKER_DIR && cd $MDCX_DOCKER_DIR
mkdir -p mdcx-config logs data
# 必须:配置文件目录标记文件
echo "/mdcx-config/config.ini" > mdcx-config/MDCx.config
# 确保有config.ini文件
touch mdcx-config/config.ini

docker run -d --name mdcx \
-p 3000:3000 `#Web访问端口` \
Expand Down
13 changes: 4 additions & 9 deletions webtop-base/mdcx-src.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

> 优点是`远程桌面``文件管理``浏览器`,缺点是资源占用相对高一些,上手难度也稍高。
> ⚠️ 请注意,因为上游项目已删库,所以已不支持部署`mdcx-src-webtop-base`镜像。


## 1. mdcx-src示例
Expand Down Expand Up @@ -46,15 +44,12 @@ bash -c "$(wget https://raw.githubusercontent.com/northsea4/mdcx-docker/main/ins
```
mdcx-docker
|-- app ------应用源码目录
|-- Data
|-- Function
|-- Getter
|-- Img
|-- LICENSE
|-- MDCx_Main.py
|-- libs
|-- resources
|-- src
|-- main.py
|-- requirements.txt
|-- setup.py
|-- Ui
...
|-- data ------容器系统数据
...
Expand Down
26 changes: 20 additions & 6 deletions webtop-base/rootfs-src/app-assets/scripts/update-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,30 @@ compareVersion () {
return 0
}

# 从`appPath/config.ini.default`获取应用版本
# [modified_time]
# modified_time = 2023-12-19 23:53:41
# version = 120231219
getAppVersionFromConfig () {
local configPath="$1"
if [[ -f "$configPath" ]]; then
local version=$(cat $configPath | grep -oi 'version\s*=\s*[0-9]\+' | grep -oi '[0-9]\+$')
echo $version
else
echo 0
fi
}

appPath=$(echo "$appPath" | sed 's:/*$::')


if [[ -f "$appPath/setup.py" ]]; then
# 'CFBundleShortVersionString': "20230201",
appVersion=$(cat $appPath/setup.py | grep -oi 'CFBundleShortVersionString.: "[a-z0-9]\+' | grep -oi '[a-z0-9]\+$')
echo "ℹ️ 从 $appPath/setup.py 检测到应用版本为 $appVersion"
appConfigPath="$appPath/config.ini.default"
appVersion=$(getAppVersionFromConfig "$appConfigPath")
if [[ $appVersion == 0 ]]; then
isEmpty=1
echo "ℹ️ 本地应用版本: $appVersion"
else
echo "⚠️ 应用源码目录下没有setup.py文件!"
appVersion=0
echo "ℹ️ 从 $appConfigPath 检测到应用版本为 $appVersion"
fi

_url="https://api.github.com/repos/sqzw-x/mdcx/releases/latest"
Expand Down
25 changes: 19 additions & 6 deletions webtop-base/update-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ compareVersion () {
return 0
}

# 从`appPath/config.ini.default`获取应用版本
# [modified_time]
# modified_time = 2023-12-19 23:53:41
# version = 120231219
getAppVersionFromConfig () {
local configPath="$1"
if [[ -f "$configPath" ]]; then
local version=$(cat $configPath | grep -oi 'version\s*=\s*[0-9]\+' | grep -oi '[0-9]\+$')
echo $version
else
echo 0
fi
}

appPath=$(echo "$appPath" | sed 's:/*$::')
isEmpty=0

Expand All @@ -115,14 +129,13 @@ if [[ -n "${appPath}" ]]; then
echo "⚠️ $appPath 不存在,现在创建"
mkdir -p $appPath
else
if [[ -f "$appPath/setup.py" ]]; then
# 'CFBundleShortVersionString': "20230201",
appVersion=$(cat $appPath/setup.py | grep -oi 'CFBundleShortVersionString.: "[a-z0-9]\+' | grep -oi '[a-z0-9]\+$')
echo "ℹ️ 从 $appPath/setup.py 检测到应用版本为 $appVersion"
else
appConfigPath="$appPath/config.ini.default"
appVersion=$(getAppVersionFromConfig "$appConfigPath")
if [[ $appVersion == 0 ]]; then
isEmpty=1
appVersion=0
echo "ℹ️ 本地应用版本: $appVersion"
else
echo "ℹ️ 从 $appConfigPath 检测到应用版本为 $appVersion"
fi
fi
else
Expand Down

0 comments on commit 36d48b1

Please sign in to comment.