Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3776031
D2206.id5549.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2206.id5549.diff
View Options
diff --git a/roles/devserver/webserver-wwwroot51/files/clone-repo.sh b/roles/devserver/webserver-wwwroot51/files/clone-repo.sh
new file mode 100755
--- /dev/null
+++ b/roles/devserver/webserver-wwwroot51/files/clone-repo.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Clone a repository using deploy credentials
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Author: Sébastien Santoro aka Dereckson
+# License: BSD-2-Clause
+# Source file: roles/devserver/webserver-wwwroot51/files/clone-repo.sh
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Parse arguments
+#
+# Usage: clone-repo <URL> <target> <user> <group> <deploy user> <key>
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ $# -ne 6 ]; then
+ echo "Usage: $0 <URL> <target> <user> <group> <deploy user> <key>" >&2
+ exit 1
+fi
+
+REPO_URL=$1
+REPO_TARGET=$2
+REPO_USER=$3
+REPO_GROUP=$4
+DEPLOY_USER=$5
+DEPLOY_KEY=$6
+
+id -u $REPO_USER > /dev/null 2> /dev/null
+if [ $? -ne 0 ]; then
+ echo "No such user: $REPO_USER" >&2
+ exit 2
+fi
+
+getent group $REPO_GROUP > /dev/null 2> /dev/null
+if [ $? -ne 0 ]; then
+ echo "No such group: $REPO_GROUP" >&2
+ exit 4
+fi
+
+# -------------------------------------------------------------
+# Clone the repository and transfer ownership to target user
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+echo sudo -u $DEPLOY_USER git clone $REPO_URL $REPO_TARGET
+echo " (with $DEPLOY_KEY as SSH key)"
+echo chown -R $REPO_USER:$REPO_GROUP $REPO_TARGET
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 20:53 (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262977
Default Alt Text
D2206.id5549.diff (1 KB)
Attached To
Mode
D2206: WIP: improve wwwroot 51 clone repository
Attached
Detach File
Event Timeline
Log In to Comment