Clean up Makefile, tag method script with current changeset during build

Update README and Changelog to reflect the GUI removal
825d2625c177 broke RBAC support
Ensure that starting/stopping :default instance is a no-op.
This commit is contained in:
Tim Foster 2008-10-03 13:43:27 +01:00
parent 58733e075b
commit 644b686ebe
14 changed files with 68 additions and 79 deletions

1
.hgignore Normal file
View File

@ -0,0 +1 @@
proto

View File

@ -20,6 +20,8 @@
* Check for missed snapshots on startup
* Clean up shell style
* Clean up preremove script
* Remove the bundled GUI applications
* Tag the method script with the current changeset during the build
* Write this Changelog
0.10

View File

@ -1,10 +1,13 @@
DIR = \
`basename ${PWD}`
ZFS_AUTO_SNAPSHOT_CHANGESET = \
`hg identify`
pkg: clean
mkdir -p proto
cat src/pkginfo.s | sed -e s/~PSTAMP~/`uname -n``date +%Y%m%d%H%M%S`/g > src/pkginfo
pkgmk -f src/prototype -d proto -r src
find src | cpio -pvdum proto
cat src/lib/svc/method/zfs-auto-snapshot | sed -e "s/~ZFS_AUTO_SNAPSHOT_CHANGESET~/${ZFS_AUTO_SNAPSHOT_CHANGESET}/g" > proto/src/lib/svc/method/zfs-auto-snapshot
pkgmk -f proto/src/prototype -p `uname -n``date +%Y%m%d%H%M%S` -d proto -r proto/src
clean:
rm -rf proto/*
@ -12,7 +15,7 @@ clean:
rmdir proto ; \
fi
dist:
dist: clean
hg revert --all
tar cf ${DIR}.tar -C .. ${DIR}/Changelog -C .. ${DIR}/Makefile \
-C .. ${DIR}/README.zfs-auto-snapshot.txt -C .. ${DIR}/src

View File

@ -1,7 +1,7 @@
NAME
ZFS Automatic Snapshot SMF Service, version 0.11 Early Access
ZFS Automatic Snapshot SMF Service, version 0.11
DESCRIPTION
@ -13,16 +13,10 @@ incremental or full backups of those filesystems.
Documentation for the service is contained in the manifest file,
zfs-auto-snapshot.xml.
As of version 0.9 there is a simple GUI that allows the user to configure
which filesystems are to be included in the default canned SMF instances.
This GUI is installed in the GNOME menu under:
Administration -> Automatic Snapshots
We also bundle a simple GUI application, which will query the user for the
properties required, and will then build an instance manifest. This
GUI is documented as part of the installation instructions below.
Version 0.11 removes the simple GUI applications that were used to
create manifests, or select which filesystems should be included
in the canned instances. These are superceded by the time-slider-setup
application.
INSTALLATION
@ -119,37 +113,14 @@ The properties each instance needs are:
An example instance manifest is included in this archive.
The script "zfs-auto-snapshot-admin.sh" is a simple shell wrapper which uses
zenity, a scriptable GUI framework in GNOME, to write a service manifest
based on user input.
# ./zfs-auto-snapshot-admin.sh
Usage: zfs-auto-snapshot-admin.sh [zfs filesystem name]
EXAMPLES
The following shows us running it for the ZFS filesystem
"tank/root_filesystem".
timf@haiiro[593] ./zfs-auto-snapshot-admin.sh tank/root_filesystem
[ a set of dialogs appear, asking for input ]
Thanks, now assuming the default SMF manifest has already been imported,
you can now import the manifest for this instance, using the command :
# svccfg import auto-snapshot-instance.xml
then issue the command :
# svcadm enable svc:/system/filesystem/zfs/auto-snapshot:tank-root_filesystem
SECURITY
The service is run by a restricted role "zfssnap", which is created when installing
the service. It has the "ZFS File System Administration" RBAC Profile, as well
as the solaris.smf.manage.zfs-auto-snapshot Authorization. In order to see what
the service is doing, you can view the SMF log files in /var/svc/log for each
service instance and syslog, with more detailed logging output being sent to
the log files in the zfssnap role's home directory. (/export/home/zfssnap, by default)
the service if it doesn't already exist. It has the "ZFS File System Administration"
RBAC Profile, as well as the solaris.smf.manage.zfs-auto-snapshot Authorization.
In order to see what the service is doing, you can view the SMF log files in
/var/svc/log for each service instance and syslog, with more detailed logging output
being sent to syslog when the "zfs/verbose" option is enabled.
SEE ALSO

View File

@ -25,6 +25,8 @@
# Use is subject to license terms.
#
# zfs-auto-snapshot changeset = ~ZFS_AUTO_SNAPSHOT_CHANGESET~
#
# This SMF method takes snapshots periodically of a zfs filesystem, with
@ -909,6 +911,11 @@ fi
# $1 start | stop | refresh | an FMRI that we want to take snapshots of.
case "$1" in
'start')
if [ "$SMF_FMRI" = "svc:/system/filesystem/zfs/auto-snapshot:default" ] ; then
print_log "The default service should not be enabled - use instances instead."
exit $SMF_EXIT_OK
fi
auto_include $SMF_FMRI
schedule_snapshots $SMF_FMRI
if [ $? -eq 0 ] ; then
@ -920,6 +927,10 @@ case "$1" in
;;
'stop')
if [ "$SMF_FMRI" = "svc:/system/filesystem/zfs/auto-snapshot:default" ] ; then
print_log "The default service should not be used - use instances instead."
exit $SMF_EXIT_OK
fi
unschedule_snapshots $SMF_FMRI
if [ $? -eq 0 ] ; then
result=$SMF_EXIT_OK

View File

@ -8,7 +8,7 @@ PKG=SUNWzfs-auto-snapshot
NAME=ZFS Automatic Snapshot Service
ARCH=all
BASEDIR=/
VERSION=0.11ea
VERSION=0.11
MAXINST=1
CATEGORY=application
DESC=Takes automatic snapshots of ZFS filesystems on a periodic basis.

View File

@ -1,30 +0,0 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# a postinstall script - it should disable the services
# and delete the instances
echo preremove script doing nothing

View File

@ -1,7 +1,6 @@
i pkginfo
i copyright
i postinstall
i preremove
i i.manifest
i r.manifest
d none lib 0755 root bin

View File

@ -173,11 +173,8 @@ they being :
<propval name="label" type="astring" value="" override="true"/>
<propval name="verbose" type="boolean" value="false" override="true"/>
<propval name="avoidscrub" type="boolean" value="false" override="true"/>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- we're *not* defining an instance here : the idea is that instances

View File

@ -17,6 +17,13 @@ snapshots into the past.
<instance name='daily' enabled='false' >
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- properties for zfs automatic snapshots -->
<property_group name="zfs" type="application">

View File

@ -17,6 +17,13 @@ com.sun:auto-snapshot:frequent=true every
<instance name='frequent' enabled='false' >
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- properties for zfs automatic snapshots -->
<property_group name="zfs" type="application">

View File

@ -17,6 +17,13 @@ and keeps 24 of these snapshots into the past.
<instance name='hourly' enabled='false' >
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- properties for zfs automatic snapshots -->
<property_group name="zfs" type="application">

View File

@ -17,6 +17,13 @@ and keeps 12 of these snapshots into the past.
<instance name='monthly' enabled='false' >
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- properties for zfs automatic snapshots -->
<property_group name="zfs" type="application">

View File

@ -17,6 +17,13 @@ and keeps 4 of these snapshots into the past.
<instance name='weekly' enabled='false' >
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.zfs-auto-snapshot' />
</property_group>
<!-- properties for zfs automatic snapshots -->
<property_group name="zfs" type="application">