forked from ungleich-public/cdist
		
	Merge pull request #755 from 4nd3r/bsd_stat_fix
fix __(file|directory)/explorer/stat for BSDs
This commit is contained in:
		
				commit
				
					
						b21b6d0a7e
					
				
			
		
					 2 changed files with 7 additions and 25 deletions
				
			
		| 
						 | 
					@ -25,21 +25,13 @@ destination="/$__object_id"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os=$("$__explorer/os")
 | 
					os=$("$__explorer/os")
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   "freebsd"|"netbsd"|"openbsd")
 | 
					   "freebsd"|"netbsd"|"openbsd"|"macosx")
 | 
				
			||||||
      # FIXME: should be something like this based on man page, but can not test
 | 
					      stat -f "type: %HT
 | 
				
			||||||
      stat -f "type: %ST
 | 
					 | 
				
			||||||
owner: %Du %Su
 | 
					owner: %Du %Su
 | 
				
			||||||
group: %Dg %Sg
 | 
					group: %Dg %Sg
 | 
				
			||||||
mode: %Op %Sp
 | 
					mode: %Lp %Sp
 | 
				
			||||||
" "$destination"
 | 
					" "$destination" | awk '/^type/ { print tolower($0); next; } { print; }'
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
    "macosx")
 | 
					 | 
				
			||||||
       stat -f "type: %HT
 | 
					 | 
				
			||||||
 owner: %Du %Su
 | 
					 | 
				
			||||||
 group: %Dg %Sg
 | 
					 | 
				
			||||||
 mode: %Lp %Sp
 | 
					 | 
				
			||||||
 " "$destination"
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
   *)
 | 
					   *)
 | 
				
			||||||
      stat --printf="type: %F
 | 
					      stat --printf="type: %F
 | 
				
			||||||
owner: %u %U
 | 
					owner: %u %U
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,24 +25,14 @@ destination="/$__object_id"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os=$("$__explorer/os")
 | 
					os=$("$__explorer/os")
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   "freebsd"|"netbsd"|"openbsd")
 | 
					   "freebsd"|"netbsd"|"openbsd"|"macosx")
 | 
				
			||||||
      # FIXME: should be something like this based on man page, but can not test
 | 
					      stat -f "type: %HT
 | 
				
			||||||
      stat -f "type: %ST
 | 
					 | 
				
			||||||
owner: %Du %Su
 | 
					 | 
				
			||||||
group: %Dg %Sg
 | 
					 | 
				
			||||||
mode: %Op %Sp
 | 
					 | 
				
			||||||
size: %Dz
 | 
					 | 
				
			||||||
links: %Dl
 | 
					 | 
				
			||||||
" "$destination"
 | 
					 | 
				
			||||||
   ;;
 | 
					 | 
				
			||||||
   "macosx")
 | 
					 | 
				
			||||||
     stat -f "type: %HT
 | 
					 | 
				
			||||||
owner: %Du %Su
 | 
					owner: %Du %Su
 | 
				
			||||||
group: %Dg %Sg
 | 
					group: %Dg %Sg
 | 
				
			||||||
mode: %Lp %Sp
 | 
					mode: %Lp %Sp
 | 
				
			||||||
size: %Dz
 | 
					size: %Dz
 | 
				
			||||||
links: %Dl
 | 
					links: %Dl
 | 
				
			||||||
" "$destination"
 | 
					" "$destination" | awk '/^type/ { print tolower($0); next; } { print; }'
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
   *)
 | 
					   *)
 | 
				
			||||||
      stat --printf="type: %F
 | 
					      stat --printf="type: %F
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue