commit 92a0590abedb87ea0efeadcc2426050fab1218a2
parent e4b947d2970323441048fa60bc1b9159c8b1f64d
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Sun, 16 Aug 2020 23:06:06 +0200

Move git-shell commands to different repository

Diffstat:
Dgit-shell-commands/README.md | 8--------
Dgit-shell-commands/addkey | 32--------------------------------
Dgit-shell-commands/description | 11-----------
Dgit-shell-commands/help | 13-------------
Dgit-shell-commands/init | 18------------------
Dgit-shell-commands/make-private | 27---------------------------
Dgit-shell-commands/make-public | 52----------------------------------------------------
Dgit-shell-commands/owner | 11-----------
Dgit-shell-commands/restart-web | 2--
Dgit-shell-commands/url | 11-----------
10 files changed, 0 insertions(+), 185 deletions(-)

diff --git a/git-shell-commands/README.md b/git-shell-commands/README.md @@ -1,8 +0,0 @@ -# Git shell commands - -These scripts are useful to have in the git-shell when making a git server. Some -of the scripts assume that you have my version of stagit installed. - -Some of the scripts are based in the ones found [here][src]. - -[src]: <http://planzero.org/blog/2012/10/24/hosting_an_admin-friendly_git_server_with_git-shell> "Hosting an admin-friendly git server with git-shell" diff --git a/git-shell-commands/addkey b/git-shell-commands/addkey @@ -1,32 +0,0 @@ -#!/bin/sh - -# Read in the SSH key -echo "Input the key to be added:" -read key - -# Place the key in a temporary file (it's hard to get ssh-keygen -# to read from stdin; <<< works for bash, but is non-posix) -keyfile=$(tempfile) && echo "$key" > $keyfile - -# Generate a fingerprint -fingerprint=$(ssh-keygen -lf $keyfile) - -# Check for errors -if [ $(echo "$fingerprint" | egrep -c '(R|D)SA') -eq 0 ] -then - # Display the fingerprint error and clean up - echo "Error: $fingerprint" - rm $keyfile - exit 1 -fi - -# Add the key to the authorised keys file and clean up -mkdir -p .ssh && \ - echo -n "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty " >> .ssh/authorized_keys && \ - cat $keyfile >> .ssh/authorized_keys - -rm $keyfile - -# Display the fingerprint for reference -echo "Success! Added a key with the following fingerprint:" -echo $fingerprint diff --git a/git-shell-commands/description b/git-shell-commands/description @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check number of params -[ $# -ne 2 ] && echo "Usage: description <project.git> <description>" && exit 1 - -# Set the project name, adding .git if necessary -p=$(echo "$1" | sed 's/\.git$\|$/.git/i') - -[ ! -d "$p" ] && echo "$p not found." - -echo "$2" > "$p/description" diff --git a/git-shell-commands/help b/git-shell-commands/help @@ -1,13 +0,0 @@ -#!/bin/sh - -echo "Run 'help' for help, or 'exit' to leave. Available commands:" - -cd "$(dirname "$0")" - -for cmd in * -do - case "$cmd" in - help) ;; - *) [ -f "$cmd" ] && [ -x "$cmd" ] && echo " $cmd" ;; - esac -done diff --git a/git-shell-commands/init b/git-shell-commands/init @@ -1,18 +0,0 @@ -#!/bin/sh - -# Check number of params -[ $# -ne 1 ] && echo "Usage: init <project.git>" && exit 1 - -# Set the project name, adding .git if necessary -p=$(echo "$1" | sed 's/\.git$\|$/.git/i') - -# Create and initialise the project -mkdir "$p" && \ - cd "$p" && \ - git --bare init -ln -sf "/usr/local/share/doc/stagit/example_post-receive.sh" "hooks/post-receive" -ln -sf "hooks/post-update.sample" "hooks/post-update" - -echo "Oscar Benedito" > "owner" -echo "git://git.oscarbenedito.com/${p%.git}" > "url" -echo "${p%.git}" > "description" diff --git a/git-shell-commands/make-private b/git-shell-commands/make-private @@ -1,27 +0,0 @@ -#!/bin/sh - -# path must be absolute -reposdir="/srv/git" -webdir="/srv/git/html" - -# Check number of params -[ $# -ne 1 ] && echo "Usage: make-private <project.git>" && exit 1 - -# Set the project name, adding .git if necessary -dir="$(echo "$1" | sed 's/\.git$\|$/.git/i')" -web="/srv/git/html/$(basename "$dir" ".git")" - -[ ! -d "$dir" ] && echo "$dir not found." - -[ ! -f "$dir/git-daemon-export-ok" ] && echo "$dir is already private." && exit - -rm "$dir/git-daemon-export-ok" -rm -rf "$web" - -repos="" -for d in "$reposdir/"*.git/; do - [ -f "$d/git-daemon-export-ok" ] && repos="$repos $d" -done - -echo "$repos" | xargs stagit-index > "$webdir/index.html" -echo "$dir is now private." diff --git a/git-shell-commands/make-public b/git-shell-commands/make-public @@ -1,52 +0,0 @@ -#!/bin/sh - -# path must be absolute -reposdir="/srv/git" -webdir="/srv/git/html" -defaultdir="/usr/local/share/doc/stagit" - -# Check number of params -[ $# -ne 1 ] && echo "Usage: make-public <project.git>" && exit 1 - -# Set the project name, adding .git if necessary -dir=$(echo "$1" | sed 's/\.git$\|$/.git/i') - -[ ! -d "$dir" ] && echo "$dir not found." - -[ -f "$dir/git-daemon-export-ok" ] && echo "$dir is already public." && exit - -touch "$dir/git-daemon-export-ok" -git -C "$dir" update-server-info - -mkdir -p "$webdir" || exit 1 - -# set assets if not already there -ln -s "$defaultdir/style.css" "$webdir/style.css" 2> /dev/null -ln -s "$defaultdir/logo.png" "$webdir/logo.png" 2> /dev/null -ln -s "$defaultdir/favicon.ico" "$webdir/favicon.ico" 2> /dev/null - -# strip .git suffix -r=$(basename "$dir") -d=$(basename "$dir" ".git") -printf "%s... " "$d" - -mkdir -p "$webdir/$d" -cd "$webdir/$d" || continue -stagit -c ".stagit-build-cache" "$reposdir/$r" - -# symlinks -[ -f "about.html" ] \ - && ln -sf about.html index.html \ - || ln -sf log.html index.html -ln -sf "$reposdir/$r" ".git" - -echo "done" - -# make index -repos="" -for d in "$reposdir/"*.git/; do - [ -f "$d/git-daemon-export-ok" ] && repos="$repos $d" -done -echo "$repos" | xargs stagit-index > "$webdir/index.html" - -echo "$dir is now public." diff --git a/git-shell-commands/owner b/git-shell-commands/owner @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check number of params -[ $# -ne 2 ] && echo "Usage: owner <project.git> <owner>" && exit 1 - -# Set the project name, adding .git if necessary -p=$(echo "$1" | sed 's/\.git$\|$/.git/i') - -[ ! -d "$p" ] && echo "$p not found." - -echo "$2" > "$p/owner" diff --git a/git-shell-commands/restart-web b/git-shell-commands/restart-web @@ -1 +0,0 @@ -/usr/local/share/doc/stagit/example_create.sh -\ No newline at end of file diff --git a/git-shell-commands/url b/git-shell-commands/url @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check number of params -[ $# -ne 2 ] && echo "Usage: url <project.git> <url>" && exit 1 - -# Set the project name, adding .git if necessary -p=$(echo "$1" | sed 's/\.git$\|$/.git/i') - -[ ! -d "$p" ] && echo "$p not found." - -echo "$2" > "$p/url"