aboutsummaryrefslogtreecommitdiff
path: root/go-ipfs/install.sh
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /go-ipfs/install.sh
downloadcli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'go-ipfs/install.sh')
-rw-r--r--go-ipfs/install.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/go-ipfs/install.sh b/go-ipfs/install.sh
new file mode 100644
index 0000000..34c5d59
--- /dev/null
+++ b/go-ipfs/install.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Installation script for ipfs. It tries to move $bin in one of the
+# directories stored in $binpaths.
+
+INSTALL_DIR=$(dirname $0)
+
+bin="$INSTALL_DIR/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/ipfs" ; then
+ echo "Moved $bin to $binpath"
+ exit 0
+ else
+ if [ -d "$binpath" ] && [ ! -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