From ba576b3931719b15fa97234d5f5cdca244b9349e Mon Sep 17 00:00:00 2001
From: Jake Guffey <jake.guffey@eprotex.com>
Date: Thu, 21 Jun 2012 11:59:53 -0400
Subject: [PATCH] Don't symlink multiple times

Was checking for existence of $jaildir/home -- never exists; will always create new symlink
Changed to look for directory or symlink at $jaildir/base/home and respond accordingly
---
 conf/type/__jail/gencode-remote | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote
index 62aa7b60..71bb31b5 100755
--- a/conf/type/__jail/gencode-remote
+++ b/conf/type/__jail/gencode-remote
@@ -185,10 +185,12 @@ cat <<EOF
       if [ ! -d "${jaildir}/base/usr/home" ]; then
          mkdir -p "${jaildir}/base/usr/home"
       fi
-      if [ ! -d "${jaildir}/home" ]; then
-          SAVE=\$PWD; cd ${jaildir}/base
-          ln -s usr/home home
-          cd \$SAVE; unset SAVE
+      if [ ! -d "${jaildir}/base/home" ]; then
+          if [ ! -L "${jaildir}/base/home" ]; then
+             SAVE=\$PWD; cd ${jaildir}/base
+             ln -s usr/home home
+             cd \$SAVE; unset SAVE
+          fi
       fi
    fi
    if [ ! -d "${jaildir}/rw" ]; then