Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 437636 - app-backup/zfs-auto-snapshot - Automatically create, rotate, and destroy periodic ZFS snapshots
Summary: app-backup/zfs-auto-snapshot - Automatically create, rotate, and destroy peri...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Default Assignee for New Packages
URL: https://github.com/dajhorn/zfs-auto-s...
Whiteboard:
Keywords: EBUILD
: 469840 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-08 21:26 UTC by Vilbrekin
Modified: 2018-05-11 17:35 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
zfs-auto-snapshot-9999.ebuild (file_437636.txt,663 bytes, text/plain)
2012-10-08 21:27 UTC, Vilbrekin
Details
zfs-auto-snapshot-9999.ebuild (zfs-auto-snapshot-9999.ebuild,529 bytes, text/plain)
2012-10-26 11:48 UTC, Sergey Popov
Details
ebuild support default-exclude by default (zfs-auto-snapshot-9999-r1.ebuild,1.75 KB, text/plain)
2013-05-17 22:57 UTC, Joe Chen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vilbrekin 2012-10-08 21:26:22 UTC
Simple ebuild for zfs-auto-snapshot (https://github.com/dajhorn/zfs-auto-snapshot).
Those are only shell scripts emulating the auto snapshot service of Solaris.

Reproducible: Always

Steps to Reproduce:
1. emerge zfs-auto-snapshot
Actual Results:  
No package found

Expected Results:  
Existing package
Comment 1 Vilbrekin 2012-10-08 21:27:28 UTC
Created attachment 326038 [details]
zfs-auto-snapshot-9999.ebuild
Comment 2 Sergey Popov gentoo-dev 2012-10-26 11:48:49 UTC
Created attachment 327462 [details]
zfs-auto-snapshot-9999.ebuild

Improved version of zfs-auto-snapshot live ebuild
Comment 3 Vilbrekin 2012-10-26 12:14:08 UTC
(In reply to comment #2)
> Created attachment 327462 [details]
> zfs-auto-snapshot-9999.ebuild
> 
> Improved version of zfs-auto-snapshot live ebuild

Hi Sergey,
I'm not sure you want to remove execute flag from the cron scripts other than the crond.d one: the other ones need to be executable to be executed.
Rgds,
V
Comment 4 Sergey Popov gentoo-dev 2012-10-27 15:13:35 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Created attachment 327462 [details]
> > zfs-auto-snapshot-9999.ebuild
> > 
> > Improved version of zfs-auto-snapshot live ebuild
> 
> Hi Sergey,
> I'm not sure you want to remove execute flag from the cron scripts other
> than the crond.d one: the other ones need to be executable to be executed.
> Rgds,
> V

You are partially right, but i think that it would be better to add apropriate info to pkg_postinst to tell users of this package how to enable it(by doing chmod +x on those files in cron directories).
Comment 5 Vilbrekin 2012-10-27 16:04:20 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > Created attachment 327462 [details]
> > > zfs-auto-snapshot-9999.ebuild
> > > 
> > > Improved version of zfs-auto-snapshot live ebuild
> > 
> > Hi Sergey,
> > I'm not sure you want to remove execute flag from the cron scripts other
> > than the crond.d one: the other ones need to be executable to be executed.
> > Rgds,
> > V
> 
> You are partially right, but i think that it would be better to add
> apropriate info to pkg_postinst to tell users of this package how to enable
> it(by doing chmod +x on those files in cron directories).

I don't understand what would be the added value to have the user finish the install manually when we can automate it.
Comment 6 Sergey Popov gentoo-dev 2012-10-27 16:06:10 UTC
(In reply to comment #5)
> I don't understand what would be the added value to have the user finish the
> install manually when we can automate it.

For example: i do not want hourly,weekly and monthly backups, only daily ones. Maybe it would be better disable those cron scripts and let user explanation how to enable only those, which is needed for him?
Comment 7 Neil Bothwick 2013-02-09 12:30:26 UTC
The URLs for both the repo and home page have changed

EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
HOMEPAGE="https://github.com/zfsonlinux/zfs-auto-snapshot/"
Comment 8 Joe Chen 2013-05-17 11:04:00 UTC
it's not good to remove exec flag to remove execute flag from the cron scripts other than the crond.d one.

the better solution is turn on "--default-exclude" option by default
1. all cron script add paramter "--default-exclude"
2. modify zfs-auto-snapshot.sh: opt_default_exclude='' -> opt_default_exclude='1'

then let user use attribute com.sun:sanashot to decide which filesyste to make snapshot. ex.

# zfs set com.sun:auto-snapshot=false rpool
# zfs set com.sun:auto-snapshot=true rpool
# zfs set com.sun:auto-snapshot:weekly=true rpool
Comment 9 Joe Chen 2013-05-17 22:21:30 UTC
I modify the ebuild as below:

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"

inherit git-2

DESCRIPTION="Automatic snapshots for ZFS on Linux"
HOMEPAGE="https://github.com/dajhorn/zfs-auto-snapshot/"
LICENSE="GPL-2"
KEYWORDS="amd64"
SLOT="0"
IUSE="+default-exclude"
DEPEND=""
RDEPEND="sys-fs/zfs
        virtual/cron"

DOCS=( README )

src_install() {
        default

        use default-exclude && for cronfile in /etc/cron.{d,daily,hourly,monthly,weekly}/${PN} ; do
                einfo "adjust $cronfile ..."
                sed -i "s/\(${PN}\)/\1 --default-exclude/" ${D}/$cronfile || die
        done
        # Remove execute flag for crontab files
        fperms a-x /etc/cron.d/${PN}
}
pkg_postinst() {
        use default-exclude || ewarn "without use default-exclude. all zfs filesystem will under all kind of snapshot."
        elog "use attribute com.sun:auto-snapshot to decide which filesystem to"
        elog "make snapshot. the rule is:"
        elog "zfs set com.sun:auto-snapshot=[true|false]"
        elog "or"
        elog "zfs set com.sun:auto-snapshot:<frequent|hourly|daily|weekly|monthly>=[true|false]"
        elog
        elog "ex."
        elog "# zfs set com.sun:auto-snapshot=false rpool"
        elog "# zfs set com.sun:auto-snapshot=true rpool"
        elog "# zfs set com.sun:auto-snapshot:weekly=true rpool"
        elog
        elog "for detail pls visit http://docs.oracle.com/cd/E19082-01/817-2271/ghzuk/"
}
Comment 10 Joe Chen 2013-05-17 22:47:20 UTC
by the way. fcron seems dosen't suport /etc/cron.d
usr should add cron job to fcron for make frequent snapshot work.
Comment 11 Joe Chen 2013-05-17 22:57:44 UTC
Created attachment 348570 [details]
ebuild support default-exclude by default
Comment 12 Richard Yao (RETIRED) gentoo-dev 2013-05-27 23:20:29 UTC
*** Bug 469840 has been marked as a duplicate of this bug. ***
Comment 13 Neil Bothwick 2013-07-09 23:39:33 UTC
This ebuild installs the man page to /share/man/man8/zfs-auto-snapshot.8 instead of /usr//share/man/man8/zfs-auto-snapshot.8, and it does not compress it.
Comment 14 Georgy Yakovlev archtester gentoo-dev 2018-03-10 07:36:20 UTC
fresh EAPI6 ebuild available here currently.
https://github.com/gyakovlev/gentoo-overlay/tree/master/sys-fs/zfs-auto-snapshot

I'm going to submit it to the main repo soon and maintain.
feel free to use above one meanwhile.
it does not remove executable bit, but it does enable exclude by default. 

fcron is also taken care of in pkg_postinst as s mere warning.
Comment 15 Larry the Git Cow gentoo-dev 2018-05-11 17:35:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d769a2585b1de6503acc1c1ecabb69623b7bd78

commit 5d769a2585b1de6503acc1c1ecabb69623b7bd78
Author:     Georgy Yakovlev <ya@sysdump.net>
AuthorDate: 2018-04-01 06:33:13 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-05-11 17:35:50 +0000

    sys-fs/zfs-auto-snapshot: new package
    
    Closes: https://bugs.gentoo.org/437636
    Closes: https://github.com/gentoo/gentoo/pull/7763
    Package-Manager: Portage-2.3.27, Repoman-2.3.9

 sys-fs/zfs-auto-snapshot/Manifest                  |  1 +
 sys-fs/zfs-auto-snapshot/files/README.gentoo       | 22 +++++++++
 sys-fs/zfs-auto-snapshot/metadata.xml              | 28 ++++++++++++
 .../zfs-auto-snapshot-1.2.4.ebuild                 | 52 ++++++++++++++++++++++
 .../zfs-auto-snapshot-9999.ebuild                  | 52 ++++++++++++++++++++++
 5 files changed, 155 insertions(+)