diff options
Diffstat (limited to 'tests/shar-1.ok')
-rw-r--r-- | tests/shar-1.ok | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/tests/shar-1.ok b/tests/shar-1.ok new file mode 100644 index 0000000..1ef6510 --- /dev/null +++ b/tests/shar-1.ok @@ -0,0 +1,124 @@ +#!/bin/sh +# This is a shell archive (produced by GNU __PACKAGE_STRING__). +# To extract the files from this archive, save it to some FILE, remove +# everything before the `#!/bin/sh' line above, then type `sh FILE'. +# +lock_dir=_sh<PID> +# Made on ... +# Source directory was ... +# +# Existing files will *not* be overwritten, unless `-c' is specified. +# +# This shar contains: +# length mode name +# ------ ---------- ------------------------------------------ +# 15 -rw-r--r-- shar-1.in +# +MD5SUM=${MD5SUM-md5sum} +f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'` +test -n "${f}" && md5check=true || md5check=false +${md5check} || \ + echo 'Note: not verifying md5sums. Consider installing GNU coreutils.' +save_IFS="${IFS}" +IFS="${IFS}:" +gettext_dir=FAILED +locale_dir=FAILED +first_param="$1" +for dir in $PATH +do + if test "$gettext_dir" = FAILED && test -f $dir/gettext \ + && ($dir/gettext --version >/dev/null 2>&1) + then + case `$dir/gettext --version 2>&1 | sed 1q` in + *GNU*) gettext_dir=$dir ;; + esac + fi + if test "$locale_dir" = FAILED && test -f $dir/shar \ + && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) + then + locale_dir=`$dir/shar --print-text-domain-dir` + fi +done +IFS="$save_IFS" +if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED +then + echo=echo +else + TEXTDOMAINDIR=$locale_dir + export TEXTDOMAINDIR + TEXTDOMAIN=sharutils + export TEXTDOMAIN + echo="$gettext_dir/gettext -s" +fi +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null +then if (echo -n test; echo 1,2,3) | grep n >/dev/null + then shar_n= shar_c=' +' + else shar_n=-n shar_c= ; fi +else shar_n= shar_c='\c' ; fi +f=shar-touch.$$ +st1=200112312359.59 +st2=123123592001.59 +st2tr=123123592001.5 # old SysV 14-char limit +st3=1231235901 + +if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \ + test ! -f ${st1} && test -f ${f}; then + shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"' + +elif touch -am ${st2} ${f} >/dev/null 2>&1 && \ + test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then + shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"' + +elif touch -am ${st3} ${f} >/dev/null 2>&1 && \ + test ! -f ${st3} && test -f ${f}; then + shar_touch='touch -am $3$4$5$6$2 "$8"' + +else + shar_touch=: + echo + ${echo} 'WARNING: not restoring timestamps. Consider getting and' + ${echo} 'installing GNU `touch'\'', distributed in GNU coreutils...' + echo +fi +rm -f ${st1} ${st2} ${st2tr} ${st3} ${f} +# +if test ! -d ${lock_dir} +then : ; else ${echo} 'lock directory '${lock_dir}' exists' + exit 1 +fi +if mkdir ${lock_dir} +then ${echo} 'x - created lock directory `'${lock_dir}\''.' +else ${echo} 'x - failed to create lock directory `'${lock_dir}\''.' + exit 1 +fi +# ============= shar-1.in ============== +if test -f 'shar-1.in' && test "$first_param" != -c; then + ${echo} 'x -SKIPPING shar-1.in (file already exists)' +else +${echo} 'x - extracting shar-1.in (text)' + sed 's/^X//' << 'SHAR_EOF' > 'shar-1.in' && +This is a test +SHAR_EOF + (set <date> 'shar-1.in'; eval "$shar_touch") && + chmod 0644 'shar-1.in' +if test $? -ne 0 +then ${echo} 'restore of shar-1.in failed' +fi + if ${md5check} + then ( + ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'shar-1.in: MD5 check failed' + ) << \SHAR_EOF +ff22941336956098ae9a564289d1bf1b shar-1.in +SHAR_EOF + else +test `LC_ALL=C wc -c < 'shar-1.in'` -ne 15 && \ + ${echo} 'restoration warning: size of shar-1.in is not 15' + fi +fi +if rm -fr ${lock_dir} +then ${echo} 'x - removed lock directory `'${lock_dir}\''.' +else ${echo} 'x - failed to remove lock directory `'${lock_dir}\''.' + exit 1 +fi +exit 0 |