enable output of tar
[sitarba.git] / shbackup
index ca00a1305bf04a3d6178cbd7ea1c24c244573a8b..db2c66125b3f09514f21f809dbaf842e86270ddb 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"
@@ -248,28 +248,12 @@ class BackupManager:
             taropts += ["--exclude", pat]
 
         tarargs = [tarpath] + taropts + ["-f", fsfn] + fileset.dirs
-        print("tarargs: ", tarargs)
-        tarp = subprocess.Popen( tarargs, \
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
-        while tarp.poll():
-            l = tarp.stdout.readline()
-            if len(l) > 0:
-                print(l.decode(), end="")
-            l = tarp.stderr.readline()
-            if len(l) > 0:
-                print(l.decode(), end="")
-
-        for l in tarp.stdout.readlines():
-            print(l.decode(), end="")
-
-        for l in tarp.stderr.readlines():
-            print(l.decode(), end="")
+        #print("tarargs: ", tarargs)
+        tarp = subprocess.Popen( tarargs )
 
         rett = tarp.wait()
         if rett != 0:
             print(tarpath + " returned with exit status " + str(rett) + ":")
-            print( tarp.stderr.read().decode() )
 
 
     def backup(self, epoch=None, mode=None):
@@ -380,12 +364,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 +388,7 @@ if __name__ == "__main__":
             printUsage()
             exit(0)
 
-        elif opt in ["-C", "--config"]:
+        elif opt in ["-c", "--conf"]:
             i += 1
             conffn = sys.argv[i]