Fey N Install
Fey N Install
Fey N Install
/bin/sh
# installation script for FeynArts, FormCalc, and LoopTools
# last modified 25 May 16 th
# if started from within a directory DIR (e.g. the user's
# home directory), the final directory structure will be:
# DIR/$fadir
# DIR/FeynArts (link to $fadir)
# DIR/$fcdir
# DIR/FormCalc (link to $fcdir)
# DIR/$ltdir
# DIR/LoopTools (link to $ltdir)
fadir=FeynArts-3.9
fatar=$fadir.tar.gz
fcdir=FormCalc-9.4
fctar=$fcdir.tar.gz
ltdir=LoopTools-2.13
lttar=$ltdir.tar.gz
cwd="`pwd`"
id=`id -u`
system="`uname -s`"
unset http_proxy
dltool() {
wget="curl --location --remote-name --user-agent FeynInstall"
$wget --version > /dev/null 2>&1 && return
wget="wget --user-agent FeynInstall"
$wget --version > /dev/null 2>&1 && return
echo "Please install either curl or wget"
exit 1
}
dltool
mathcmd=math
shopt -s nullglob > /dev/null 2>&1
set --
case "$system" in
Darwin)
mathcmd=MathKernel
set -- /Applications/Mathematica*/Contents/MacOS \
$HOME/Desktop/Mathematica*/Contents/MacOS ;;
CYG*)
set -- "$PROGRAMFILES/Wolfram Research/Mathematica"/* ;;
esac
for dir in "$@" ; do
path="$dir:$path"
done
mathcmd="`PATH=\"$PATH:$path\" which $mathcmd`"
if "$mathcmd" -run "Print[7 673]; Exit" < /dev/null | grep 4711 > /dev/null ; th
en
eval -- `"$mathcmd" -run '
org[$Failed] = "";
org[file_] := File /. FileInformation[file];
Print["fa=\"" <> org[System\`Private\`FindFile["FeynArts\`"]] <> "\""];
Print["fc=\"" <> org[System\`Private\`FindFile["FormCalc\`"]] <> "\""];
Print["lt=\"" <> org[System\`Private\`FindFile["LoopTools"]] <> "\""];
Exit[]
' < /dev/null | tail -2 | tr '\r' ' '`
ask() {
:
}
ask1() {
dir="$cwd/$5"
test "$dir/$3" -ef "$4" && return
echo "Do you want to add $dir to Mathematica's \$Path,"
echo "such that $1 can be loaded with just '$2'?"
read yesno
case "$yesno" in
[yY]*)
case "$system" in
CYG*) dir=`cygpath -w "$dir"`
mmapath="$mmapath, \"${dir//\\/\\\\}\"" ;;
*) mmapath="$mmapath, \"$dir\"" ;;
esac ;;
esac
echo ""
}
ask$ifa FeynArts "<< FeynArts\`" FeynArts.m "$fa" FeynArts
ask$ifc FormCalc "<< FormCalc\`" FormCalc.m "$fc" FormCalc
ask$ilt LoopTools "Install[\"LoopTools\"]" LoopTools "$lt" LoopTools/*/bin
test -n "$mmapath" && "$mathcmd" -run "mmapath={0$mmapath}" -run '
prefdir = ToFileName[$PreferencesDirectory, "Kernel"];
If[ FileType[prefdir] === None, CreateDirectory[prefdir] ];
hh = OpenAppend[ToFileName[prefdir, "init.m"]];
Block[ {home = ToFileName[$HomeDirectory], $HomeDirectory, ToFileName},
striphome[dir_] := If[ # == dir, #, ToFileName[$HomeDirectory, #] ]& @
StringReplace[dir, home -> ""];
SetAttributes[Write, HoldRest];
With[ {path = striphome/@ Rest[mmapath]},
Write[hh, $Path = Join[path, $Path]] ]
];
Print["Modified ", Close[hh]];
Exit[]
' < /dev/null | tail -1
else
echo "Cannot run Mathematica (license problems?)."
echo "Skipping modification of \$Path."
fi