1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
This commit is contained in:
ericgaspar 2021-07-06 18:12:32 +02:00
parent f2926694de
commit 4fa7a1a9f3
7 changed files with 5 additions and 65 deletions

View file

@ -4,7 +4,7 @@
path="/" path="/"
is_public=1 is_public=1
password="password-srtong" password="password-srtong"
admin="domain.tld" admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1

View file

@ -10,7 +10,6 @@ StartLimitBurst=10
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
ExecStart=__FINALPATH__/AdGuardHome -c __FINALPATH__/AdGuardHome.yaml -p __PORT__ ExecStart=__FINALPATH__/AdGuardHome -c __FINALPATH__/AdGuardHome.yaml -p __PORT__
WorkingDirectory=/etc/AdGuardHome
#Restart=always #Restart=always
#RestartSec=120 #RestartSec=120
#EnvironmentFile=-/etc/sysconfig/dnscrypt-proxy #EnvironmentFile=-/etc/sysconfig/dnscrypt-proxy

View file

@ -1,6 +1,6 @@
{ {
"name": "AdGuard Home", "name": "AdGuard Home",
"id": "adguard", "id": "adguardhome",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "AdGuard Home package for YunoHost.", "en": "AdGuard Home package for YunoHost.",
@ -18,8 +18,7 @@
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx"
"mysql"
], ],
"arguments": { "arguments": {
"install": [{ "install": [{

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="libcap2-bin libaprutil1" pkg_dependencies=""
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -54,17 +54,10 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=9
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --time --weight=1 ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port # Find an available port
port=$(ynh_find_port --port=3000) port=$(ynh_find_port --port=3000)

View file

@ -41,14 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#ynh_script_progression --message="Removing dependencies..." --time --weight=1
# Remove metapackage and its dependencies
#ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================

View file

@ -27,12 +27,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
@ -63,27 +57,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi
# If final_path doesn't exist, create it
#if [ -z "$final_path" ]; then
# final_path=/var/www/$app
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#fi
### If nobody installed your app before 4.1,
### then you may safely remove these lines
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -91,16 +64,6 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -121,12 +84,6 @@ then
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
# such that the appropriate users (e.g. maybe www-data) can access
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"