Add script to automate copy TEMPLATE files to new repo 73/12673/1 master
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 10 Nov 2022 12:23:33 +0000 (13:23 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 10 Nov 2022 12:23:33 +0000 (13:23 +0100)
Change-Id: I5d83253771cbdea26039c33764735475df99f258
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
copytemplate.sh [new file with mode: 0755]

diff --git a/copytemplate.sh b/copytemplate.sh
new file mode 100755 (executable)
index 0000000..eb0d8e5
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+USER="$1"
+NEWREPO="$2"
+
+git clone "ssh://${USER}@osm.etsi.org:29418/TEMPLATE" && (cd "TEMPLATE" && curl https://osm.etsi.org/gerrit/tools/hooks/commit-msg > .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg)
+git clone "ssh://${USER}@osm.etsi.org:29418/osm/${NEWREPO}" && (cd "${NEWREPO}" && curl https://osm.etsi.org/gerrit/tools/hooks/commit-msg > .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg)
+
+cp -r TEMPLATE/* ${NEWREPO}/
+cp TEMPLATE/.gitignore ${NEWREPO}/
+rm ${NEWREPO}/copytemplate.sh
+
+cd ${NEWREPO}
+git add -A
+git commit -s -m "Copy TEMPLATE files to this repo"
+git push origin HEAD:refs/for/master
+