1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

[fix] config during install + skeleton dir

This commit is contained in:
ljf 2023-12-11 03:44:46 +01:00
parent 2e99f5f77d
commit 20b5c886b1
No known key found for this signature in database
8 changed files with 38 additions and 12 deletions

View file

@ -23,7 +23,7 @@
"lost_password_link": "",
"localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false,
"forbidden_chars": ["?", "<", ">", ":", "*", "|", "\"", "\0", "\n", "\r"],
"skeletondirectory": "/home/yunohost.app/__APP__/skeleton/{lang}",
"mail_smtpmode": "smtp",
"mail_smtpport": "25",
"mail_smtpauth": 1,

View file

@ -13,7 +13,7 @@ services = ["php8.2-fpm"]
bind = ":__INSTALL_DIR__/config/config.php"
[main.mode.has_internet_connection]
ask = "Enable closed network mode"
ask = "Internet connection available"
type = "boolean"
bind = ":__INSTALL_DIR__/config/config.php"
help = "Is Nextcloud connected to the Internet or running in a closed network?"
@ -51,6 +51,11 @@ services = ["php8.2-fpm"]
[main.files]
name = "Files"
[main.files.skeleton]
ask = "To configure the default files created for new users, you can do it by logging on nextcloud with an admins account and edit files under `New user default files/default` or if you want to target a specific language `New user default files/FR`."
type = "alert"
style = "info"
[main.files.trashbin_retention_obligation]
ask = "Trashbin retention"
type = "string"

View file

@ -61,7 +61,7 @@ ram.runtime = "512M"
[resources.install_dir]
[resources.data_dir]
subdirs = ["data"]
subdirs = ["data", "skeleton"]
[resources.permissions]
main.url = "/"
@ -77,4 +77,4 @@ ram.runtime = "512M"
[resources.database]
type = "mysql"

View file

@ -59,6 +59,7 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup --src_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -69,7 +69,7 @@ set__auto_upgrade_apps() {
declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" )
if [ "$frequencies[$auto_upgrade_apps]" ]
then
echo "${frequencies[$auto_upgrade_apps]} $app /usr/bin/php$phpversion --define apc.enable_cli=1 -f $install_dir/occ app:update --all" > /etc/cron.d/nextcloud_upgrade_apps
echo "${frequencies[$auto_upgrade_apps]} $app /usr/bin/php$phpversion --define apc.enable_cli=1 -f $install_dir/occ app:update --all" > /etc/cron.d/${app}_upgrade_apps
else
ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps
fi

View file

@ -151,6 +151,7 @@ ynh_secure_remove --file="$nc_conf"
nc_conf="$install_dir/config.json"
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
cat $nc_conf
exec_occ config:import "$nc_conf"
# Then remove the config file
@ -171,13 +172,22 @@ exec_occ ldap:test-config '' \
# Define a function to add an external storage
# Create the external storage for the given folders and enable sharing
create_external_storage() {
local datadir="$1"
local mount_dir="$1"
local mount_name="$2"
local group="${3:-}"
local mount_id=`exec_occ files_external:create --output=json \
"$mount_name" 'local' 'null::null' -c "datadir=$data_dir/data" || true`
! [[ $mount_id =~ ^[0-9]+$ ]] \
&& ynh_print_warn --message="Unable to create external storage" \
|| exec_occ files_external:option "$mount_id" enable_sharing true
"$mount_name" 'local' 'null::null' -c "datadir=$mount_dir" || true`
if ! [[ $mount_id =~ ^[0-9]+$ ]]
then
ynh_print_warn --message="Unable to create external storage"
else
exec_occ files_external:option "$mount_id" enable_sharing true
if [ "$group" != "" ]
then
exec_occ group:list
exec_occ files_external:applicable "$mount_id" --add-group="$group"
fi
fi
}
# Enable External Storage and create local mount to home folder
@ -261,6 +271,14 @@ create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia"
# Allow nextcloud to write into these directories
ynh_multimedia_addaccess $app
#=================================================
# EASY SKELETON CONFIGURATION
#================================================
ynh_script_progression --message="Easying skeleton configuration..." --weight=1
cp -a --no-target-directory $install_dir/core/skeleton "/home/yunohost.app/$app/skeleton/default"
create_external_storage "/home/yunohost.app/$app/skeleton" "New users default files" "admins"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -272,8 +290,8 @@ chown -R $app:www-data "$install_dir"
chown -R $app: "$data_dir"
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
find $data_dir/ -type f -print0 | xargs -r0 chmod 0640
find $data_dir/ -type d -print0 | xargs -r0 chmod 0750
chmod 640 "$install_dir/config/config.php"
chmod 755 /home/yunohost.app
chmod 750 $install_dir

View file

@ -31,6 +31,7 @@ ynh_remove_fail2ban_config
# Remove a cron file
# TODO: Ensure that cron job is not running (How !?)
ynh_secure_remove --file="/etc/cron.d/$app"
ynh_secure_remove --file="/etc/cron.d/${app}_upgrade_apps"
# Cleaning ACL in home directories
for i in $(ls /home); do

View file

@ -58,6 +58,7 @@ fi
ynh_script_progression --message="Restoring cron job..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
ynh_restore_file --origin_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
#=================================================
# BACKUP THE LOGROTATE CONFIGURATION