Return to repo list

remgit-scripts

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

commit 1d7b87274c6542af8bdb4dcbead3656f9dd4c3d5
parent eaf1b5b117034d5337b56e90319152ccf809c2b9
Author: Erik Letson <hmagellan@tutamail.com>
Date:   Sat,  4 Jul 2020 08:24:22 -0500

Major fix-up

Diffstat:
Mupstagit.sh | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/upstagit.sh b/upstagit.sh @@ -8,8 +8,8 @@ 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" +LOGO_URL="$WEB_URL/example.jpg" +STYLE_URL="$WEB_URL/style.css" ICON_WIDTH="32" ICON_HEIGHT="32" STAGIT_COM="/usr/local/bin/stagit" @@ -18,11 +18,8 @@ STAGIT_INDEX_COM="$STAGIT_COM-index" # Update web frontend for each repo for i in $(ls $REPO_PATH); do # Format away the '.git' at the end of the repo name, if it is there - if [[$i == *".git" ]] - then - old_i=$i - i=$(sed 's,\.git$,,' <<< $i) - fi + old_i=$i + i=$(sed 's,\.git$,,' <<< $i) if [[ -d $WEB_PATH/$WEB_REPO_DIR/$i ]] then cd $WEB_PATH/$WEB_REPO_DIR/$i @@ -42,9 +39,13 @@ $STAGIT_INDEX_COM $REPO_PATH/* > $WEB_PATH/index.html sed -i 's,class\=\"desc\">Repositories,class\=\"desc\"><h1>Repositories<\/h1>,g' "$WEB_PATH/index.html" sed -i 's,<td><b>Owner<\/b><\/td>,<td><\/td>,g' "$WEB_PATH/index.html" sed -i "s,<td><a href\=\",<td><a href=\"$WEB_REPO_DIR\/,g" "$WEB_PATH/index.html" +sed -i -E -e "s,src\=\".*logo\.png\",src\=\"$LOGO_URL\",g" "$WEB_PATH/index.html" +sed -i -E -e "s,href\=\".*style\.css\",href\=\"$STYLE_URL\",g" "$WEB_PATH/index.html" +sed -i "s,width\=\"32\" height\=\"32\",width\=\"$ICON_WIDTH\" height\=\"$ICON_HEIGHT\",g" "$WEB_PATH/index.html" for j in $(ls $REPO_PATH); 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,href\=\"\.\.\/\",href\=\"$WEB_URL\",g" "$k" 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"