改善插件配置文件,优化applist

This commit is contained in:
monlor
2020-03-05 21:17:07 +08:00
parent 17dc8e6ad9
commit 85941c82c6
5 changed files with 45 additions and 26 deletions

View File

@@ -67,9 +67,24 @@ get_applist() {
}
update_applist() {
wgetsh ${mbtmp}/applist_tmp.txt $mburl/applist.txt
if [ $? -eq 0 ]; then
cat ${mbtmp}/applist_tmp.txt | grep "${model}" | sort -u > ${mbtmp}/applist.txt
rm -rf ${mbtmp}/applist.txt
cat ${mbtmp}/applist_tmp.txt | grep "${model}" | sort -u | while read line; do
local install_text=""
local update_text=""
local appname=""
local version=""
appname="$(echo -n "$line" | cut -d'|' -f1)"
version="$(echo -n "$line" | cut -d '|' -f4)"
if ls ${mbroot}/apps/${appname} &> /dev/null; then
[ "$(mbdb get ${appname}.main.version)" != "${version}" ] && update_text="有更新"
else
install_text="未安装"
fi
echo "${line}|${install_text}|${update_text}" >> ${mbtmp}/applist.txt
done
fi
rm -rf ${mbtmp}/applist_tmp.txt
}

View File

@@ -335,9 +335,18 @@ select_app() {
read -p "是否要更新${appname}插件?[1/0] " update
[ "$update" == '1' ] && ${mbroot}/scripts/appmanage.sh upgrade ${appname}
fi
source "${mbroot}"/apps/${appname}/config/mixbox.conf
${appname}
# todo 配置方式修改
if [ -f ${mbroot}/apps/${appname}/config.sh ]; then
${mbroot}/apps/${appname}/config.sh
if [ $? -eq 0 ]; then
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
else
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
fi
else
source "${mbroot}"/apps/${appname}/config/mixbox.conf
${appname}
fi
${mbroot}/apps/${appname}/scripts/${appname}.sh status
fi
else