mirror of
https://github.com/unraid/webgui.git
synced 2026-01-13 21:20:01 -06:00
Merge pull request #51 from bergware/master
Allow multiple disk selection in NewPerms utility
This commit is contained in:
@@ -13,9 +13,26 @@ Title="New Permissions"
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<style>
|
||||
select.list{min-width:auto;padding:2px 6px;}
|
||||
</style>
|
||||
<script>
|
||||
function setNewPerms(form) {
|
||||
var disks = '';
|
||||
var all = form.includeDisk.options[0].selected;
|
||||
for (var i=1,item; item=form.includeDisk.options[i]; i++) {
|
||||
if (item.selected) {
|
||||
if (disks.length) disks += '|';
|
||||
if (!all) disks += item.value;
|
||||
item.selected = false;
|
||||
}
|
||||
}
|
||||
if (all||disks) openBox('/webGui/scripts/newperms&arg1='+disks,'New Permissions',490,430);
|
||||
}
|
||||
$(function() {
|
||||
$('#s1').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
|
||||
<?if ($var['fsState']!="Started"):?>
|
||||
$('#s1').dropdownchecklist('disable');
|
||||
<?endif;?>
|
||||
});
|
||||
</script>
|
||||
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.
|
||||
|
||||
<form method="POST" action="/update.htm" target="progressFrame">
|
||||
<select id="includeDisk" size="1" class="list">
|
||||
<option value=''>(All)</option>
|
||||
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.
|
||||
|
||||
<form method="POST" action="/update.htm" target="progressFrame" onsubmit="setNewPerms(this);return false">
|
||||
<select id="s1" name="includeDisk" size="1" multiple="multiple" style="display:none">
|
||||
<option value=''>All</option>
|
||||
<?if (isset($disks['cache'])):?>
|
||||
<option value='/mnt/cache'>Cache</option>
|
||||
<option value='/mnt/cache' selected>Cache</option>
|
||||
<?endif;?>
|
||||
<?foreach ($disks as $disk):?>
|
||||
<?if ($disk['type']=='Data'):?>
|
||||
<?=mk_option("","/mnt/{$disk['name']}",my_disk($disk['name']))?>
|
||||
<?=mk_option(0,"/mnt/{$disk['name']}",my_disk($disk['name']))?>
|
||||
<?endif;?>
|
||||
<?endforeach;?>
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<input type="submit" name="start" value="Start" disabled><input type="button" value=" Done " onclick="done()">
|
||||
<?if ($var['fsState']!="Started"):?>
|
||||
<input type="button" value="Start" disabled><input type="button" value="Done" onclick="done()"> Array must be <strong>STARTED</strong> to change permissions.
|
||||
Array must be <strong>STARTED</strong> to change permissions.
|
||||
<?else:?>
|
||||
<input type="button" name="submit_button" value="Start" onclick="openBox('/webGui/scripts/newperms&arg1='+document.getElementById('includeDisk').value,'New Permissions',490,430)" disabled><input type="button" value="Done" onclick="done()">
|
||||
<input type="checkbox" onClick="submit_button.disabled=!this.checked"><small>Yes I want to do this</small>
|
||||
<input type="checkbox" onClick="start.disabled=!this.checked"><small>Yes I want to do this</small>
|
||||
<?endif;?>
|
||||
</form>
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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 [[ -n $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))
|
||||
|
||||
Reference in New Issue
Block a user