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:
parent
2e99f5f77d
commit
20b5c886b1
8 changed files with 38 additions and 12 deletions
|
@ -23,7 +23,7 @@
|
||||||
"lost_password_link": "",
|
"lost_password_link": "",
|
||||||
"localstorage.allowsymlinks": true,
|
"localstorage.allowsymlinks": true,
|
||||||
"simpleSignUpLink.shown": false,
|
"simpleSignUpLink.shown": false,
|
||||||
"forbidden_chars": ["?", "<", ">", ":", "*", "|", "\"", "\0", "\n", "\r"],
|
"skeletondirectory": "/home/yunohost.app/__APP__/skeleton/{lang}",
|
||||||
"mail_smtpmode": "smtp",
|
"mail_smtpmode": "smtp",
|
||||||
"mail_smtpport": "25",
|
"mail_smtpport": "25",
|
||||||
"mail_smtpauth": 1,
|
"mail_smtpauth": 1,
|
||||||
|
|
|
@ -13,7 +13,7 @@ services = ["php8.2-fpm"]
|
||||||
bind = ":__INSTALL_DIR__/config/config.php"
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
|
||||||
[main.mode.has_internet_connection]
|
[main.mode.has_internet_connection]
|
||||||
ask = "Enable closed network mode"
|
ask = "Internet connection available"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
bind = ":__INSTALL_DIR__/config/config.php"
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
help = "Is Nextcloud connected to the Internet or running in a closed network?"
|
help = "Is Nextcloud connected to the Internet or running in a closed network?"
|
||||||
|
@ -51,6 +51,11 @@ services = ["php8.2-fpm"]
|
||||||
[main.files]
|
[main.files]
|
||||||
name = "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]
|
[main.files.trashbin_retention_obligation]
|
||||||
ask = "Trashbin retention"
|
ask = "Trashbin retention"
|
||||||
type = "string"
|
type = "string"
|
||||||
|
|
|
@ -61,7 +61,7 @@ ram.runtime = "512M"
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
subdirs = ["data"]
|
subdirs = ["data", "skeleton"]
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
@ -77,4 +77,4 @@ ram.runtime = "512M"
|
||||||
|
|
||||||
[resources.database]
|
[resources.database]
|
||||||
type = "mysql"
|
type = "mysql"
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
ynh_backup --src_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
|
|
@ -69,7 +69,7 @@ set__auto_upgrade_apps() {
|
||||||
declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" )
|
declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" )
|
||||||
if [ "$frequencies[$auto_upgrade_apps]" ]
|
if [ "$frequencies[$auto_upgrade_apps]" ]
|
||||||
then
|
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
|
else
|
||||||
ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps
|
ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -151,6 +151,7 @@ ynh_secure_remove --file="$nc_conf"
|
||||||
nc_conf="$install_dir/config.json"
|
nc_conf="$install_dir/config.json"
|
||||||
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
|
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
|
||||||
|
|
||||||
|
cat $nc_conf
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
|
|
||||||
# Then remove the config file
|
# Then remove the config file
|
||||||
|
@ -171,13 +172,22 @@ exec_occ ldap:test-config '' \
|
||||||
# Define a function to add an external storage
|
# Define a function to add an external storage
|
||||||
# Create the external storage for the given folders and enable sharing
|
# Create the external storage for the given folders and enable sharing
|
||||||
create_external_storage() {
|
create_external_storage() {
|
||||||
local datadir="$1"
|
local mount_dir="$1"
|
||||||
local mount_name="$2"
|
local mount_name="$2"
|
||||||
|
local group="${3:-}"
|
||||||
local mount_id=`exec_occ files_external:create --output=json \
|
local mount_id=`exec_occ files_external:create --output=json \
|
||||||
"$mount_name" 'local' 'null::null' -c "datadir=$data_dir/data" || true`
|
"$mount_name" 'local' 'null::null' -c "datadir=$mount_dir" || true`
|
||||||
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
if ! [[ $mount_id =~ ^[0-9]+$ ]]
|
||||||
&& ynh_print_warn --message="Unable to create external storage" \
|
then
|
||||||
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
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
|
# 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
|
# Allow nextcloud to write into these directories
|
||||||
ynh_multimedia_addaccess $app
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -272,8 +290,8 @@ chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app: "$data_dir"
|
chown -R $app: "$data_dir"
|
||||||
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
find $data_dir/ -type f -print0 | xargs -r0 chmod 0640
|
||||||
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
find $data_dir/ -type d -print0 | xargs -r0 chmod 0750
|
||||||
chmod 640 "$install_dir/config/config.php"
|
chmod 640 "$install_dir/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
chmod 750 $install_dir
|
chmod 750 $install_dir
|
||||||
|
|
|
@ -31,6 +31,7 @@ ynh_remove_fail2ban_config
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
# TODO: Ensure that cron job is not running (How !?)
|
# 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"
|
||||||
|
ynh_secure_remove --file="/etc/cron.d/${app}_upgrade_apps"
|
||||||
|
|
||||||
# Cleaning ACL in home directories
|
# Cleaning ACL in home directories
|
||||||
for i in $(ls /home); do
|
for i in $(ls /home); do
|
||||||
|
|
|
@ -58,6 +58,7 @@ fi
|
||||||
ynh_script_progression --message="Restoring cron job..." --weight=1
|
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"
|
||||||
|
ynh_restore_file --origin_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE LOGROTATE CONFIGURATION
|
# BACKUP THE LOGROTATE CONFIGURATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue