1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-10 10:04:21 +01:00
pirate-get/install.sh
Frederik Hanghøj Iversen 7b900401b6 Install script exits on error
It always removes the temporary file
2014-03-03 16:59:35 +01:00

24 lines
427 B
Bash
Executable File

#!/usr/bin/env sh
set -e
TMP=$(mktemp pirate-get-XXX)
{
if [ $(which python2.7) ]
then
echo "#!/usr/bin/env python2.7" > "$TMP"
elif [ `which python2` ]
then
echo "#!/usr/bin/env python2" > "$TMP"
else
echo "#!/usr/bin/env python" > "$TMP"
fi
sed 1d $(dirname $0)/pirate-get.py >> "$TMP"
cp "$TMP" /usr/bin/pirate-get &&
chmod +x /usr/bin/pirate-get &&
chmod 755 /usr/bin/pirate-get &&
rm $TMP
} || rm $TMP