|
@@ -7,7 +7,6 @@ STOP=01
|
|
|
|
|
|
CONFIGURATION=AdGuardHome
|
|
|
|
|
|
-
|
|
|
set_forward_dnsmasq()
|
|
|
{
|
|
|
local PORT="$1"
|
|
@@ -255,20 +254,21 @@ config_editor()
|
|
|
start_service() {
|
|
|
# Reading config
|
|
|
config_load "${CONFIGURATION}"
|
|
|
+ config_get hashpass $CONFIGURATION hashpass ""
|
|
|
+ if [ ! -z "$hashpass" ]; then
|
|
|
+ config_editor "users.password" "$hashpass" "$configpath"
|
|
|
+ uci set $CONFIGURATION.$CONFIGURATION.hashpass=""
|
|
|
+ fi
|
|
|
local enabled
|
|
|
+ config_get_bool enabled $CONFIGURATION enabled 0
|
|
|
+
|
|
|
+ if [ "$enabled" == "1" ]; then
|
|
|
local ADDITIONAL_ARGS=""
|
|
|
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
|
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome/AdGuardHome"
|
|
|
mkdir -p ${binpath%/*}
|
|
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -c $configpath"
|
|
|
|
|
|
- config_get hashpass $CONFIGURATION hashpass ""
|
|
|
- if [ ! -z "$hashpass" ]; then
|
|
|
- config_editor "users.password" "$hashpass" "$configpath"
|
|
|
- uci set $CONFIGURATION.$CONFIGURATION.hashpass=""
|
|
|
- fi
|
|
|
-
|
|
|
- config_get_bool enabled $CONFIGURATION enabled 0
|
|
|
config_get httpport $CONFIGURATION httpport 3000
|
|
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -p $httpport"
|
|
|
|
|
@@ -276,7 +276,6 @@ start_service() {
|
|
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -w $workdir"
|
|
|
mkdir -p $workdir/data
|
|
|
|
|
|
-
|
|
|
config_get logfile $CONFIGURATION logfile ""
|
|
|
if [ ! -z "$logfile" ]; then
|
|
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -l $logfile"
|
|
@@ -288,8 +287,6 @@ start_service() {
|
|
|
sh /usr/share/AdGuardHome/update_core.sh >/tmp/AdGuardHome_update.log
|
|
|
rm /var/run/update_core
|
|
|
exit 0
|
|
|
- elif [ ! -f "$configpath" ]; then
|
|
|
- do_redirect 0
|
|
|
fi
|
|
|
|
|
|
config_get_bool verbose $CONFIGURATION verbose 0
|
|
@@ -314,24 +311,26 @@ start_service() {
|
|
|
ln -s /tmp/sessions.db $workdir/data/sessions.db
|
|
|
fi
|
|
|
fi
|
|
|
- if [ "$enabled" == "1" ]; then
|
|
|
- procd_open_instance
|
|
|
- procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
|
|
- procd_set_param limits core="unlimited"
|
|
|
- procd_set_param stderr 1
|
|
|
- # pass config to script on start
|
|
|
- procd_set_param command $binpath $ADDITIONAL_ARGS
|
|
|
- procd_close_instance
|
|
|
- if [ -f "$configpath" ]; then
|
|
|
- do_redirect 1
|
|
|
- fi
|
|
|
- echo "AdGuardHome turn on"
|
|
|
- echo "enabled=$enabled"
|
|
|
+ procd_open_instance
|
|
|
+ procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
|
|
+ procd_set_param limits core="unlimited"
|
|
|
+ procd_set_param stderr 1
|
|
|
+ # pass config to script on start
|
|
|
+ procd_set_param command $binpath $ADDITIONAL_ARGS
|
|
|
+ procd_close_instance
|
|
|
+ if [ -f "$configpath" ]; then
|
|
|
+ do_redirect 1
|
|
|
+ else
|
|
|
+ do_redirect 0
|
|
|
+ fi
|
|
|
+ echo "AdGuardHome turn on"
|
|
|
+ echo "enabled=$enabled"
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
stop_service()
|
|
|
{
|
|
|
+ config_load "${CONFIGURATION}"
|
|
|
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
|
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome/AdGuardHome"
|
|
|
do_redirect 0
|