mirror of
				https://github.com/dockur/windows.git
				synced 2025-11-04 06:15:27 +00:00 
			
		
		
		
	feat: Check if shared folder is writeable
This commit is contained in:
		
							parent
							
								
									122d1ff98e
								
							
						
					
					
						commit
						8ca0b8e0e2
					
				
							
								
								
									
										13
									
								
								src/samba.sh
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/samba.sh
									
									
									
									
									
								
							@ -46,16 +46,23 @@ addShare() {
 | 
				
			|||||||
  local cfg="$5"
 | 
					  local cfg="$5"
 | 
				
			||||||
  local owner=""
 | 
					  local owner=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ! mkdir -p "$dir"; then
 | 
					  if [ ! -d "$dir" ]; then
 | 
				
			||||||
    error "Failed to create directory $dir." && return 1
 | 
					    if ! mkdir -p "$dir"; then
 | 
				
			||||||
 | 
					      error "Failed to create shared folder ($dir)." && return 1
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ! ls -A "$dir" >/dev/null 2>&1; then
 | 
					  if ! ls -A "$dir" >/dev/null 2>&1; then
 | 
				
			||||||
    msg="Failed to access directory $dir."
 | 
					    msg="No permission to access shared folder ($dir)."
 | 
				
			||||||
    msg+=" If SELinux is active, you need to add the \":Z\" flag to the bind mount."
 | 
					    msg+=" If SELinux is active, you need to add the \":Z\" flag to the bind mount."
 | 
				
			||||||
    error "$msg" && return 1
 | 
					    error "$msg" && return 1
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if [ ! -w "$dir" ]; then
 | 
				
			||||||
 | 
					    msg="shared folder ($dir) is not writeable!"
 | 
				
			||||||
 | 
					    warn "$msg"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [ -z "$(ls -A "$dir")" ]; then
 | 
					  if [ -z "$(ls -A "$dir")" ]; then
 | 
				
			||||||
    if ! chmod 2777 "$dir"; then
 | 
					    if ! chmod 2777 "$dir"; then
 | 
				
			||||||
      error "Failed to set permissions for directory $dir" && return 1
 | 
					      error "Failed to set permissions for directory $dir" && return 1
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user