diff --git a/lib/general.sh b/lib/general.sh index 4a19d9541e..6207f41807 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -547,6 +547,12 @@ prepare_host() # create directory structure mkdir -p $DEST/debs/extra $DEST/{config,debug,patch} $SRC/userpatches/overlay $SRC/cache/{sources,toolchains,rootfs} $SRC/.tmp + if [[ -n $SUDO_USER ]]; then + chgrp --quiet sudo cache output userpatches + # SGID bit on cache/sources breaks kernel dpkg packaging + chmod --quiet g+w,g+s output userpatches + fi + find $SRC/patch -type d ! -name . | sed "s%/patch%/userpatches%" | xargs mkdir -p # download external Linaro compiler and missing special dependencies since they are needed for certain sources diff --git a/lib/main.sh b/lib/main.sh index 4f89007957..8df333ae32 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -17,6 +17,10 @@ if [[ $(basename $0) == main.sh ]]; then exit -1 fi +# default umask for root is 022 so parent directories won't be group writeable without this +# this is used instead of making the chmod in prepare_host() recursive +umask 002 + # destination DEST=$SRC/output