kubo/cmd/ipfs/dist/install.sh
Stephan Kulla 465e4b9f75 install.sh: Remove -t parameter from mv command.
Return to the old definition of the mv command since there is no `-t`
parameter in `mv` of BSD. Cf.
https://www.freebsd.org/cgi/man.cgi?query=mv&sektion=1

License: MIT
Signed-off-by: Stephan Kulla <git.mail@kulla.me>
2016-09-08 16:55:07 +02:00

35 lines
818 B
Bash
Executable File

#!/bin/sh
#
# Installation script for ipfs. It tries to move $bin in one of the
# directories stored in $binpaths.
bin=ipfs
binpaths="/usr/local/bin /usr/bin"
# This variable contains a nonzero length string in case the script fails
# because of missing write permissions.
is_write_perm_missing=""
for binpath in $binpaths; do
if mv "$bin" "$binpath/$bin" 2> /dev/null; then
echo "Moved $bin to $binpath"
exit 0
else
if [ -d "$binpath" -a ! -w "$binpath" ]; then
is_write_perm_missing=1
fi
fi
done
echo "We cannot install $bin in one of the directories $binpaths"
if [ -n "$is_write_perm_missing" ]; then
echo "It seems that we do not have the necessary write permissions."
echo "Perhaps try running this script as a privileged user:"
echo
echo " sudo $0"
echo
fi
exit 1