From 6be19b007009c9911ecb244694979cce1b417888 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 Dec 2013 15:57:41 -0400 Subject: [PATCH] Programs from Linux and OSX standalone builds can now be symlinked into a directory in PATH as an alternative installation method, and will use readlink to find where the build was unpacked. --- debian/changelog | 3 +++ doc/install/Linux_standalone.mdwn | 3 ++- ...__126____47__.local__47__bin_for_prebuilt_package.mdwn | 3 +++ standalone/linux/git-annex | 8 +++++++- standalone/linux/git-annex-shell | 8 +++++++- standalone/linux/git-annex-webapp | 8 +++++++- standalone/osx/git-annex.app/Contents/MacOS/git-annex | 8 +++++++- .../osx/git-annex.app/Contents/MacOS/git-annex-shell | 8 +++++++- .../osx/git-annex.app/Contents/MacOS/git-annex-webapp | 8 +++++++- 9 files changed, 50 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2fabec04f1..4efa2f08c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ git-annex (5.20131214) UNRELEASED; urgency=low * Add plumbing-level lookupkey and examinekey commands. * find --format: Added hashdirlower, hashdirmixed, keyname, and mtime format variables. + * Programs from Linux and OSX standalone builds can now be symlinked + into a directory in PATH as an alternative installation method, and will + use readlink to find where the build was unpacked. -- Joey Hess Sun, 15 Dec 2013 13:32:49 -0400 diff --git a/doc/install/Linux_standalone.mdwn b/doc/install/Linux_standalone.mdwn index e8df8adc08..0b626ad963 100644 --- a/doc/install/Linux_standalone.mdwn +++ b/doc/install/Linux_standalone.mdwn @@ -12,7 +12,8 @@ To use, just unpack the tarball, `cd git-annex.linux` and run `./runshell` as everything else included in the bundle. Alternatively, you can unpack the tarball, and add the directory to your -`PATH`. This lets you use `git annex`, without overriding your system's +`PATH`, or symlink the programs in the directory to a directory in your +PATH. This lets you use `git annex`, without overriding your system's own versions of git, etc. Warning: This is a last resort. Most Linux users should instead diff --git a/doc/todo/symlink_git-annex_binaries_to___126____47__.local__47__bin_for_prebuilt_package.mdwn b/doc/todo/symlink_git-annex_binaries_to___126____47__.local__47__bin_for_prebuilt_package.mdwn index 516e20f795..6271439243 100644 --- a/doc/todo/symlink_git-annex_binaries_to___126____47__.local__47__bin_for_prebuilt_package.mdwn +++ b/doc/todo/symlink_git-annex_binaries_to___126____47__.local__47__bin_for_prebuilt_package.mdwn @@ -17,3 +17,6 @@ Symlink this script to `~/.local/bin/git-annex`, `~/.local/bin/git-annex-shell` The script will detect the installation directory using `readlink`. Both absolute and relative links works. Then it starts the correct script depending on the basename of the link. It should be possible to link the `git-annex`, `git-annex-webapp` and `git-annex-shell` scripts instead if they used `readlink` to find out the location of the prebuilt package. + +> I've made the scripts look at readlink, so [[done]]. +> --[[Joey]] diff --git a/standalone/linux/git-annex b/standalone/linux/git-annex index d9ec8baa5c..27df466e42 100755 --- a/standalone/linux/git-annex +++ b/standalone/linux/git-annex @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1 diff --git a/standalone/linux/git-annex-shell b/standalone/linux/git-annex-shell index 44d5f694e8..a078955911 100755 --- a/standalone/linux/git-annex-shell +++ b/standalone/linux/git-annex-shell @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1 diff --git a/standalone/linux/git-annex-webapp b/standalone/linux/git-annex-webapp index 2698af9b50..acf2a5135e 100755 --- a/standalone/linux/git-annex-webapp +++ b/standalone/linux/git-annex-webapp @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1 diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex b/standalone/osx/git-annex.app/Contents/MacOS/git-annex index 452a46694a..bb82a2bd9f 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/git-annex +++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1 diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell index 9e8c0ad69e..29ebc25887 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell +++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1 diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp index 37a4984af6..7ff18bada3 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp +++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp @@ -1,5 +1,11 @@ #!/bin/sh -base="$(dirname "$0")" +link="$(readlink "$0")" || true +if [ -n "$link" ]; then + base="$(dirname "$link")" +else + base="$(dirname "$0")" +fi + if [ ! -d "$base" ]; then echo "** cannot find base directory (I seem to be $0)" >&2 exit 1