diff --git a/scripts/install b/scripts/install index 8c717e2..d85f2ee 100755 --- a/scripts/install +++ b/scripts/install @@ -26,7 +26,7 @@ source /usr/share/yunohost/helpers # ... # -# $app is the app id (i.e. 'example' for first install, +# $app is the app id (i.e. 'example' for first install, # or 'example__2', '__3', ... for multi-instance installs) # @@ -44,7 +44,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from manifest.toml ynh_setup_source --dest_dir="$install_dir" -# $install_dir will automatically be initialized with some decent +# $install_dir will automatically be initialized with some decent # permission by default ... however, you may need to recursively reapply # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" @@ -96,6 +96,12 @@ ynh_add_systemd_config yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +# Create the log file (required for fail2ban) +mkdir -p "/var/log/$app" +touch "/var/log/$app/$app.log" +chown -R "$app:$app" "/var/log/$app" +chmod -R u=rwX,g=rX,o= "/var/log/$app" + ### Additional options starting with 3.8: ### ### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed diff --git a/scripts/restore b/scripts/restore index e60cb7a..97c290c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,7 +17,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -# $install_dir will automatically be initialized with some decent +# $install_dir will automatically be initialized with some decent # permissions by default ... however, you may need to recursively reapply # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" @@ -57,6 +57,12 @@ systemctl enable $app.service --quiet yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +# Create the log file (required for fail2ban) +mkdir -p "/var/log/$app" +touch "/var/log/$app/$app.log" +chown -R "$app:$app" "/var/log/$app" +chmod -R u=rwX,g=rX,o= "/var/log/$app" + ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"