Skip to content

Commit

Permalink
Merge pull request #121 from glerchundi/master
Browse files Browse the repository at this point in the history
fix-attrs dramatically improved :)
  • Loading branch information
glerchundi committed Dec 16, 2015
2 parents 115f89e + 84f9b98 commit 7796491
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion builder/build-latest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -x
## PARAMS
##

RELEASE_VERSION=${RELEASE_VERSION:-1.17.0.0}
RELEASE_VERSION=${RELEASE_VERSION:-1.17.1.0}
SKAWARE_VERSION=${RELEASE_VERSION%.*}
SKAWARE_SOURCE=${SKAWARE_SOURCE:-https://github.com/just-containers/skaware/releases/download/v$SKAWARE_VERSION}

Expand Down
47 changes: 32 additions & 15 deletions builder/overlay-rootfs/usr/bin/fix-attrs
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,58 @@

/bin/export PATH /usr/bin:/bin
/bin/export recfunction "\
multidefine -Cd"," -- ${3} { account uidgid }
backtick -n envuidgid_opts
{
ifte { s6-echo -- -D${uidgid} } { s6-echo -- -i }
s6-test -n ${uidgid}
}
importas -u envuidgid_opts envuidgid_opts
foreground { s6-envuidgid ${envuidgid_opts} ${account} s6-chown -U -- ${1} }
s6-chown -u ${3} -g ${4} -- ${1}
ifelse -- { if { s6-${2} } s6-test -d ${1} }
{
foreground
{
if -t { s6-test ! ${5} = "-" }
s6-chmod ${5} ${1}
if -t { s6-test ! ${6} = "-" }
s6-chmod ${6} ${1}
}
forbacktickx -0 subfile { s6-ls -0 ${1} }
multisubstitute
{
importas -u subfile subfile
importas recfunction recfunction
}
execlineb -S5 -c ${recfunction} ${1}/${subfile} true ${3} ${4} ${5}
execlineb -S5 -c ${recfunction} ${1}/${subfile} true ${3} ${4} ${5} ${6}
}
if -t { s6-test ! ${4} = "-" }
s6-chmod ${4} ${1}"
if -t { s6-test ! ${5} = "-" }
s6-chmod ${5} ${1}"

# process each line
forstdin -d"\n" -- line
importas -u line line
if { s6-test -n ${line} }
multidefine -0 -Cd" \t" -- ${line} { globex recurse user fmode dmode }
multidefine -0 -Cd" \t" -- ${line} { globex recurse userentry fmode dmode }
# get 'uid' and 'gid'
multidefine -Cd"," -- ${userentry} { account uidgid }
backtick -n envuidgid_opts
{
backtick -n opts
{
ifte { s6-echo -- -D${uidgid} } { s6-echo -- -i }
s6-test -n ${uidgid}
}
importas -u opts opts
ifte { s6-echo -- -nB ${opts} } { s6-echo -- ${opts} }
pipeline { s6-echo ${account} }
if
{
redirfd -w 1 /dev/null
fdmove -c 2 1
s6-grep -- ":"
}
}
importas -u -sCd" \t" envuidgid_opts envuidgid_opts
s6-envuidgid ${envuidgid_opts} ${account}
importas -u uid UID
importas -u gid GID
elglob -0 -- files ${globex}
forx -p -- file { ${files} }
multisubstitute
{
importas -u file file
importas recfunction recfunction
}
execlineb -S5 -c ${recfunction} ${file} ${recurse} ${user} ${fmode} ${dmode}
execlineb -S5 -c ${recfunction} ${file} ${recurse} ${uid} ${gid} ${fmode} ${dmode}

0 comments on commit 7796491

Please sign in to comment.