aboutsummaryrefslogtreecommitdiff
path: root/make_repo.sh
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-05-25 17:35:13 +0200
committerneodarz <neodarz@neodarz.net>2019-05-25 17:35:13 +0200
commit8f7214761ad57142c26d31ff6564ef69410963dc (patch)
tree399aa967287edbcce2550d3b1e328e33180ed1e8 /make_repo.sh
downloadtools_git_perso-8f7214761ad57142c26d31ff6564ef69410963dc.tar.xz
tools_git_perso-8f7214761ad57142c26d31ff6564ef69410963dc.zip
Initial commit
Diffstat (limited to '')
-rwxr-xr-xmake_repo.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/make_repo.sh b/make_repo.sh
new file mode 100755
index 0000000..98be45f
--- /dev/null
+++ b/make_repo.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+GITROOT="/home/git/pub_repo"
+
+if [ $USER != $(stat -c %U ${GITROOT}) ] && [ $USER != "root" ] ; then
+ echo "Sorry you cannot write in ${GITROOT}."
+ echo "You must be the $(stat -c %U ${GITROOT}) user or the root user."
+ exit
+fi
+
+if [ "$1" ]; then
+ pushd ${GITROOT} > /dev/null
+ mkdir -p $1
+ chown -R neodarz:neodarz $1
+ pushd $1 > /dev/null
+ git init --bare --share=group
+ popd > /dev/null
+ chown -R git:git $1
+else
+ echo "You must specify a repo name like:"
+ echo "$0 myproject.git"
+fi