Skip to content

Commit

Permalink
fix sh function problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rufengsuixing committed Nov 23, 2019
1 parent 4bde722 commit 2e53345
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
- 可以管理网页端口
- luci更新核心版本
- dns重定向
- 自定义bin path(支持tmp)
- 自定义bin path(支持tmp,每次重启时下载bin
- 自定义config path
- 自定义work path
- 自定义log path
#### 已知问题:
- 潘多拉固件老旧,不支持shell 的 function,如要使用请安装后手动修改update_core.sh合并函数
- db数据库不支持放在比较特别的文件系统上比如 overlay data-stk-oo,请修改workdir,如果检测到overlay会自动重定向到tmp,将会导致重启丢失dns数据库
- db数据库不支持放在比较特别的文件系统上比如 overlay data-stk-oo,请修改workdir,本软件如果检测到overlay会自动重定向到tmp,将会导致重启丢失dns数据库
10 changes: 5 additions & 5 deletions root/usr/share/AdGuardHome/update_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ configpath="/etc/AdGuardHome.yaml"
fi
mkdir -p ${configpath%/*}

function check_if_already_running(){
check_if_already_running(){
running_tasks="$(ps |grep "AdGuardHome" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
[ "${running_tasks}" -gt "2" ] && echo -e "\nA task is already running." >>/tmp/AdGuardHome_update.log && rm /var/run/update_core && exit 2
}

function clean_log(){
clean_log(){
echo "" > /tmp/AdGuardHome_update.log
}

function check_latest_version(){
check_latest_version(){
latest_ver="$(wget -O- https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
[ -z "${latest_ver}" ] && echo -e "\nFailed to check latest version, please try again later." >>/tmp/AdGuardHome_update.log && exit 1
if [ -f "$configpath" ]; then
Expand All @@ -44,7 +44,7 @@ function check_latest_version(){
fi
}

function doupdate_core(){
doupdate_core(){
echo -e "Updating core..." >>/tmp/AdGuardHome_update.log
mkdir -p "/tmp/AdGuardHome/update" >/dev/null 2>&1
rm -rf /tmp/AdGuardHome/update/* >/dev/null 2>&1
Expand Down Expand Up @@ -119,7 +119,7 @@ function doupdate_core(){
rm /var/run/update_core
}

function main(){
main(){
check_if_already_running
check_latest_version
}
Expand Down

0 comments on commit 2e53345

Please sign in to comment.