From 4802b254bf137cf5980c24486745a5c62fe1a570 Mon Sep 17 00:00:00 2001 From: Gofannon Date: Thu, 18 Aug 2022 23:59:19 +0200 Subject: [PATCH] fix copied files being owned by root and not app user --- scripts/install | 10 +++++----- scripts/upgrade | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index b00cf76..4b469df 100755 --- a/scripts/install +++ b/scripts/install @@ -141,20 +141,20 @@ ynh_add_config --template="../conf/acl.auth.php" --destination="$final_path/conf # Other files will be read ony and owned by root. # See https://www.dokuwiki.org/install:permissions -cp $final_path/conf/local.php.dist $final_path/conf/local.php.bak -cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php +cp --archive $final_path/conf/local.php.dist $final_path/conf/local.php.bak +cp --archive $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php # This file might be used by plugins like https://www.dokuwiki.org/plugin:siteexport # Create it to be more "user friendly" as over the top security is not the main goal here # This file could be use for bad behaviour. # See https://www.dokuwiki.org/devel:preload?s[]=preload -cp $final_path/inc/preload.php.dist $final_path/inc/preload.php +cp --archive $final_path/inc/preload.php.dist $final_path/inc/preload.php # There is no template .dist provided inside DokuWiki installation folder # Create "empty" files to be able to manage linux permissions # Files content is taken from an existing DokuWiki installation -cp ../conf/plugins.local.php $final_path/conf -cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak +cp --archive ../conf/plugins.local.php $final_path/conf +cp --archive ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE diff --git a/scripts/upgrade b/scripts/upgrade index 99c5ed2..8e7d452 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,22 +143,22 @@ if [ ! -f "$final_path/conf/local.php.bak" ]; then # if template exists if [ -f "$final_path/conf/local.php.dist" ]; then # Copy template to create default file - cp "$final_path/conf/local.php.dist" "$final_path/conf/local.php.bak" + cp --archive "$final_path/conf/local.php.dist" "$final_path/conf/local.php.bak" fi fi if [ ! -f "$final_path/conf/users.auth.php" ]; then if [ -f "$final_path/conf/users.auth.php.dist" ]; then - cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php + cp --archive $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php fi fi if [ ! -f "$final_path/conf/plugins.local.php" ]; then - cp ../conf/plugins.local.php $final_path/conf + cp --archive ../conf/plugins.local.php $final_path/conf fi if [ ! -f "$final_path/conf/plugins.local.php.bak" ]; then - cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak + cp --archive ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak fi @@ -166,7 +166,7 @@ if [ ! -f "$final_path/inc/preload.php" ]; then # if template exists if [ -f "$final_path/inc/preload.php.dist" ]; then # Copy template to create default file - cp "$final_path/inc/preload.php.dist" "$final_path/inc/preload.php" + cp --archive "$final_path/inc/preload.php.dist" "$final_path/inc/preload.php" fi fi @@ -315,7 +315,7 @@ fi ynh_backup_if_checksum_is_different --file="$final_path/conf/local.protected.php" # Always overwrite local file with the one from package. -cp ../conf/local.protected.php $final_path/conf +cp --archive ../conf/local.protected.php $final_path/conf # Customize admin group in case of multiple wiki install managed by different admins # dokuwiki.admin; dokuwiki__1.admin; etc