mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-01 19:17:15 -04:00 
			
		
		
		
	Fixes an issue where the consume directory wasn't included in the permissions fix at Docker entry
This commit is contained in:
		
							parent
							
								
									0e443ba017
								
							
						
					
					
						commit
						3a7cbd3a42
					
				| @ -50,6 +50,7 @@ map_folders() { | ||||
| 	# Export these so they can be used in docker-prepare.sh | ||||
| 	export DATA_DIR="${PAPERLESS_DATA_DIR:-/usr/src/paperless/data}" | ||||
| 	export MEDIA_ROOT_DIR="${PAPERLESS_MEDIA_ROOT:-/usr/src/paperless/media}" | ||||
| 	export CONSUME_DIR="${PAPERLESS_CONSUMPTION_DIR:-/usr/src/paperless/consume}" | ||||
| } | ||||
| 
 | ||||
| initialize() { | ||||
| @ -77,7 +78,11 @@ initialize() { | ||||
| 
 | ||||
| 	local export_dir="/usr/src/paperless/export" | ||||
| 
 | ||||
| 	for dir in "${export_dir}" "${DATA_DIR}" "${DATA_DIR}/index" "${MEDIA_ROOT_DIR}" "${MEDIA_ROOT_DIR}/documents" "${MEDIA_ROOT_DIR}/documents/originals" "${MEDIA_ROOT_DIR}/documents/thumbnails"; do | ||||
| 	for dir in \ | ||||
| 		"${export_dir}" \ | ||||
| 		"${DATA_DIR}" "${DATA_DIR}/index" \ | ||||
| 		"${MEDIA_ROOT_DIR}" "${MEDIA_ROOT_DIR}/documents" "${MEDIA_ROOT_DIR}/documents/originals" "${MEDIA_ROOT_DIR}/documents/thumbnails" \ | ||||
| 		"${CONSUME_DIR}"; do | ||||
| 		if [[ ! -d "${dir}" ]]; then | ||||
| 			echo "Creating directory ${dir}" | ||||
| 			mkdir "${dir}" | ||||
| @ -91,7 +96,11 @@ initialize() { | ||||
| 	set +e | ||||
| 	echo "Adjusting permissions of paperless files. This may take a while." | ||||
| 	chown -R paperless:paperless ${tmp_dir} | ||||
| 	for dir in "${export_dir}" "${DATA_DIR}" "${MEDIA_ROOT_DIR}"; do | ||||
| 	for dir in \ | ||||
| 		"${export_dir}" \ | ||||
| 		"${DATA_DIR}" \ | ||||
| 		"${MEDIA_ROOT_DIR}" \ | ||||
| 		"${CONSUME_DIR}"; do | ||||
| 		find "${dir}" -not \( -user paperless -and -group paperless \) -exec chown paperless:paperless {} + | ||||
| 	done | ||||
| 	set -e | ||||
|  | ||||
| @ -1,4 +1,6 @@ | ||||
| import grp | ||||
| import os | ||||
| import pwd | ||||
| import shutil | ||||
| import stat | ||||
| 
 | ||||
| @ -32,12 +34,15 @@ def path_check(var, directory): | ||||
|                 with open(test_file, "w"): | ||||
|                     pass | ||||
|             except PermissionError: | ||||
|                 dir_stat = os.stat(directory) | ||||
|                 dir_mode = stat.filemode(dir_stat.st_mode) | ||||
|                 dir_owner = pwd.getpwuid(dir_stat.st_uid).pw_name | ||||
|                 dir_group = grp.getgrgid(dir_stat.st_gid).gr_name | ||||
|                 messages.append( | ||||
|                     Error( | ||||
|                         writeable_message.format(var), | ||||
|                         writeable_hint.format( | ||||
|                             f"\n{stat.filemode(os.stat(directory).st_mode)} " | ||||
|                             f"{directory}\n", | ||||
|                             f"\n{dir_mode} {dir_owner} {dir_group} " f"{directory}\n", | ||||
|                         ), | ||||
|                     ), | ||||
|                 ) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user