commit 9790aa7f48b81f56d4317622261de20fe81da3fa
parent bb8518814aecb6431936d0e63890e518c167b9fe
Author: Tyler Clark <tyler.clark@foxide.xyz>
Date: Sun, 9 Feb 2025 21:47:07 -0500
Creating 'post-receive' script automatically
Diffstat:
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/scripts/NewRepo.sh b/scripts/NewRepo.sh
@@ -6,10 +6,13 @@
# 1. DONE Create ${REPO}
# 2. DONE Set description for ${REPO}, unless flag is set to skip
# 3. TODO Create README.md for ${REPO}, unless flag is set to skip
-# 4. TODO Implement 'template' repos
+# 4. HOLD Implement 'template' repos
# 5. HOLD Copy license file to ${REPO}, unless flag is set to skip
-REPODIR="../Repos"
+REPODIR="/usr/local/www/git"
+TEMPLATE=0
+PRIVATE=0
+NO_DESC=0
help()
{
@@ -21,24 +24,27 @@ createRepo()
if [ ${TEMPLATE} = 1 ] && [ ${PRIVATE} = 1 ]; then
echo "Note: Behavior of private templates and regular templates are identical."
EXT=.template
- break
elif [ ${PRIVATE} = 1 ]; then
EXT=.private
- break
elif [ ${TEMPLATE} = 1 ]; then
EXT=.template
- break
else
EXT=.git
- break
fi
- git init --bare ${REPODIR}.${EXT}
+ git init --bare ${REPODIR}/${NAME}${EXT}
if [ ${NO_DESC} != 1]; then
- ${EDITOR} ${REPODIR}.${EXT}/description
+ vim ${REPODIR}/${NAME}${EXT}/description
fi
+ printf "#!/bin/sh\n
+ # This script is to generate the HTML for the git repo when a new commit is received\n
+ cd ${REPODIR}/${NAME}${EXT}\n
+ /usr/local/bin/stagit ./\n
+ /usr/locla/bin/stagit-index ${REPODIR}/*git > ${REPODIR}/index.html" > ${REPODIR}/${NAME}${EXT}/hooks/post-receive
+ chmod u+x ${REPODIR}/${NAME}${EXT}/hooks/post-receive
+
}
if [ "$#" -eq 0 ]; then