File: dar_par_create.duc

package info (click to toggle)
dar 2.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,068 kB
  • sloc: cpp: 86,310; sh: 6,996; ansic: 895; makefile: 502; python: 242; csh: 115; perl: 43; sed: 16
file content (44 lines) | stat: -rwxr-xr-x 1,219 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

###
#
# this script is to be launched on dar command line when creating an archive with -s option (slicing)
# you need to run this script from dar, adding the following argument on command-line
#
#     -E "dar_par_create.duc %p %b %N %e %c 20"
#
# note that 20 means 20% of redundancy, tune it to your needs
#
###
#
# if you prefer you can also add the line above in your the $HOME/.darrc file
# under the create: conditional statement (see dar man page)
#
###
#
# usage par_script slice.basename slice.number extension level
# generates a Parchive redundancy file from the slice file
#
###

if [ "$1" = "" -a "$2" = "" -a "$3" = "" -a "$4" = "" -a "$6" = "" ]; then
  echo "usage: $0 <path> <basename> <slice number> <extension> <context(not used)> <redundancy ratio (%)>"
  echo "$0 builds Parchive redundancy file for the given slice"
  exit 1
fi

# change according to you need
PAR=par2

echo "creating PAR file for file $1/$2.$3.dar ..."

mask="$1/$2.$3.dar.*par2"
need_cleanup=`ls -l $mask 2> /dev/null | wc -l`

if [ $need_cleanup -gt 0 ] ; then
    echo "cleaning up old par2 files for slice $1/$2.$3.dar"
    rm -f $mask
fi

exec $PAR c -r$6 -n1 "$1/$2.$3.$4"
# script returned code it those of par