Return to repo list

remgit-scripts

A collection of scripts for use with a simple remote git service.
Return to HMagellan.com

commit 758b7d38d871dbe25f4a8c23c3884dfc18f8f8fb
parent 7c447f04fec1b713f249495e091f9c79666c4625
Author: Erik Letson <hmagellan@tutamail.com>
Date:   Sat,  4 Jul 2020 07:29:00 -0500

added repo web subdir support

Diffstat:
Mupstagit.sh | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/upstagit.sh b/upstagit.sh @@ -6,6 +6,7 @@ # Configure these values to match your web environment REPO_PATH="/srv/git" WEB_PATH="/var/www/html" +WEB_REPO_DIR="repos" WEB_URL="https://example.com" LOGO_URL="$WEBURL/example.jpg" STYLE_URL="$WEBURL/style.css" @@ -16,13 +17,13 @@ STAGIT_INDEX_COM="$STAGIT_COM-index" # Update web frontend for each repo for i in $(ls $REPO_PATH); do - if [[ -d $WEB_PATH/$i ]] + if [[ -d $WEB_PATH/$WEB_REPO_DIR/$i ]] then - cd $WEB_PATH/$i + cd $WEB_PATH/$WEB_REPO_DIR/$i rm -rd * else - mkdir $WEB_PATH/$i - cd $WEB_PATH/$i + mkdir $WEB_PATH/$WEB_REPO_DIR/$i + cd $WEB_PATH/$WEB_REPO_DIR/$i fi $STAGIT_COM $REPO_PATH/$i done @@ -36,7 +37,7 @@ sed -i 's,class\=\"desc\">Repositories,class\=\"desc\"><h1>Repositories<\/h1>,g' sed -i 's,<td><b>Owner<\/b><\/td>,<td><\/td>,g' "$WEB_PATH/index.html" for j in $(ls $REPO_PATH); do - for k in $(ls -R -a1 $WEB_PATH/* | find $WEB_PATH | grep ".html$"); do + for k in $(ls -R -a1 $WEB_PATH/$WEB_REPO_DIR/* | find $WEB_PATH/$WEB_REPO_DIR | grep ".html$"); do sed -i -E -e "s,\=\"\(\.\.\/\)*logo\.png\",\=\"$LOGO_URL\",g" "$k" sed -i -E -e "s,\=\"\(\.\.\/\)*style\.css\",\=\"$STYLE_URL\",g" "$k" sed -i "s,width\=\"32\" height\=\"32\",width\=\"$ICON_WIDTH\" height=\=\"$ICON_HEIGHT\",g" "$k"