From 8f99800ef6158004a0188b63d4fbc5954b15e9ca Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 19 Aug 2014 00:03:31 -0400 Subject: [PATCH] Add option to specify ownership of downloaded files and patches --- functions/fpkg | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/functions/fpkg b/functions/fpkg index 6c0c26e..3f8e624 100644 --- a/functions/fpkg +++ b/functions/fpkg @@ -3,6 +3,10 @@ source ../config/urls source ../functions/gztobz2 +# Ownership of downloaded files +FPKG_USER="root" +FPKG_GROUP="users" + LFS_PKG_BASE="$(dirname $(pwd))/packages" LFS_PKG_DIR="${LFS_PKG_BASE}/${LFS_STAGE}" LFS_PATCHES_DIR="${LFS_PKG_BASE}/${LFS_STAGE}/patches" @@ -115,6 +119,9 @@ wget_wrapper() --output-document=${DESTDIR}/${SOURCE}.part wget_status=$? + chown ${FPKG_USER}:${FPKG_GROUP} ${DESTDIR}/${SOURCE}.part + chmod 664 ${DESTDIR}/${SOURCE}.part + # Append log to global log file cat ${WGET_LOG_FILE} >> ${LFS_LOG_FILE} @@ -150,6 +157,8 @@ wget_wrapper() # Rename temporary file to final name mv ${DESTDIR}/${SOURCE}{.part,} + chown ${FPKG_USER}:${FPKG_GROUP} ${DESTDIR}/${SOURCE} + chmod 664 ${DESTDIR}/${SOURCE} return 0 } @@ -190,12 +199,14 @@ update_packages_init() # Then create destination directory if it does not exists. if [ ! -d ${LFS_PKG_DIR} ]; then - install -v -m755 -d ${LFS_PKG_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 + install -v -m775 -o ${FPKG_USER} -g ${FPKG_GROUP} \ + -d ${LFS_PKG_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 fi # Create patches destination directory if it does not exists. if [ ! -d ${LFS_PATCHES_DIR} ]; then - install -v -m755 -d ${LFS_PATCHES_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 + install -v -m775 -o ${FPKG_USER} -g ${FPKG_GROUP} \ + -d ${LFS_PATCHES_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1 fi if [ -n "${TEST_INTEGRITY}" ]; then -- 2.20.1