mirror of
				https://github.com/linuxserver/docker-code-server
				synced 2025-06-26 18:27:40 +00:00 
			
		
		
		
	Merge pull request #73 from gjrtimmer/fix/chown
fix apply chown permissions in parallel for large workspace
This commit is contained in:
		
						commit
						44f7b9fc5f
					
				@ -260,6 +260,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
 | 
			
		||||
 | 
			
		||||
## Versions
 | 
			
		||||
 | 
			
		||||
* **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned).
 | 
			
		||||
* **11.07.21:** - Bump node to 14 to fix builds
 | 
			
		||||
* **08.05.21:** - Fix doc link
 | 
			
		||||
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.
 | 
			
		||||
 | 
			
		||||
@ -75,6 +75,7 @@ app_setup_block: |
 | 
			
		||||
 | 
			
		||||
# changelog
 | 
			
		||||
changelogs:
 | 
			
		||||
  - { date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)." }
 | 
			
		||||
  - { date: "11.07.21:", desc: "Bump node to 14 to fix builds" }
 | 
			
		||||
  - { date: "08.05.21:", desc: "Fix doc link" }
 | 
			
		||||
  - { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." }
 | 
			
		||||
 | 
			
		||||
@ -18,5 +18,20 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# permissions
 | 
			
		||||
chown -R abc:abc \
 | 
			
		||||
    /config
 | 
			
		||||
if [ -f "/usr/bin/find" ] && [ -f "/usr/bin/xargs" ]; then
 | 
			
		||||
    CORES=$(nproc --all)
 | 
			
		||||
 | 
			
		||||
    # Split workload between config and workspace
 | 
			
		||||
    echo "setting permissions::configuration"
 | 
			
		||||
    find /config -path /config/workspace -prune -false -o -type d -print0 | \
 | 
			
		||||
        xargs --null -r --max-args=1 --max-procs=$((CORES*2*8)) \
 | 
			
		||||
        chown -R abc:abc
 | 
			
		||||
 | 
			
		||||
    echo "setting permissions::workspace"
 | 
			
		||||
    chown abc:abc /config/workspace
 | 
			
		||||
else
 | 
			
		||||
    # Set permissions on data mount
 | 
			
		||||
    # do not decend into the workspace
 | 
			
		||||
    chown -R abc:abc "$(ls /config -I workspace)"
 | 
			
		||||
    chown abc:abc /config/workspace
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user