diff options
Diffstat (limited to 'source3/script/smbtar')
-rw-r--r-- | source3/script/smbtar | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/source3/script/smbtar b/source3/script/smbtar index fc032ed41c..cf3ff0ebe6 100644 --- a/source3/script/smbtar +++ b/source3/script/smbtar @@ -6,13 +6,19 @@ # and Ricky Poulten (ricky@logcam.co.uk) # # (May need to change shell to ksh for HPUX or OSF for better getopts) +# +# sandy nov 3 '98 added -a flag +# +# Richard Sharpe, added -c 'tarmode full' so that we back up all files to +# fix a bug in clitar when a patch was added to stop system and hidden files +# being backed up. case $0 in # when called by absolute path, assume smbclient is in the same directory /*) SMBCLIENT="`dirname $0`/smbclient";; - *) # edit this to show where your smbclient is - SMBCLIENT="./smbclient";; + *) # you may need to edit this to show where your smbclient is + SMBCLIENT="smbclient";; esac # These are the default values. You could fill them in if you know what @@ -24,7 +30,10 @@ username=$LOGNAME # Default: same user name as in *nix verbose="2>/dev/null" # Default: no echo to stdout log="-d 2" newer="" +newerarg="" blocksize="" +blocksizearg="" +clientargs="-c 'tarmode full'" tarcmd="c" tarargs="" cdcmd="\\" @@ -38,6 +47,7 @@ Function: backup/restore a Windows PC directories to a local tape file Options: (Description) (Default) -r Restore from tape file to PC Save from PC to tapefile -i Incremental mode Full backup mode + -a Reset archive bit mode Don't reset archive bit -v Verbose mode: echo command Don't echo anything -s <server> Specify PC Server $server -p <password> Specify PC Password $password @@ -54,7 +64,17 @@ Options: (Description) (Default) exit $ex } -while getopts rivl:b:d:N:s:p:x:u:Xt: c; do +# echo Params count: $# + +# DEC OSF AKA Digital UNIX does not seem to return a value in OPTIND if +# there are no command line params, so protect us against that ... +if [ $# = 0 ]; then + + Usage 2 "Please enter a command line parameter!" + +fi + +while getopts riavl:b:d:N:s:p:x:u:Xt: c; do case $c in r) # [r]estore to Windows (instead of the default "Save from Windows") tarcmd="x" @@ -62,6 +82,9 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do i) # [i]ncremental tarargs=${tarargs}g ;; + a) # [a]rchive + tarargs=${tarargs}a + ;; l) # specify [l]og file log="-d $OPTARG" case "$OPTARG" in @@ -76,7 +99,7 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do N) # compare with a file, test if [n]ewer if [ -f $OPTARG ]; then newer=$OPTARG - tarargs=${tarargs}N + newerarg="N" else echo >&2 $0: Warning, $OPTARG not found fi @@ -88,13 +111,13 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do server="$OPTARG" ;; b) # specify [b]locksize - blocksize="blocksize $OPTARG" + blocksize="$OPTARG" case "$OPTARG" in [0-9]*) ;; *) echo >&2 "$0: Error, block size not numeric: -b $OPTARG" exit 1 esac - tarargs=${tarargs}b + blocksizearg="b" ;; p) # specify [p]assword to use password="$OPTARG" @@ -134,8 +157,8 @@ if [ -z "$verbose" ]; then echo "blocksize is $blocksize" fi -eval $SMBCLIENT "'\\\\$server\\$service'" "'$password'" -U "'$username'" \ --E -N $log -D "'$cdcmd'" \ --T${tarcmd}${tarargs} $blocksize $newer $tapefile $* $verbose - +tarargs=${tarargs}${blocksizearg}${newerarg} +eval $SMBCLIENT "'\\\\$server\\$service'" "'$password'" -U "'$username'" \ +-E -N $log -D "'$cdcmd'" ${clientargs} \ +-T${tarcmd}${tarargs} $blocksize $newer $tapefile '${1+"$@"}' $verbose |