summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-09-15 13:26:30 -0400
committerAndrew Cady <d@jerkface.net>2020-09-15 13:26:30 -0400
commit206ea5176f239b993e015b7a5850ca69f34128c8 (patch)
tree02b23d3b514139336579e38e3fb38247b4ca170f
parent2438df990bc62147d84074a3f904359df51120e0 (diff)
Try to fix cgit
Uses global /srv/public_git/selfpublish.sh.git/ Creates clone with upstream of local git repo master, if we're in the working directory; otherwise uses d@cryptonomic.net:public_git/
-rw-r--r--selfpublish.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/selfpublish.sh b/selfpublish.sh
index 18884a0..42e1bd1 100644
--- a/selfpublish.sh
+++ b/selfpublish.sh
@@ -2,6 +2,7 @@
2set -e 2set -e
3 3
4DEFAULT_AUTH_TYPE=ed25519 4DEFAULT_AUTH_TYPE=ed25519
5DEFAULT_UPSTREAM=d@cryptonomic.net:public_git/selfpublish.sh
5 6
6force() 7force()
7{ 8{
@@ -330,10 +331,26 @@ install_self_to_site()
330 fi 331 fi
331} 332}
332 333
334get_upstream()
335{
336 if [ -e selfpublish.sh -a -e .git ]
337 then
338 UPSTREAM=$(git config --get branch.master.remote 2>/dev/null)
339 fi
340 UPSTREAM=${UPSTREAM:-$DEFAULT_UPSTREAM}
341 [ "$UPSTREAM" ]
342}
343
333write_cgit_config() 344write_cgit_config()
334{ 345{
335 cgit_scan_dir=$SITE_DIR/public_git/ 346 get_upstream
336 mkdir -p "$cgit_scan_dir" 347 cgit_scan_dir=/srv/public_git
348 if ! [ -e "$cgit_scan_dir"/selfpublish.sh ]
349 then
350 mkdir -p "$cgit_scan_dir"
351 (cd "$cgit_scan_dir"
352 git clone --bare "$UPSTREAM" selfpublish.sh)
353 fi
337 line="scan-path=$cgit_scan_dir" 354 line="scan-path=$cgit_scan_dir"
338 grep -qxF "$line" /etc/cgitrc || printf '%s\n' "$line" >> /etc/cgitrc 355 grep -qxF "$line" /etc/cgitrc || printf '%s\n' "$line" >> /etc/cgitrc
339} 356}