aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/git/default.nix5
-rwxr-xr-xmodules/git/git-shell-commands/desc2
-rwxr-xr-xmodules/git/git-shell-commands/help2
-rwxr-xr-xmodules/git/git-shell-commands/init3
-rwxr-xr-xmodules/git/git-shell-commands/owner2
-rwxr-xr-xmodules/git/git-shell-commands/readme16
-rwxr-xr-xmodules/git/git-shell-commands/section2
7 files changed, 25 insertions, 7 deletions
diff --git a/modules/git/default.nix b/modules/git/default.nix
index 0827735..914ff3e 100644
--- a/modules/git/default.nix
+++ b/modules/git/default.nix
@@ -85,9 +85,8 @@
};
system.activationScripts.setup-git-shell-commands.text = ''
- if [[ ! -h "/var/lib/git/git-shell-commands" ]]; then
- ln -s "${./git-shell-commands}" "/var/lib/git/git-shell-commands"
- fi
+ rm "/var/lib/git/git-shell-commands"
+ ln -s "${./git-shell-commands}" "/var/lib/git/git-shell-commands"
'';
services.nginx.virtualHosts = {
diff --git a/modules/git/git-shell-commands/desc b/modules/git/git-shell-commands/desc
index 52cc8bb..d81f46c 100755
--- a/modules/git/git-shell-commands/desc
+++ b/modules/git/git-shell-commands/desc
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
if [ -f "$1/config" ]; then
- cd "$1"
+ cd "$1" || exit
git config cgit.desc "$2"
fi
diff --git a/modules/git/git-shell-commands/help b/modules/git/git-shell-commands/help
index 7572fe4..930d608 100755
--- a/modules/git/git-shell-commands/help
+++ b/modules/git/git-shell-commands/help
@@ -9,3 +9,5 @@ echo " owner <repo> <owner>"
echo " Set repo owner"
echo " section <repo> <section>"
echo " Set repo section"
+echo " readme <repo> [md|adoc]"
+echo " Set readme format"
diff --git a/modules/git/git-shell-commands/init b/modules/git/git-shell-commands/init
index 603b817..557f20e 100755
--- a/modules/git/git-shell-commands/init
+++ b/modules/git/git-shell-commands/init
@@ -4,6 +4,7 @@ REPO="$1"
if [ ! -f "$REPO/config" ]; then
mkdir -p "$REPO"
- cd "$REPO"
+ cd "$REPO" || exit
git init --bare --shared
+ git config cgit.readme "main:README.md"
fi
diff --git a/modules/git/git-shell-commands/owner b/modules/git/git-shell-commands/owner
index d65fd02..bd54e59 100755
--- a/modules/git/git-shell-commands/owner
+++ b/modules/git/git-shell-commands/owner
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
if [ -f "$1/config" ]; then
- cd "$1"
+ cd "$1" || exit
git config cgit.owner "$2"
fi
diff --git a/modules/git/git-shell-commands/readme b/modules/git/git-shell-commands/readme
new file mode 100755
index 0000000..b3c34f7
--- /dev/null
+++ b/modules/git/git-shell-commands/readme
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+
+if [ -f "$1/config" ]; then
+ cd "$1" || exit
+ case "$2" in
+ "md")
+ git config cgit.readme "main:README.md"
+ ;;
+ "adoc")
+ git config cgit.readme "main:README.adoc"
+ ;;
+ *)
+ echo "no idea what you're talking about. md | adoc"
+ ;;
+ esac
+fi
diff --git a/modules/git/git-shell-commands/section b/modules/git/git-shell-commands/section
index b1a998e..e367a5e 100755
--- a/modules/git/git-shell-commands/section
+++ b/modules/git/git-shell-commands/section
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
if [ -f "$1/config" ]; then
- cd "$1"
+ cd "$1" || exit
git config cgit.section "$2"
fi