Added archive feature for repositories to download a tar.gz of the entire repository

This commit is contained in:
Dionysus 2023-06-27 19:56:40 -04:00
parent f55a30b48d
commit 695b45466a
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
4 changed files with 5 additions and 17 deletions

View File

@ -61,7 +61,7 @@ make_repos() {
echo "[~] processing '$REPO' repository..."
mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $dir
ln -sf log.html index.html
git --git-dir $dir/.git archive --format=tar.gz -o "$HTML_DIR/$REPO/$REPO.tar.gz" --prefix="$REPO/" HEAD
git --git-dir $dir/.git archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD
done
}

View File

@ -11,4 +11,4 @@ DIR=$PWD
REPO=$(basename $DIR .git)
mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $DIR
ln -sf log.html index.html
git --git-dir $DIR archive --format=tar.gz -o "$HTML_DIR/$REPO/$REPO.tar.gz" --prefix="$REPO/" HEAD
git --git-dir $DIR archive --format=tar.gz -o "$HTML_DIR/$REPO/$archive.tar.gz" --prefix="$REPO/" HEAD

View File

@ -1,14 +0,0 @@
#!/bin/sh
# stagit post-recieve script - developed by acidevegas (https://git.acid.vegas/stagit)
URL="git.acid.vegas"
PROTO="https"
CLONE_URL="git://$URL"
COMMIT_LIMIT=100
HTML_DIR="/srv/http"
DIR=$PWD
REPO=$(basename $DIR .git)
mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $DIR
ln -sf log.html index.html
git --git-dir $DIR archive --format=tar.gz -o "$HTML_DIR/$REPO/$REPO.tar.gz" --prefix="$REPO/" HEAD

View File

@ -493,7 +493,8 @@ void writeheader(FILE *fp, const char *title) {
fputs("\t\t<tr><td>\n", fp);
fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
fprintf(fp, "<a href=\"%srefs.html\">Refs</a> | ", relpath);
fprintf(fp, "<a href=\"%sarchive.tar.gz\">Archive</a>", relpath);
if (submodules)
fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>", relpath, submodules);
if (readme)
@ -501,6 +502,7 @@ void writeheader(FILE *fp, const char *title) {
fprintf(fp, " | <a href=\"%sREADME.html\">README</a>", relpath);
if (license)
fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>", relpath, license);
fputs("</td></tr>\n\t</table>\n</div>\n<br>\n", fp);
}