1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-25 12:24:20 +01:00

Install script exits on error

It always removes the temporary file
This commit is contained in:
Frederik Hanghøj Iversen 2014-02-28 13:26:17 +01:00 committed by fredefox
parent 1b48475623
commit 7b900401b6

View File

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