blob: 19400765c6333390c36b914317faf0c2bb71c9fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#! /bin/bash
#
# mail-shell -- mail out the shell
#
# usage: mail-shell -t tarball recipient
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
# Copyright (C) 1995-2008 by Chester Ramey
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PATH=/usr/ucb:/bin:/usr/bin:/usr/local/bin/gnu:/usr/local/bin:.
trap 'rm -f x?? ${UUFILE}' 0 1 2 3 6 15
prog=`basename $0`
TARFILE=bash.tar
VERS=2.05b
while getopts t: opt
do
case $opt in
t) TARFILE=$OPTARG ;;
*) echo usage: $prog [ -t tarfile ] recipient 1>&2
exit 1
esac
done
shift $(( $OPTIND - 1 ))
case "$TARFILE" in
bash-*.tar) VERS=${TARFILE%%.tar} ; VERS=${VERS#bash-} ;;
esac
GZFILE=${TARFILE}.gz
UUFILE=${GZFILE}.uu
if [ $# -ne 1 ] ; then
echo usage: $0 recipient
exit 1
fi
recip=$1
i=1
if [ ! -f ${TARFILE} ] && [ ! -f ${GZFILE} ]; then
echo "$prog: no file ${TARFILE}, aborting"
exit 1
fi
if [ ! -f ${GZFILE} ] ; then
echo "$prog: no gzipped tar file ${GZFILE}"
echo "$prog: gzipping ${TARFILE}"
gzip ${TARFILE}
fi
if [ ! -f ${UUFILE} ] ; then
echo "$prog: no uuencoded tar file ${UUFILE}"
echo "$prog: uuencoding ${GZFILE}"
uuencode ${GZFILE} < ${GZFILE} > ${UUFILE}
fi
files=$(echo x??)
if [ "$files" = 'x??' ] ; then
echo "$prog: no split of ${UUFILE} exists"
echo "$prog: splitting ${UUFILE}"
split ${UUFILE}
fi
count()
{
echo $#
}
parts=$(count x??)
if [ -x /usr/ucb/mail ]; then
MAIL=/usr/ucb/mail
elif [ -x /usr/ucb/Mail ]; then
MAIL=/usr/ucb/Mail
elif [ -x /usr/bin/mailx ]; then
MAIL=/usr/bin/mailx
elif [ -x /usr/bin/mail ]; then
MAIL=/usr/bin/mail
else
MAIL=/bin/mail
fi
$MAIL -s "bash-${VERS} shipment coming" $recip <<EOF
Hi. Here is version ${VERS} of bash. Expect $parts messages.
Each is part of a uuencoded tar file of the bash sources. When
you get all $parts messages, cat them all together into the file
${UUFILE}, and run uudecode on this file. You will have a
gzipped tar file named ${GZFILE}. gunzip it, cd into a source
directory (the tar archive extracts into its own directory), and
untar.
Chet
EOF
for file in x??
do
echo mailing part $i to $recip
/usr/ucb/mail -s "${UUFILE} part $i of $parts" $recip < $file
i=$(( $i + 1 ))
done
exit 0
|