diff options
author | jpaetzel <jpaetzel@FreeBSD.org> | 2012-05-04 15:31:35 +0000 |
---|---|---|
committer | jpaetzel <jpaetzel@FreeBSD.org> | 2012-05-04 15:31:35 +0000 |
commit | 322588cef7d4caaa6619a0560c0c83a195d35ce9 (patch) | |
tree | 33f4e37eac525390ca7a62a868684c27ba670e7d /usr.sbin | |
parent | 6254db119165c3b3fe82b4e9345de0de255bf7b5 (diff) | |
download | FreeBSD-src-322588cef7d4caaa6619a0560c0c83a195d35ce9.zip FreeBSD-src-322588cef7d4caaa6619a0560c0c83a195d35ce9.tar.gz |
Use a unique zpool name during install, in the case of having another
PC-BSD / FreeBSD zpool on the system for another install.
Submitted by: kmoore
Obtained from: PC-BSD
MFC after: 3 days
Sponsored by: iXsystems
Diffstat (limited to 'usr.sbin')
-rwxr-xr-x | usr.sbin/pc-sysinstall/backend/functions.sh | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions.sh b/usr.sbin/pc-sysinstall/backend/functions.sh index 9a98ee2..a5a0794 100755 --- a/usr.sbin/pc-sysinstall/backend/functions.sh +++ b/usr.sbin/pc-sysinstall/backend/functions.sh @@ -216,7 +216,7 @@ fetch_file() fetch -s "${FETCHFILE}" >${SIZEFILE} SIZE="`cat ${SIZEFILE}`" - SIZE="`expr ${SIZE} / 1024`" + SIZE=$((SIZE/1024)) echo "FETCH: ${FETCHFILE}" echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT} @@ -276,11 +276,22 @@ get_zpool_name() else # Need to generate a zpool name for this device NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'` - NEWNAME="${BASENAME}${NUM}" + + # Is it used in another zpool? + while + z=1 + do + NEWNAME="${BASENAME}${NUM}" + zpool import | grep -q "${NEWNAME}" + if [ $? -ne 0 ] ; then break ; fi + NUM=$((NUM+1)) + done + + # Now save the new tank name mkdir -p ${TMPDIR}/.zpools/`dirname $DEVICE` echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE} echo "${NEWNAME}" - return + return 0 fi }; |