chiark / gitweb /
tg.sh: Check for read permissions of help files
authorBert Wesarg <bert.wesarg@googlemail.com>
Wed, 6 Aug 2008 08:02:51 +0000 (10:02 +0200)
committerPetr Baudis <pasky@suse.cz>
Sat, 9 Aug 2008 00:22:01 +0000 (02:22 +0200)
We currently check only for '-f' but we need to have read permissions as well.

And help files don't need the execution bit set.

[pb: Simplified test.]

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Makefile
tg.sh

index 2975f29..1352d03 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ install:: all
        install -d -m 755 "$(hooksdir)"
        install $(hooks_out) "$(hooksdir)"
        install -d -m 755 "$(sharedir)"
-       install $(help_out) "$(sharedir)"
+       install -m 644 $(help_out) "$(sharedir)"
 
 clean::
        rm -f tg $(commands_out) $(hooks_out) $(help_out)
diff --git a/tg.sh b/tg.sh
index 179f0de..ead2361 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -167,7 +167,7 @@ do_help()
 
                echo "TopGit v0.1 - A different patch queue manager"
                echo "Usage: tg ($cmds|help) ..."
-       elif [ -f "@sharedir@/tg-$1.txt" ] ; then
+       elif [ -r "@sharedir@/tg-$1.txt" ] ; then
                cat "@sharedir@/tg-$1.txt"
        else
                echo "`basename $0`: no help for $1" 1>&2