From 4c78536938d77a8e4802bd6006e64e8cb85f3d6c Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Sun, 3 Sep 2006 21:26:12 +0000 Subject: [PATCH] Check for permissions to write temporary files. Bug #142308 svn path=/; revision=313 --- trunk/src/revdep-rebuild/revdep-rebuild | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/trunk/src/revdep-rebuild/revdep-rebuild b/trunk/src/revdep-rebuild/revdep-rebuild index 94a3f45..9093b40 100755 --- a/trunk/src/revdep-rebuild/revdep-rebuild +++ b/trunk/src/revdep-rebuild/revdep-rebuild @@ -135,7 +135,25 @@ done NOCOLOR=$(portageq envvar NOCOLOR) # Base of temporary files names. -LIST=~/.revdep-rebuild +touch ${HOME}/.revdep-rebuild_0.test 2>/dev/null +if [ $? -eq 0 ] +then + LIST="${HOME}/.revdep-rebuild" + rm ~/.revdep-rebuild_0.test +else + # Try to use /var/tmp since $HOME is not available + touch /var/tmp/.revdep-rebuild_0.test 2>/dev/null + if [ $? -eq 0 ] + then + LIST="/var/tmp/.revdep-rebuild" + rm /var/tmp/.revdep-rebuild_0.test + else + echo + echo "!!! Unable to write temporary files to either $HOME or /var/tmp !!!" + echo + exit 1 + fi +fi shopt -s nullglob shopt -s expand_aliases -- 2.26.2