From 3d56417a69c78fd0f66ce09d168c87b70524633b Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 3 Jul 2016 10:52:20 +0200 Subject: [PATCH 1/3] Allow multiple disk selection in NewPerms utility --- plugins/dynamix/NewPerms.page | 46 ++++++++++++++++++++++---------- plugins/dynamix/scripts/newperms | 38 +++++++++++++------------- 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/plugins/dynamix/NewPerms.page b/plugins/dynamix/NewPerms.page index 58d5d7f8a..41bc21056 100644 --- a/plugins/dynamix/NewPerms.page +++ b/plugins/dynamix/NewPerms.page @@ -13,9 +13,26 @@ Title="New Permissions" * all copies or substantial portions of the Software. */ ?> - + This is a one-time action to be taken after upgrading from a pre-5.0 unRAID server release to version 5.0. It is also useful for restoring default ownership/permissions on files and directories when transitioning back from Active Directory to non-Active Directory integration. @@ -33,26 +50,27 @@ For read/write files: For readonly files: -r--r--r-- ~~~ -Clicking Start will open another window and start the background process. Closing the window before -completion will terminate the background process - so don't do that. This process can take a long time if you have many files. +Clicking **Start** will open another window and start the background process. -
- + - + - + - +   + - Array must be STARTED to change permissions. +Array must be STARTED to change permissions. - -Yes I want to do this +Yes I want to do this
diff --git a/plugins/dynamix/scripts/newperms b/plugins/dynamix/scripts/newperms index 37a7f34df..d6602f58c 100755 --- a/plugins/dynamix/scripts/newperms +++ b/plugins/dynamix/scripts/newperms @@ -17,34 +17,34 @@ # ugo+X Set the 'x' bit for directories in user, group, and other function process { - echo "$1" - if [ -d "$1" ] ; then - owner=nobody - group=users - if [ $# -ge 2 ]; then - owner=$2 + list="$1" + [[ $# -ge 2 ]] && owner=$2 || owner=nobody + [[ $# -ge 3 ]] && group=$3 || group=users + ifs=$IFS; IFS='|' + for dir in $list; do + echo "$dir" + if [[ -d $dir ]]; then + echo processing "$dir" + echo ... chmod -R u-x,go-rwx,go+u,ugo+X "$dir" + chmod -R u-x,go-rwx,go+u,ugo+X "$dir" + echo ... chown -R $owner:$group "$dir" + chown -R $owner:$group "$dir" + echo ... sync + sync fi - if [ $# -ge 3 ]; then - group=$3 - fi - echo processing "$1" - echo ... chmod -R u-x,go-rwx,go+u,ugo+X "$1" - chmod -R u-x,go-rwx,go+u,ugo+X "$1" - echo ... chown -R $owner:$group "$1" - chown -R $owner:$group "$1" - echo ... sync - sync - fi + done + IFS=$ifs } -if [ -n "$1" ] ; then +if [[ $# -ge 1 ]]; then process "$@" else process /mnt/cache - for disk in /mnt/disk* ; do + for disk in /mnt/disk[0-9]*; do process $disk done fi +echo secs=$SECONDS printf "completed, elapsed time: %.2d:%.2d:%.2d\n" $(($secs/3600)) $(($secs%3600/60)) $(($secs%60)) From 25a81d49af22d7c9cd70c331a65e4141dcd2a30e Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 3 Jul 2016 11:02:35 +0200 Subject: [PATCH 2/3] Allow multiple disk selection in NewPerms utility [2] --- plugins/dynamix/scripts/newperms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix/scripts/newperms b/plugins/dynamix/scripts/newperms index d6602f58c..d0110f722 100755 --- a/plugins/dynamix/scripts/newperms +++ b/plugins/dynamix/scripts/newperms @@ -36,7 +36,7 @@ function process { IFS=$ifs } -if [[ $# -ge 1 ]]; then +if [[ -n $1 ]]; then process "$@" else process /mnt/cache From 33e4c6ae58e078d54d164816096108a481768668 Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 3 Jul 2016 19:02:17 +0200 Subject: [PATCH 3/3] Make symbol replacement case insensitive --- plugins/dynamix/include/SystemInformation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix/include/SystemInformation.php b/plugins/dynamix/include/SystemInformation.php index e8bb22299..dab6c6442 100644 --- a/plugins/dynamix/include/SystemInformation.php +++ b/plugins/dynamix/include/SystemInformation.php @@ -53,7 +53,7 @@ function write($number) { return $number<=count($words) ? $words[$number] : $number; } $cpu = explode('#',exec("dmidecode -q -t 4|awk -F: '/^\tVersion:/{v=$2;}; /^\tCurrent Speed:/{s=$2;} END{print v\"#\"s}'")); -$cpumodel = str_replace(array("Processor","(C)","(R)","(TM)"),array("","©","®","™"),$cpu[0]); +$cpumodel = str_ireplace(array("Processor","(C)","(R)","(TM)"),array("","©","®","™"),$cpu[0]); if (strpos($cpumodel,'@')===false) { $cpuspeed = explode(' ',$cpu[1]); if ($cpuspeed[0]>=1000 && $cpuspeed[1]=='MHz') {