2 # Author: Hari Krishna Dara ( hari_vim at yahoo dot com )
3 # Last Change: 06-Jan-2004 @ 19:07
5 # - bash or ksh (tested on cygwin and MKS respectively).
6 # - Info Zip for the -z option to work (comes with linux/cygwin). Download for
8 # http://www.info-zip.org/
10 # Licence: This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License.
12 # See http://www.gnu.org/copyleft/gpl.txt
17 The input package is the name of the backup directory or the archive file(with
18 or without extension).
28 elif [ -r $1.zip ]; then
31 elif [ -r $1.tar.gz ]; then
33 inputPackage=$1.tar.gz
35 elif [ -r $1.tar.bz2 ]; then
37 inputPackage=$1.tar.bz2
39 elif [ -r $1.tar.Z ]; then
43 elif [ -r $1.tar ]; then
69 echo "$0: Unknown input package type."
75 echo "$0: No input package found for $1"
79 if [ $inputType = 'dir' ]; then
80 listCmd="find $inputPackage -type f -print | sed -e 's;^$1/*;;'"
82 if [ $verboseMode -ne 0 ]; then
85 copyCmd="$copyCmd -r $inputPackage/* ."
86 elif [ $inputType = 'zip' ]; then
87 listCmd="unzip -l -qq $inputPackage | awk 'BEGIN{OFS=\"\"}{\$1=\"\"; \$2=\"\"; \$3=\"\"; print \$0}'"
89 if [ $verboseMode -ne 1 ]; then
92 copyCmd="$copyCmd $inputPackage.zip"
93 elif [ $inputType = 'tar' ]; then
94 listCmd="tar -t${tarOpt}f $inputPackage"
96 if [ $verboseMode -ne 0 ]; then
99 copyCmd="$copyCmd -x${tarOpt}f $inputPackage"
102 if [ $verboseMode -eq 1 ]; then
103 echo "Opening files in Perforce for edit."
106 if [ $verboseMode -eq 0 ]; then
107 discardOutput=' > /dev/null'
110 eval $listCmd | p4 -x - edit $discardOutput
111 if [ $? -ne 0 ]; then
112 echo "$0: There was an error opening files in Perforce for edit."
113 echo "Make sure you are in the right directory and try again."
117 if [ $verboseMode -eq 1 ]; then
118 echo "$0: Copying files to the target directories."
122 if [ $? -ne 0 ]; then
123 echo "$0: Error copying files."