Filesystems weren't exluded - spaces are not tabs.

auto_include shouldn't parse column headers.
Postinstall script should work on SXCE too.
This commit is contained in:
Tim Foster 2008-08-28 12:51:46 +01:00
parent 77eda5fb7b
commit b62130a877
2 changed files with 18 additions and 22 deletions

View File

@ -779,7 +779,7 @@ function narrow_recursive_filesystems {
function can_recursive_snapshot { function can_recursive_snapshot {
typeset ds=$1 typeset ds=$1
if egrep "$ds/"\|"$ds " $EXCLUDE > /dev/null; then if egrep "$ds/"\|"$ds " $EXCLUDE > /dev/null; then
# we can't recursively snapshot $ds because # we can't recursively snapshot $ds because
# it's excluded or is in the path to an excluded dataset # it's excluded or is in the path to an excluded dataset
return 1 return 1
@ -790,7 +790,7 @@ function can_recursive_snapshot {
function is_excluded { function is_excluded {
typeset ds=$1 typeset ds=$1
if egrep "$ds " $EXCLUDE > /dev/null ; then if egrep "$ds " $EXCLUDE > /dev/null ; then
return 0 return 0
else else
return 1 return 1
@ -879,8 +879,8 @@ function auto_include {
POOLS=$(zpool list -H -o name) POOLS=$(zpool list -H -o name)
for pool in $POOLS ; do for pool in $POOLS ; do
if ! zpool status -x $pool | grep "state: UNAVAIL" > /dev/null ; then if ! zpool status -x $pool | grep "state: UNAVAIL" > /dev/null ; then
SNAPALL=$(zfs get com.sun:auto-snapshot $pool) SNAPALL=$(zfs get -H -o value com.sun:auto-snapshot $pool)
SNAPLABEL=$(zfs get com.sun:auto-snapshot:$LABEL $pool) SNAPLABEL=$(zfs get -H -o value com.sun:auto-snapshot:$LABEL $pool)
SNAP=$SNAPALL$SNAPLABEL SNAP=$SNAPALL$SNAPLABEL
case $SNAP in case $SNAP in
*true | true*) *true | true*)

View File

@ -1,4 +1,4 @@
#!/bin/ksh #!/bin/sh
# #
# CDDL HEADER START # CDDL HEADER START
@ -32,7 +32,7 @@
# Check if the first argument is 0, settting our return # Check if the first argument is 0, settting our return
# variable to an error otherwise # variable to an error otherwise
# #
function check_error { check_error() {
RETURN_CODE=$1 RETURN_CODE=$1
ERROR="$2" ERROR="$2"
if [ "$RETURN_CODE" -ne 0 ] ; then if [ "$RETURN_CODE" -ne 0 ] ; then
@ -40,32 +40,28 @@ function check_error {
fi fi
} }
function user_exists { user_exists() {
typeset USER=$1 USER=$1
if /usr/bin/grep ^$USER: $BASEDIR/etc/passwd > /dev/null ; then /usr/bin/grep "^$USER:" $BASEDIR/etc/passwd > /dev/null
return 0 return $?
else
return 1
fi
} }
function auth_exists { auth_exists() {
typeset AUTH=$1 AUTH=$1
if /usr/bin/grep ^$AUTH: $BASEDIR/etc/security/auth_attr > /dev/null ; then /usr/bin/grep "^$AUTH:" $BASEDIR/etc/security/auth_attr > /dev/null
return 0 return $?
else
return 1
fi
} }
# add our authorization # add our authorization
if ! auth_exists solaris.smf.manage.zfs-auto-snapshot; then auth_exists solaris.smf.manage.zfs-auto-snapshot
if [ $? -ne 0 ] ; then
echo "solaris.smf.manage.zfs-auto-snapshot:::Manage the ZFS Automatic Snapshot Service::" \ echo "solaris.smf.manage.zfs-auto-snapshot:::Manage the ZFS Automatic Snapshot Service::" \
>> /etc/security/auth_attr >> /etc/security/auth_attr
fi fi
# add the zfssnap role - probably only works on a local system :-( # add the zfssnap role - probably only works on a local system :-(
if ! user_exists zfssnap; then user_exists zfssnap
if [ $? -ne 0 ] ; then
/usr/sbin/roleadd -d /export/home/zfssnap -c "ZFS Automatic Snapshots role" \ /usr/sbin/roleadd -d /export/home/zfssnap -c "ZFS Automatic Snapshots role" \
-P "ZFS File System Management" \ -P "ZFS File System Management" \
-A solaris.smf.manage.zfs-auto-snapshot -m zfssnap -A solaris.smf.manage.zfs-auto-snapshot -m zfssnap