summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2009-07-27 00:27:30 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2009-08-06 23:26:29 +0200
commit7498c234f5aee19adb73f4905735e2eb3c2055a7 (patch)
tree9b9d3662a94f3337f6d7adba5126f6f0a447d84f /bin
parentc34a78cd247faef29c7a7b7c4cc7e7a53f9bd1d4 (diff)
downloadptxdist-7498c234f5aee19adb73f4905735e2eb3c2055a7.tar.gz
ptxdist-7498c234f5aee19adb73f4905735e2eb3c2055a7.tar.xz
[ptxdist] support late logfile creation if logdir is not inside workspace
If the logdir lies outside of the workspace it might not be created without root privileges. So we defer it, the logdir will be created later by the sudo helper. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ptxdist17
1 files changed, 14 insertions, 3 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index 363e6608f..5645d4926 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2245,11 +2245,22 @@ setup_logfile()
{
local logdir="${PTX_LOGFILE%/*}"
- if [ ! -d "${logdir}" ]; then
- mkdir -p ${logdir} || ptxd_bailout "cannot create dir: ${logdir}"
+ if [ -e "${logdir}" -a \! -w "${logdir}" -o \
+ \! -d "${logdir}" ] && ! mkdir -p "${logdir}" 2>/dev/null; then
+ #
+ # small hack:
+ #
+ # if we cannot create the logdir and it's outside the
+ # workspace, it will be created later with the sudo
+ # helper, so don't bailout in this case.
+ #
+ case "${logdir}" in
+ "${PTXDIST_WORKSPACE}"*) ptxd_bailout "cannot create logdir: '${logdir}'" ;;
+ *) return ;;
+ esac
fi
- if [ ! -e "${PTX_LOGFILE}" ]; then
+ if [ \! -e "${PTX_LOGFILE}" ]; then
# let emacs outline mode be compatible to vi's fold mode
echo -e "# -*- mode:outline; outline-regexp:\"{""{{\" -*-\n" > "${PTX_LOGFILE}"
fi