1#!/bin/sh
2#
3#   Copyright (c) International Business Machines  Corp., 2001
4#
5#   This program is free software;  you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation; either version 2 of the License, or
8#   (at your option) any later version.
9#
10#   This program is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13#   the GNU General Public License for more details.
14#
15#   You should have received a copy of the GNU General Public License
16#   along with this program;  if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18#
19#
20#   FILE: generate.sh
21#
22#   PURPOSE: Creates data_dir for use in network file transfer tests.
23#
24#   AUTHOR: Robbie Williamson (robbiew@us.ibm.com)
25#
26############################################################################
27
28small_file=ascii.sm
29medium_file=ascii.med
30large_file=ascii.lg
31jumbo_file=ascii.jmb
32jumbo_size=1600020
33large_size=80020
34medium_size=4020
35small_size=220
36
37set -e
38
39if [ -z "$abs_top_srcdir" ] ; then
40	echo "The variable \`abs_top_srcdir', must be defined." >&2
41	exit 1
42else
43	make_file="$abs_top_srcdir/tools/make-file.sh"
44	if [ ! -x "$make_file" ] ; then
45		echo "$make_file isn't an executable file" >&2
46		exit 1
47	fi
48fi
49
50"$make_file" "$small_file" $small_size
51"$make_file" "$medium_file" $medium_size
52"$make_file" "$large_file" $large_size
53"$make_file" "$jumbo_file" $jumbo_size
54
55if [ ! -e "bin.sm" ] ; then
56	cnt=0
57	while [ $cnt -lt 5 ] ; do
58		gzip -1 -c ascii.sm >> "bin.sm"
59		cnt=$(($cnt + 1))
60	done
61fi
62
63genfile() {
64	local input="$1" output="$2"
65	local cnt=19
66
67	[ -e "$output" ] && return $?
68
69	while [ $cnt -ge 0 ] ; do
70		cat "$input" >> "$output"
71		cnt=$(($cnt-1))
72	done
73}
74
75genfile bin.sm bin.med
76genfile bin.med bin.lg
77genfile bin.lg bin.jmb
78
79chmod 666 bin.*
80