summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh13
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh1
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-mountdisk.sh8
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-newfs.sh44
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions.sh6
-rw-r--r--usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf8
6 files changed, 66 insertions, 14 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh b/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
index 0eedfad..37353d7 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
@@ -62,7 +62,18 @@ get_fs_line_xvars()
echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache):" 2>/dev/null
if [ $? -eq 0 ] ; then
ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
- ZFSVARS=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"`
+ tmpVars=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"`
+ ZFSVARS=""
+ # make sure we have a '/dev' in front of the extra devices
+ for i in $tmpVars
+ do
+ echo $i | grep -q '/dev/'
+ if [ $? -ne 0 ] ; then
+ ZFSVARS="$ZFSVARS /dev/${i}"
+ else
+ ZFSVARS="$ZFSVARS $i"
+ fi
+ done
fi
# Return the ZFS options
diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
index b1b815d..eac10d9 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
@@ -33,6 +33,7 @@ is_disk()
for _dsk in `sysctl -n kern.disks`
do
[ "$_dsk" = "${1}" ] && return 0
+ [ "/dev/$_dsk" = "${1}" ] && return 0
done
return 1
diff --git a/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh b/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
index c90c058..e9eb148 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
@@ -149,12 +149,12 @@ mount_all_filesystems()
for PART in `ls ${PARTDIR}`
do
PARTDEV=`echo $PART | sed 's|-|/|g'`
- if [ ! -e "${PARTDEV}" ]
+ PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
+ if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ]
then
exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?"
fi
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`"
PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`"
@@ -186,12 +186,12 @@ mount_all_filesystems()
for PART in `ls ${PARTDIR}`
do
PARTDEV=`echo $PART | sed 's|-|/|g'`
- if [ ! -e "${PARTDEV}" ]
+ PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
+ if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ]
then
exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?"
fi
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`"
PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`"
diff --git a/usr.sbin/pc-sysinstall/backend/functions-newfs.sh b/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
index 2ab4a83..f8664f0 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
@@ -60,18 +60,56 @@ setup_zfs_filesystem()
fi
done
-
# Check if we have some custom zpool arguments and use them if so
if [ ! -z "${ZPOOLOPTS}" ] ; then
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS}"
+ # Sort through devices and run gnop on them
+ local gnopDev=""
+ local newOpts=""
+ for i in $ZPOOLOPTS
+ do
+ echo "$i" | grep -q '/dev/'
+ if [ $? -eq 0 ] ; then
+ rc_halt "gnop create -S 4096 ${i}"
+ gnopDev="$gnopDev $i"
+ newOpts="$newOpts ${i}.nop"
+ else
+ newOpts="$newOpts $i"
+ fi
+ done
+
+ echo_log "Creating zpool ${ZPOOLNAME} with $newOpts"
+ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${newOpts}"
+
+ # Export the pool
+ rc_halt "zpool export ${ZPOOLNAME}"
+
+ # Destroy the gnop devices
+ for i in $gnopDev
+ do
+ rc_halt "gnop destroy ${i}.nop"
+ done
+
+ # And lastly re-import the pool
+ rc_halt "zpool import ${ZPOOLNAME}"
else
+ # Lets do our pseudo-4k drive
+ rc_halt "gnop create -S 4096 ${PART}${EXT}"
+
# No zpool options, create pool on single device
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
+ echo_log "Creating zpool ${ZPOOLNAME} on ${PART}${EXT}"
+ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}.nop"
+
+ # Finish up the gnop 4k trickery
+ rc_halt "zpool export ${ZPOOLNAME}"
+ rc_halt "gnop destroy ${PART}${EXT}.nop"
+ rc_halt "zpool import ${ZPOOLNAME}"
fi
# Disable atime for this zfs partition, speed increase
rc_nohalt "zfs set atime=off ${ZPOOLNAME}"
+
+
};
# Runs newfs on all the partiions which we've setup with bsdlabel
diff --git a/usr.sbin/pc-sysinstall/backend/functions.sh b/usr.sbin/pc-sysinstall/backend/functions.sh
index 33d0005..a2d039b 100755
--- a/usr.sbin/pc-sysinstall/backend/functions.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions.sh
@@ -277,7 +277,11 @@ get_zpool_name()
while :
do
NEWNAME="${BASENAME}${NUM}"
- zpool import | grep -qw "${NEWNAME}" || break
+ zpool list | grep -qw "${NEWNAME}"
+ local chk1=$?
+ zpool import | grep -qw "${NEWNAME}"
+ local chk2=$?
+ if [ $chk1 -eq 1 -a $chk2 -eq 1 ] ; then break ; fi
NUM=$((NUM+1))
done
diff --git a/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf b/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
index 5d682dc..9c01e31 100644
--- a/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
+++ b/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
@@ -5,11 +5,9 @@
TMPDIR="/tmp/.pc-sysinstall"
export TMPDIR
-if [ ! -d "${TMPDIR}" ]
-then
- mkdir -p ${TMPDIR}
- chmod 777 ${TMPDIR}
-fi
+# Create a fresh TMPDIR
+if [ -d "${TMPDIR}" -a "$TMPDIR" != '/' ]; then rm -rf ${TMPDIR}; fi
+mkdir -p ${TMPDIR}
# Set our temp directory for storing partition information
PARTDIR="${TMPDIR}/part-info"
OpenPOWER on IntegriCloud