From eb3fb21b03ae731a246965a59e6916638772a4cd Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 9 Oct 2009 19:44:47 +0000 Subject: Adding config variables TMP_USER and TMP_GROUP git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@821 04377dda-e619-0410-9926-eae83683ac58 --- trunk/conf/simplepkg.conf | 8 ++++++++ trunk/lib/common.sh | 2 ++ trunk/src/createpkg | 18 +++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/trunk/conf/simplepkg.conf b/trunk/conf/simplepkg.conf index 26c6657..2ffb59b 100644 --- a/trunk/conf/simplepkg.conf +++ b/trunk/conf/simplepkg.conf @@ -21,6 +21,14 @@ # Temporary folder TMP="/tmp/simplepkg" +# Temporary folder user: use it if you want to bind simplepkg's +# temporary folder to a given user +# TMP_USER="" + +# Temporary folder group: use it if you want to bind simplepkg's +# temporary folder to a given group +# TMP_GROUP="" + #--------------------------------------------------------------------- # MKBUILD AND CREATEPKG SECTION #--------------------------------------------------------------------- diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index de3f375..dbb01eb 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -281,6 +281,8 @@ function eval_config { DEFAULT_VERSION="`eval_parameter DEFAULT_VERSION $(default_version)`" TMP="`eval_parameter TMP /tmp`" + TMP_USER="`eval_parameter TMP_USER`" + TMP_GROUP="`eval_parameter TMP_GROUP`" STORAGE="`eval_parameter STORAGE /var/simplaret/packages`" JAIL_ROOT="`eval_parameter JAIL_ROOT /vservers`" PATCHES_DIR="`eval_parameter PATCHES_DIR /var/simplaret/patches`" diff --git a/trunk/src/createpkg b/trunk/src/createpkg index ebebf66..10daf0b 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -248,7 +248,10 @@ function load_parameters { CREATEPKG_ARCH="`eval_parameter CREATEPKG_ARCH $(default_arch)`" CREATEPKG_CLEANUP="`eval_parameter CREATEPKG_CLEANUP yes`" CREATEPKG_AUTHOR="`eval_parameter CREATEPKG_AUTHOR`" + TMP="`eval_parameter TMP /tmp`" + TMP_USER="`eval_parameter TMP_USER`" + TMP_GROUP="`eval_parameter TMP_GROUP`" SIGN_PACKAGES="`eval_boolean_parameter SIGN_PACKAGES $off`" SIGN_PACKAGES_USER="`eval_parameter SIGN_PACKAGES_USER`" @@ -905,7 +908,20 @@ function build_queue { echo -e "$unable_to_install" fi - # Exit if last build package exit status + # Fix possible $TMP removal + mkdir -p $TMP + + # Fix $TMP user + if [ ! -z "$TMP_USER" ]; then + chown $TMP_USER $TMP + fi + + # Fix $TMP group + if [ ! -z "$TMP_GROUP" ]; then + chgrp $TMP_GROUP $TMP + fi + + # Exit with last build package exit status exit $last_status } -- cgit v1.2.3