diff --git a/conf/app.src b/conf/app.src index a75a2dd..20d22e0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -2,6 +2,6 @@ SOURCE_URL=https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.92-ho SOURCE_SUM=6510a8b588538f4daa7090fdaf462a28eda97608b5181241bc125ba1194b3ed2d9595b767eac2ef693939e016bc41fe153cc086534d233ab0ad5e2bb23203bc2 SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true SOURCE_EXTRACT=true SOURCE_FILENAME=adguard.tar.gz \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..72916a6 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,16 @@ +[Unit] +Description=adguard +After=network.target + +[Service] +WorkingDirectory=__FINALPATH__ +User=admin +Group=users +Type=simple +UMask=000 +ExecStart=__FINALPATH__/AdGuardHome +RestartSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/install b/scripts/install index 3084f1f..860205f 100644 --- a/scripts/install +++ b/scripts/install @@ -95,6 +95,19 @@ ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +ynh_replace_string "__FINALPATH__" "$final_path" "../conf/systemd.service" + +#================================================= +# SETUP SYSTEMD +#================================================= + +ynh_add_systemd_config +systemctl enable $app.service + #============================================== # INSTALL ADGUARD #============================================== @@ -160,3 +173,4 @@ fi # Reload services systemctl reload nginx +systemctl start $app.service