commit 8085021b113e95e2b0551981949b4bd976b988b7
parent afe8e3a10a70a8e0234318225fa9ca5d7ce6ff93
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 27 Apr 2024 15:56:26 +0200
Error if not all arguments are given.
Diffstat:
6 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/bin/git_create_repo.sh b/bin/git_create_repo.sh
@@ -7,6 +7,20 @@
# $5 - owner/maintainer
# $6 - prot + domain: https://git.example.com
+# Error out if not all options are given
+if [ -z "$6" ]; then
+ echo "Usage:
+git_create_repo.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\" \\
+ \"stagit-jayvii.de\" \\
+ \"An example repository.\" \\
+ \"JayVii\" \\
+ \"https://git.example.com\"
+ "
+ exit 1;
+fi
+
# Create Folders
mkdir -p "${1}/${2}/${3}/"
mkdir -p "${1}/${2}/${3}.git/"
diff --git a/bin/git_post_push.sh b/bin/git_post_push.sh
@@ -1,5 +1,17 @@
#!/usr/bin/env sh
+# Error out if not all options are given
+if [ -z "$3" ]; then
+ echo "Usage:
+git_post_push.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\" \\
+ \"stagit-jayvii.de\"
+ "
+ exit 1;
+fi
+
+
. $HOME/bin/git_update_repo.sh "${1}" "${2}" "${3}"
sleep 1
. $HOME/bin/git_update_repo_html.sh "${1}" "${2}" "${3}"
diff --git a/bin/git_set_clone_url.sh b/bin/git_set_clone_url.sh
@@ -2,7 +2,20 @@
# $1 - HTML Root
# $2 - pub/priv
-# $3 - prot + domain: https://git.example.com
-# $4 - repo name
+# $3 - repo name
+# $4 - prot + domain: https://git.example.com
-printf "${3}/${2}/${4}.git" > "${1}/${2}/${4}.git/url"
+# Error out if not all options are given
+if [ -z "$4" ]; then
+ echo "Usage:
+git_set_clone_url.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\" \\
+ \"stagit-jayvii.de\" \\
+ \"https://git.example.com\"
+ "
+ exit 1;
+fi
+
+
+printf "${4}/${2}/${3}.git" > "${1}/${2}/${3}.git/url"
diff --git a/bin/git_update_index_html.sh b/bin/git_update_index_html.sh
@@ -3,6 +3,17 @@
# $1 - HTML Root
# $2 - priv/pub
+# Error out if not all options are given
+if [ -z "$2" ]; then
+ echo "Usage:
+git_update_index_html.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\"
+ "
+ exit 1;
+fi
+
+
# find respositories
REPOS=$(find "${1}"/"${2}" -maxdepth 1 | grep -E "\.git$" | sed -e 's/\s/\\ /g')
diff --git a/bin/git_update_repo.sh b/bin/git_update_repo.sh
@@ -4,6 +4,18 @@
# $2 - priv/pub
# $3 - repo name
+# Error out if not all options are given
+if [ -z "$3" ]; then
+ echo "Usage:
+git_update_repo.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\" \\
+ \"stagit-jayvii.de\"
+ "
+ exit 1;
+fi
+
+
# Git-Repository
cd "${1}/${2}/${3}.git"
diff --git a/bin/git_update_repo_html.sh b/bin/git_update_repo_html.sh
@@ -4,6 +4,18 @@
# $2 - priv/pub
# $3 - repo name
+# Error out if not all options are given
+if [ -z "$3" ]; then
+ echo "Usage:
+git_update_repo_html.sh \\
+ \"/var/www/git.example.git\" \\
+ \"pub\" \\
+ \"stagit-jayvii.de\"
+ "
+ exit 1;
+fi
+
+
# HTML Viewer
cd "${1}/${2}/${3}"