Files
MIXBOX-ARCHIVE/apps/entware/scripts/functions.sh
2020-03-05 00:08:40 +08:00

34 lines
856 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
auto_start_enable() {
[ -z "$1" ] && return 1
mbdb set entware.app."$1" "1"
}
auto_start_disable() {
[ -z "$1" ] && return 1
mbdb del entware.app."$1"
}
detect_entware() {
result1=$(mbdb show entware)
result2=$(ls /opt | grep etc)
if [ -z "$result1" ] || [ -z "$result2" ]; then
logsh "$service" "检测到【Entware】服务未启动或未安装"
return 1
else
result3=$(echo $PATH | grep opt)
[ -z "$result3" ] && export PATH=/opt/bin:/opt/sbin:$PATH
fi
return 0
}
install_entware_app() {
for i in $@; do
result=$(/opt/bin/opkg list-installed | grep -c "^$i")
if [ "$result" == '0' ]; then
/opt/bin/opkg install $i
[ $? -ne 0 ] && logsh "$service" "程序$i安装失败" && return 1
fi
done
return 0
}