Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/externals/cowsay/install.sh
12240 views
1
#!/bin/sh
2
3
##
4
## install.sh
5
##
6
## Installation script for cowsay.
7
##
8
## $Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $
9
##
10
## This file is part of cowsay. (c) 1999 Tony Monroe.
11
##
12
13
rcs_id='$Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $'
14
15
filelist='cows'
16
17
cat <<DOG
18
===================
19
cowsay Installation
20
===================
21
22
Searching for useful perl executables...
23
DOG
24
25
backdoor=$1
26
27
pathdirs=`echo $PATH | tr : " "`
28
for p in $pathdirs; do
29
set $p/perl $p/perl5*
30
while [ ! -z "$1" ]; do
31
if [ -x "$1" ]; then
32
echo Found perl in $1
33
perls="$perls $1"
34
fi
35
shift
36
done
37
done
38
for perl in $perls; do
39
if $perl -MText::Wrap -e0 >/dev/null 2>&1; then
40
echo Found a good perl in $perl
41
goodperls="$goodperls $perl"
42
fi
43
done
44
echo The following perl executables will run cowsay:
45
echo $goodperls
46
echo I recommend the latest stable perl you can find.
47
set $goodperls
48
if [ -z "$1" ]; then
49
echo Ack! You do not have Perl 5 installed correctly!
50
echo Get thee to CPAN!
51
exit 1
52
fi
53
usethisperl=$1
54
echo I will be using $1 because I know it will work.
55
56
echo Now I need an installation prefix. I will use /usr/local unless
57
printf "you give me a better idea here: "
58
if [ -n "$backdoor" ]; then
59
prefix=$backdoor
60
printf "%s (specified on command line)\n" $prefix
61
else
62
read prefix
63
fi
64
65
PREFIX=${prefix:-/usr/local}
66
67
echo Okay, time to install this puppy.
68
69
echo s,%BANGPERL%,!$usethisperl,\; > install.pl
70
echo s,%PREFIX%,$PREFIX,\; >> install.pl
71
set -x
72
mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin)
73
$usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay
74
chmod a+x $PREFIX/bin/cowsay
75
ln -s cowsay $PREFIX/bin/cowthink
76
mkdir -p $PREFIX/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/man; mkdir $PREFIX/man/man1)
77
$usethisperl -p install.pl cowsay.1 > $PREFIX/man/man1/cowsay.1
78
chmod a+r $PREFIX/man/man1/cowsay.1
79
ln -s cowsay.1 $PREFIX/man/man1/cowthink.1
80
mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows)
81
tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -)
82
set +x
83
84
echo Okay, let us see if the install actually worked.
85
86
if [ ! -f $PREFIX/share/cows/default.cow ]; then
87
echo The default cow file did not make it across!
88
echo Ooops, it failed...sorry!
89
exit 1
90
fi
91
92
echo Installation complete! Enjoy the cows!
93
94