replace <<EOF type constructs with multi-line echo

This compensates for an selinux bug reported on #gitolite by John Hawley
(warthog9).  sh/bash uses a tempfile to do this, which in turn causes
some problems in selinux; I really don't [need to] know more than that.

*Technically* this is a bug in selinux/policy, and would qualify for an
entry in "nagp"... but:

(1) the changes are small and localised
(2) the problem makes gitolite -- currently -- unusable with selinux,
    and what use is a security program which can't run under selinux
    (regardless of whose fault it is)?

and finally

(3) if I can't break my own rules for one of my most high-profile users
    then what's the point of owning the code?

:-)

----

Implementation notes: I've only done this for code that is likely/meant
to be used in production

I also slip-streamed in a URL fix (from when I changed all the online
document rendering)
This commit is contained in:
Sitaram Chamarty 2012-02-14 06:36:02 +05:30
parent 01e789a1e1
commit 6baa57b5a0
3 changed files with 10 additions and 10 deletions

View file

@ -37,11 +37,11 @@
[ -f $HOME/gl-adc-pre-help.txt ] && cat $HOME/gl-adc-pre-help.txt [ -f $HOME/gl-adc-pre-help.txt ] && cat $HOME/gl-adc-pre-help.txt
# default help text # default help text
cat <<EOF echo "
The following adc's (admin-defined commands) are available at this site. The following adc's (admin-defined commands) are available at this site.
creating a "fork" of a repo: creating a 'fork' of a repo:
the 'fork' adc forks a repo that you have read access to, to a repo that the 'fork' adc forks a repo that you have read access to, to a repo that
you have create rights to you have create rights to
@ -51,13 +51,13 @@ deleting/trashing repos:
repo before you can 'rm' it. repo before you can 'rm' it.
A different scheme of handling this is to use 'trash' to move the repo to A different scheme of handling this is to use 'trash' to move the repo to
a "trashcan" area. You can then 'list-trash' to see what you have, and a 'trashcan' area. You can then 'list-trash' to see what you have, and
you can then 'restore' whichever repo you need to bring back. you can then 'restore' whichever repo you need to bring back.
More details can be found at: More details can be found in contrib/adc/repo-deletion.mkd (or online at
http://sitaramc.github.com/gitolite/contrib/adc/repo-deletion.html http://sitaramc.github.com/gitolite/wild_repodel.html)
EOF "
# post # post
[ -f $HOME/gl-adc-post-help.txt ] && cat $HOME/gl-adc-post-help.txt [ -f $HOME/gl-adc-post-help.txt ] && cat $HOME/gl-adc-post-help.txt

View file

@ -9,7 +9,7 @@ die() { echo "$@" >&2; exit 1; }
GL_BINDIR=` perl -ne 'print($1), exit if /^command="(.+?)\/gl-(time|auth-command) /' < $HOME/.ssh/authorized_keys` GL_BINDIR=` perl -ne 'print($1), exit if /^command="(.+?)\/gl-(time|auth-command) /' < $HOME/.ssh/authorized_keys`
# GL_BINDIR still not known? we have a problem... # GL_BINDIR still not known? we have a problem...
[ -z "$GL_BINDIR" ] && { [ -z "$GL_BINDIR" ] && {
cat <<EOF2 echo "
Unable to determine correct path for gitolite scripts from the authkeys file. Unable to determine correct path for gitolite scripts from the authkeys file.
@ -21,7 +21,7 @@ this command. For example (if you followed doc/http-backend.mkd precisely):
GL_BINDIR=/var/www/gitolite-home/bin $0 $@ GL_BINDIR=/var/www/gitolite-home/bin $0 $@
EOF2 "
exit 1 exit 1
} }

View file

@ -110,13 +110,13 @@ GL_ADMINDIR=`get_rc_val GL_ADMINDIR`
gl-install -q gl-install -q
[ -f $GL_ADMINDIR/conf/gitolite.conf ] || { [ -f $GL_ADMINDIR/conf/gitolite.conf ] || {
cat <<EOF | cut -c9- > $GL_ADMINDIR/conf/gitolite.conf echo "
repo gitolite-admin repo gitolite-admin
RW+ = $admin_name RW+ = $admin_name
repo testing repo testing
RW+ = @all RW+ = @all
EOF " | cut -c9- > $GL_ADMINDIR/conf/gitolite.conf
} }
[ -n "$pubkey_file" ] && cp $pubkey_file $GL_ADMINDIR/keydir [ -n "$pubkey_file" ] && cp $pubkey_file $GL_ADMINDIR/keydir