From 41d5a04184d9bec6133541356e14e78e36a78a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 30 May 2016 22:55:26 +0200 Subject: [PATCH] [fix] Call xargs with sudo for chmod instead of the reverse It allows to prevent the number of arguments and environment variables passed to chmod - which often fails with the error: "Argument list too long". See: http://unix.stackexchange.com/a/72822 --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index b7ad447..d0eb5db 100755 --- a/scripts/install +++ b/scripts/install @@ -49,8 +49,8 @@ sudo cp ../conf/dokuwiki.php $final_path/conf sudo cp ../conf/acl.auth.php $final_path/conf # Files owned by root, www-data can just read -sudo find $final_path -type f | xargs sudo chmod 0644 -sudo find $final_path -type d | xargs sudo chmod 0755 +sudo find $final_path -type f -print0 | sudo xargs -0 chmod 0644 +sudo find $final_path -type d -print0 | sudo xargs -0 chmod 0755 sudo chown -R root: $final_path # except for conf, data, some data subfolders, and lib/plugin, where www-data must have write permissions diff --git a/scripts/upgrade b/scripts/upgrade index 4436143..5150b98 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,8 +53,8 @@ sudo touch $final_path/doku.php grep -Ev '^($|#)' ../sources/data/deleted.files | xargs -I {} sudo rm -vrf $final_path/{} # Files owned by root, www-data can just read -sudo find $final_path -type f | xargs sudo chmod 0644 -sudo find $final_path -type d | xargs sudo chmod 755 +sudo find $final_path -type f -print0 | sudo xargs -0 chmod 0644 +sudo find $final_path -type d -print0 | sudo xargs -0 chmod 0755 sudo chown -R root: $final_path # except for conf, data, some data subfolders, and lib/plugin, where www-data must have write permissions