improve the cleanup script to actually have a chance of working
[debian/tar] / cleanup-script.sh
1 #!/bin/sh
2 #
3 #       clean upstream source to achieve DFSG compliance
4 #       Copyright 2009 by Bdale Garbee.  GPL v2 or any later version.
5 #
6
7 rm -rf doc
8
9 # This is a shell archive (produced by GNU sharutils 4.6.3).
10 # To extract the files from this archive, save it to some FILE, remove
11 # everything before the `#!/bin/sh' line above, then type `sh FILE'.
12 #
13 lock_dir=_sh04253
14 # Made on 2009-02-24 22:24 MST by <bdale@rover>.
15 # Source directory was `/home/bdale/debian/tar'.
16 #
17 # Existing files will *not* be overwritten, unless `-c' is specified.
18 #
19 # This shar contains:
20 # length mode       name
21 # ------ ---------- ------------------------------------------
22 #     51 -rw-r--r-- doc/Makefile
23 #     51 -rw-r--r-- doc/Makefile.in
24 #    571 -rw-r--r-- doc/README
25 #
26 MD5SUM=${MD5SUM-md5sum}
27 f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
28 test -n "${f}" && md5check=true || md5check=false
29 ${md5check} || \
30   echo 'Note: not verifying md5sums.  Consider installing GNU coreutils.'
31 save_IFS="${IFS}"
32 IFS="${IFS}:"
33 gettext_dir=FAILED
34 locale_dir=FAILED
35 first_param="$1"
36 for dir in $PATH
37 do
38   if test "$gettext_dir" = FAILED && test -f $dir/gettext \
39      && ($dir/gettext --version >/dev/null 2>&1)
40   then
41     case `$dir/gettext --version 2>&1 | sed 1q` in
42       *GNU*) gettext_dir=$dir ;;
43     esac
44   fi
45   if test "$locale_dir" = FAILED && test -f $dir/shar \
46      && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
47   then
48     locale_dir=`$dir/shar --print-text-domain-dir`
49   fi
50 done
51 IFS="$save_IFS"
52 if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
53 then
54   echo=echo
55 else
56   TEXTDOMAINDIR=$locale_dir
57   export TEXTDOMAINDIR
58   TEXTDOMAIN=sharutils
59   export TEXTDOMAIN
60   echo="$gettext_dir/gettext -s"
61 fi
62 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
63 then if (echo -n test; echo 1,2,3) | grep n >/dev/null
64      then shar_n= shar_c='
65 '
66      else shar_n=-n shar_c= ; fi
67 else shar_n= shar_c='\c' ; fi
68 f=shar-touch.$$
69 st1=200112312359.59
70 st2=123123592001.59
71 st2tr=123123592001.5 # old SysV 14-char limit
72 st3=1231235901
73
74 if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
75    test ! -f ${st1} && test -f ${f}; then
76   shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
77
78 elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
79    test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
80   shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
81
82 elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
83    test ! -f ${st3} && test -f ${f}; then
84   shar_touch='touch -am $3$4$5$6$2 "$8"'
85
86 else
87   shar_touch=:
88   echo
89   ${echo} 'WARNING: not restoring timestamps.  Consider getting and'
90   ${echo} 'installing GNU `touch'\'', distributed in GNU coreutils...'
91   echo
92 fi
93 rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
94 #
95 if test ! -d ${lock_dir}
96 then : ; else ${echo} 'lock directory '${lock_dir}' exists'
97   exit 1
98 fi
99 if mkdir ${lock_dir}
100 then ${echo} 'x - created lock directory `'${lock_dir}\''.'
101 else ${echo} 'x - failed to create lock directory `'${lock_dir}\''.'
102   exit 1
103 fi
104 # ============= doc/Makefile ==============
105 if test ! -d 'doc'; then
106   mkdir 'doc'
107 if test $? -eq 0
108 then ${echo} 'x - created directory `doc'\''.'
109 else ${echo} 'x - failed to create directory `doc'\''.'
110   exit 1
111 fi
112 fi
113 if test -f 'doc/Makefile' && test "$first_param" != -c; then
114   ${echo} 'x -SKIPPING doc/Makefile (file already exists)'
115 else
116 ${echo} 'x - extracting doc/Makefile (text)'
117   sed 's/^X//' << 'SHAR_EOF' > 'doc/Makefile' &&
118 all:
119 X
120 install:
121 X
122 check:
123 X
124 distclean:
125 X       rm -f Makefile
126 SHAR_EOF
127   (set 20 09 02 24 22 23 00 'doc/Makefile'; eval "$shar_touch") &&
128   chmod 0644 'doc/Makefile'
129 if test $? -ne 0
130 then ${echo} 'restore of doc/Makefile failed'
131 fi
132   if ${md5check}
133   then (
134        ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'doc/Makefile: MD5 check failed'
135        ) << SHAR_EOF
136 426042328bcada50997fe11fff91ca61  doc/Makefile
137 SHAR_EOF
138   else
139 test `LC_ALL=C wc -c < 'doc/Makefile'` -ne 51 && \
140   ${echo} 'restoration warning:  size of doc/Makefile is not 51'
141   fi
142 fi
143 # ============= doc/Makefile.in ==============
144 if test ! -d 'doc'; then
145   mkdir 'doc'
146 if test $? -eq 0
147 then ${echo} 'x - created directory `doc'\''.'
148 else ${echo} 'x - failed to create directory `doc'\''.'
149   exit 1
150 fi
151 fi
152 if test -f 'doc/Makefile.in' && test "$first_param" != -c; then
153   ${echo} 'x -SKIPPING doc/Makefile.in (file already exists)'
154 else
155 ${echo} 'x - extracting doc/Makefile.in (text)'
156   sed 's/^X//' << 'SHAR_EOF' > 'doc/Makefile.in' &&
157 all:
158 X
159 install:
160 X
161 check:
162 X
163 distclean:
164 X       rm -f Makefile
165 SHAR_EOF
166   (set 20 09 02 24 22 23 00 'doc/Makefile.in'; eval "$shar_touch") &&
167   chmod 0644 'doc/Makefile.in'
168 if test $? -ne 0
169 then ${echo} 'restore of doc/Makefile.in failed'
170 fi
171   if ${md5check}
172   then (
173        ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'doc/Makefile.in: MD5 check failed'
174        ) << SHAR_EOF
175 426042328bcada50997fe11fff91ca61  doc/Makefile.in
176 SHAR_EOF
177   else
178 test `LC_ALL=C wc -c < 'doc/Makefile.in'` -ne 51 && \
179   ${echo} 'restoration warning:  size of doc/Makefile.in is not 51'
180   fi
181 fi
182 # ============= doc/README ==============
183 if test -f 'doc/README' && test "$first_param" != -c; then
184   ${echo} 'x -SKIPPING doc/README (file already exists)'
185 else
186 ${echo} 'x - extracting doc/README (text)'
187   sed 's/^X//' << 'SHAR_EOF' > 'doc/README' &&
188 Unfortunately, the info document describing tar is licensed under the GFDL with
189 invariant cover texts, which violates the Debian Free Software Guidelines.  As
190 a result, the info documentation for tar has been completely removed from the
191 Debian package.  Instead, we deliver a tar man page that was created from
192 scratch for the Debian project.
193 X
194 If you want to read the complete documentation for GNU tar, please either
195 install the 'tar-doc' package from Debian's non-free repository, or refer to
196 the online version at <http://www.gnu.org/software/tar/manual/index.html>.
197 X
198 SHAR_EOF
199   (set 20 09 02 24 22 23 00 'doc/README'; eval "$shar_touch") &&
200   chmod 0644 'doc/README'
201 if test $? -ne 0
202 then ${echo} 'restore of doc/README failed'
203 fi
204   if ${md5check}
205   then (
206        ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'doc/README: MD5 check failed'
207        ) << SHAR_EOF
208 2ca08c08d4bff8e2dcf2b33f717512ef  doc/README
209 SHAR_EOF
210   else
211 test `LC_ALL=C wc -c < 'doc/README'` -ne 571 && \
212   ${echo} 'restoration warning:  size of doc/README is not 571'
213   fi
214 fi
215 if rm -fr ${lock_dir}
216 then ${echo} 'x - removed lock directory `'${lock_dir}\''.'
217 else ${echo} 'x - failed to remove lock directory `'${lock_dir}\''.'
218   exit 1
219 fi
220 exit 0