adding man page, sample conf, makefile
authorStefan Huber <shuber2@gmx.at>
Sun, 13 May 2012 21:10:07 +0000 (23:10 +0200)
committerStefan Huber <shuber2@gmx.at>
Sun, 13 May 2012 21:12:50 +0000 (23:12 +0200)
Makefile [new file with mode: 0644]
shbackup
shbackup.1 [new file with mode: 0644]
shbackup.conf [new file with mode: 0644]
shbackup.docbook [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..2365971
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+PREFIX=/usr
+# Where the script binary should go
+BINPATH = $(PREFIX)/bin
+# Where the manpage should go
+MANPATH = $(PREFIX)/share/man
+CONFFILE = /etc/shbackup.conf
+
+######################################################################
+
+all: 
+
+install: all
+       install -m 0755 shbackup $(BINPATH)/shbackup
+       install -m 0644 shbackup.conf $(CONFFILE)
+       install -m 0644 shbackup.1 $(MANPATH)/man1/shbackup.1
+
index ca00a1305bf04a3d6178cbd7ea1c24c244573a8b..cc323c50f71fe37ad77a419188c589ae77a78cc2 100755 (executable)
--- a/shbackup
+++ b/shbackup
@@ -65,7 +65,7 @@ class Config:
         def __str__(self):
             return "[name: " + self.name + ", dirs: " + str(self.dirs) + "]"
 
-    formats = ["tar.gz", "tar.bz2", "tar.xz" ]
+    formats = ["tar", "tar.gz", "tar.bz2", "tar.xz" ]
 
     # Filename where checksum of config is saved
     checksumfn = "checksum"
@@ -380,12 +380,12 @@ def printUsage():
     print("  prune                      prune outdated/old backups")
     print("")
     print("Options:")
-    print("  -C <configfile>            use given configuration file")
+    print("  -h, --help                 print this usage text")
+    print("  -c, --conf <configfile>    use given configuration file")
     print("                             default: /etc/shbackup.conf")
-    print("  -m, --mode <mode>          override mode: full, diff, or incr")
     print("  -e, --epoch <epoch>        force to create backup for given epoch:")
     print("                             year, month, week, day, hour, sporadic")
-    print("  -h, --help                 print this usage text")
+    print("  -m, --mode <mode>          override mode: full, diff, or incr")
 
 
 if __name__ == "__main__":
@@ -404,7 +404,7 @@ if __name__ == "__main__":
             printUsage()
             exit(0)
 
-        elif opt in ["-C", "--config"]:
+        elif opt in ["-c", "--conf"]:
             i += 1
             conffn = sys.argv[i]
 
diff --git a/shbackup.1 b/shbackup.1
new file mode 100644 (file)
index 0000000..4788fe3
--- /dev/null
@@ -0,0 +1,60 @@
+'\" -*- coding: us-ascii -*-
+.if \n(.g .ds T< \\FC
+.if \n(.g .ds T> \\F[\n[.fam]]
+.de URL
+\\$2 \(la\\$1\(ra\\$3
+..
+.if \n(.g .mso www.tmac
+.TH shbackup 1 2012-05-13 "" ""
+.SH NAME
+shbackup \- a simple backup solution
+.SH SYNOPSIS
+'nh
+.fi
+.ad l
+\fBshbackup\fR \kx
+.if (\nx>(\n(.l/2)) .nr x (\n(.l/5)
+'in \n(.iu+\nxu
+[options] {\fIcommand\fR}
+'in \n(.iu-\nxu
+.ad b
+'hy
+.SH DESCRIPTION
+\fBshbackup\fR is a simple backup solution
+which packs user-defined file sets with tar. Each
+backup belongs to an epoch, which can be year, month,
+week, day, hour or sporadic. The backup can be made
+either full, differential or incremental.
+\fBshbackup\fR takes care for pruning old
+backups. The user defines for each epoch the number of
+backups to keep, except for 'sporadic'. Sporadic
+backups need to be removed manually.
+.SH COMMANDS
+.TP 
+\*(T<\fBbackup\fR\*(T>
+Make a backup
+.TP 
+\*(T<\fBlist\fR\*(T>
+List all backups
+.TP 
+\*(T<\fBprune\fR\*(T>
+Prune outdated/stale backups
+.SH OPTIONS
+.TP 
+\*(T<\fB\-h, \-\-help\fR\*(T>
+Print out a help summary.
+.TP 
+\*(T<\fB\-c, \-\-conf FILE\fR\*(T>
+Use given configuration file instead of
+/etc/shbackup.conf.
+.TP 
+\*(T<\fB\-e, \-\-epoch EPOCH\fR\*(T>
+Do not determine epoch automatically, but
+use EPOCH, which can be year, month,
+week, day, hour, sporadic.
+.TP 
+\*(T<\fB\-m, \-\-mode MODE\fR\*(T>
+Instead of configured mode use MODE,
+which can be full, diff or incr.
+.SH AUTHOR
+Stefan HUBER
diff --git a/shbackup.conf b/shbackup.conf
new file mode 100644 (file)
index 0000000..fb293cf
--- /dev/null
@@ -0,0 +1,43 @@
+[destination]
+# Where shbackup stores the backups and other stuff
+directory = ./backup
+# Which format should be used by tar?
+# One of tar, tar.gz, tar.bz2, tar.xz
+format = tar.gz
+
+
+[history]
+# keepEPOCH contains the number of backups that are kept for that particular
+# epoch, where EPOCH can be year, month, week, day, or hour. modeEPOCH defines
+# the backup mode for that particular epoch. Mode can be full, diff or incr.
+keephour = 1
+keepday  = 14
+keepweek = 2
+keepmonth = 12
+keepyear  = 2
+modehour = incr
+modeday = diff
+modeweek = full
+modemonth = full
+modeyear = full
+
+
+[input]
+# exclude* contains --exclude patterns for tar. Files matching the pattern are
+# not included into the backup.
+exclude1 = */tmp/*
+exclude2 = */[Cc]cache/*
+exclude3 = */log*
+exclude5 = /home/*/.wine/*
+exclude7 = /lib/layman/*
+
+# A file set called 'home'. Each file set is packed into one archive using tar.
+[set home]
+# dir* is one directory which belongs to this file set.
+dir1 = /home/username/
+dir2 = /media/books/
+
+[set conf]
+dir1 = /etc/
+
+
diff --git a/shbackup.docbook b/shbackup.docbook
new file mode 100644 (file)
index 0000000..73b2fe8
--- /dev/null
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+"file:///usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd"
+[]>
+
+<refentry>
+
+       <refentryinfo>
+               <author>
+                       <firstname>Stefan</firstname>
+                       <surname>Huber</surname>
+               </author>
+               <date>2012-05-13</date>
+       </refentryinfo>
+
+       <refmeta>
+               <refentrytitle>shbackup</refentrytitle>
+               <manvolnum>1</manvolnum>
+       </refmeta>
+
+       <refnamediv>
+               <refname>shbackup</refname> 
+               <refpurpose>a simple backup solution</refpurpose>
+       </refnamediv>
+
+       <refsynopsisdiv>
+               <cmdsynopsis>
+                       <command>shbackup</command>
+                       <arg>options</arg>
+                       <arg choice="req"><replaceable>command</replaceable></arg>
+               </cmdsynopsis>
+       </refsynopsisdiv>
+  
+       <refsect1>
+               <title>DESCRIPTION</title>
+       
+               <para>
+                       <command>shbackup</command> is a simple backup solution
+                       which packs user-defined file sets with tar. Each
+                       backup belongs to an epoch, which can be year, month,
+                       week, day, hour or sporadic. The backup can be made
+                       either full, differential or incremental.
+
+                       <command>shbackup</command> takes care for pruning old
+                       backups. The user defines for each epoch the number of
+                       backups to keep, except for 'sporadic'. Sporadic
+                       backups need to be removed manually.
+               </para>
+       
+       </refsect1>
+
+       <refsect1>
+               <title>COMMANDS</title>
+       
+               <variablelist>
+       
+               <varlistentry>
+                       <term><option>backup</option></term>
+                       <listitem>
+                               <para>Make a backup</para>
+                       </listitem>
+               </varlistentry>
+
+               <varlistentry>
+                       <term><option>list</option></term>
+                       <listitem>
+                               <para>List all backups</para>
+                       </listitem>
+               </varlistentry>
+
+               <varlistentry>
+                       <term><option>prune</option></term>
+                       <listitem>
+                               <para>Prune outdated/stale backups</para>
+                       </listitem>
+               </varlistentry>
+
+               </variablelist>
+       </refsect1>
+  
+
+       <refsect1>
+               <title>OPTIONS</title>
+       
+               <variablelist>
+       
+               <varlistentry>
+                       <term><option>-h, --help</option></term>
+                       <listitem>
+                               <para>Print out a help summary.</para>
+                       </listitem>
+               </varlistentry>
+       
+               <varlistentry>
+                       <term><option>-c, --conf FILE</option></term>
+                       <listitem>
+                               <para>Use given configuration file instead of
+                                       /etc/shbackup.conf.</para>
+                       </listitem>
+               </varlistentry>
+       
+               <varlistentry>
+                       <term><option>-e, --epoch EPOCH</option></term>
+                       <listitem>
+                               <para>Do not determine epoch automatically, but
+                                       use EPOCH, which can be year, month,
+                                       week, day, hour, sporadic.</para>
+                       </listitem>
+               </varlistentry> 
+       
+               <varlistentry>
+                       <term><option>-m, --mode MODE</option></term>
+                       <listitem>
+                               <para>Instead of configured mode use MODE,
+                                       which can be full, diff or incr.</para>
+                       </listitem>
+               </varlistentry>
+
+       </variablelist>
+       </refsect1>
+
+       <refsect1>
+               <title>AUTHOR</title>
+       
+               <para>
+                       Stefan HUBER
+               </para>
+       </refsect1>
+</refentry>