1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02:00
phorge-phorge/externals/cowsay/install.sh
epriestley c705c8011e Use PHP implementation of Cowsay for cowsay rule
Summary:
Ref T7785. Convert the Cowsay Remarkup rule to use a PHP implementation so we don't have to execute an external `cowsay` binary.

I removed some of the default ".cow" files that come with Cowsay because they:

  - include Perl code which we can not interpret; or
  - are primarily in-jokes or standalone visual puns or artwork rather than usable actors on the grand stage of cowsay; or
  - offended my delicate sensibilities.

Users can add new cows to `resources/cows/custom/` if they want to make new cows available.

I have included a majestic original artwork depicting the "Companion Cube" character from //Portal//.

Test Plan: {F802535}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9408, T7785

Differential Revision: https://secure.phabricator.com/D14100
2015-09-13 12:27:30 -07:00

92 lines
2.2 KiB
Bash
Executable file

#!/bin/sh
##
## install.sh
##
## Installation script for cowsay.
##
## $Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $
##
## This file is part of cowsay. (c) 1999 Tony Monroe.
##
rcs_id='$Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $'
filelist='cows'
cat <<DOG
===================
cowsay Installation
===================
Searching for useful perl executables...
DOG
backdoor=$1
pathdirs=`echo $PATH | tr : " "`
for p in $pathdirs; do
set $p/perl $p/perl5*
while [ ! -z "$1" ]; do
if [ -x "$1" ]; then
echo Found perl in $1
perls="$perls $1"
fi
shift
done
done
for perl in $perls; do
if $perl -MText::Wrap -e0 >/dev/null 2>&1; then
echo Found a good perl in $perl
goodperls="$goodperls $perl"
fi
done
echo The following perl executables will run cowsay:
echo $goodperls
echo I recommend the latest stable perl you can find.
set $goodperls
if [ -z "$1" ]; then
echo Ack! You do not have Perl 5 installed correctly!
echo Get thee to CPAN!
exit 1
fi
usethisperl=$1
echo I will be using $1 because I know it will work.
echo Now I need an installation prefix. I will use /usr/local unless
printf "you give me a better idea here: "
if [ -n "$backdoor" ]; then
prefix=$backdoor
printf "%s (specified on command line)\n" $prefix
else
read prefix
fi
PREFIX=${prefix:-/usr/local}
echo Okay, time to install this puppy.
echo s,%BANGPERL%,!$usethisperl,\; > install.pl
echo s,%PREFIX%,$PREFIX,\; >> install.pl
set -x
mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin)
$usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay
chmod a+x $PREFIX/bin/cowsay
ln -s cowsay $PREFIX/bin/cowthink
mkdir -p $PREFIX/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/man; mkdir $PREFIX/man/man1)
$usethisperl -p install.pl cowsay.1 > $PREFIX/man/man1/cowsay.1
chmod a+r $PREFIX/man/man1/cowsay.1
ln -s cowsay.1 $PREFIX/man/man1/cowthink.1
mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows)
tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -)
set +x
echo Okay, let us see if the install actually worked.
if [ ! -f $PREFIX/share/cows/default.cow ]; then
echo The default cow file did not make it across!
echo Ooops, it failed...sorry!
exit 1
fi
echo Installation complete! Enjoy the cows!