summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Bayer <bbayer@multitech.com>2016-11-14 15:48:57 -0600
committerBrandon Bayer <bbayer@multitech.com>2016-11-14 15:48:57 -0600
commit9a6af6d50ebc8371593974e00cb12051561fbeec (patch)
treefca04e4152a07da655bb1a2e07d5ea8c7a1e8d0a
parent717950976005b1c92e88539d9287baafc406c6f9 (diff)
downloadmlinux-9a6af6d50ebc8371593974e00cb12051561fbeec.tar.gz
mlinux-9a6af6d50ebc8371593974e00cb12051561fbeec.tar.bz2
mlinux-9a6af6d50ebc8371593974e00cb12051561fbeec.zip
chore: add git hooks to auto update git submodules
-rwxr-xr-xscripts/git-hooks/post-checkout3
-rwxr-xr-xscripts/git-hooks/post-merge3
-rwxr-xr-xsetup.sh82
3 files changed, 50 insertions, 38 deletions
diff --git a/scripts/git-hooks/post-checkout b/scripts/git-hooks/post-checkout
new file mode 100755
index 0000000..4dd578c
--- /dev/null
+++ b/scripts/git-hooks/post-checkout
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./setup.sh --update
diff --git a/scripts/git-hooks/post-merge b/scripts/git-hooks/post-merge
new file mode 100755
index 0000000..4dd578c
--- /dev/null
+++ b/scripts/git-hooks/post-merge
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./setup.sh --update
diff --git a/setup.sh b/setup.sh
index 28f6249..d601f46 100755
--- a/setup.sh
+++ b/setup.sh
@@ -2,53 +2,59 @@
set -e
-echo ""
-echo "Setting up git hooks..."
-ln -s ../../scripts/git-hooks/pre-commit .git/hooks/pre-commit || true
-ln -s ../../scripts/git-hooks/pre-push .git/hooks/pre-push || true
+if [ "$1" != "--update" ]; then
+ echo ""
+ echo "Setting up git hooks..."
+ ln -s ../../scripts/git-hooks/post-merge .git/hooks/post-merge || true
+ ln -s ../../scripts/git-hooks/post-checkout .git/hooks/post-checkout || true
+ ln -s ../../scripts/git-hooks/pre-commit .git/hooks/pre-commit || true
+ ln -s ../../scripts/git-hooks/pre-push .git/hooks/pre-push || true
+fi
echo ""
echo "Updating git submodules..."
git submodule update --init
-response=y
-test -f env-oe.sh && read -p "Overwrite env-oe.sh with defaults? (y/N) " response
-if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
- echo "Copying default environment script..."
- cp layers/meta-mlinux/contrib/env-oe.sh .
-else
- echo "Leaving existing env-oe.sh alone."
-fi
+if [ "$1" != "--update" ]; then
+ response=y
+ test -f env-oe.sh && read -p "Overwrite env-oe.sh with defaults? (y/N) " response
+ if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
+ echo "Copying default environment script..."
+ cp layers/meta-mlinux/contrib/env-oe.sh .
+ else
+ echo "Leaving existing env-oe.sh alone."
+ fi
-echo ""
-response=y
-test -f conf/local.conf && read -p "Overwrite conf/local.conf with defaults? (y/N) " response
-if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
- echo "Creating default bitbake configuration..."
- cp layers/meta-mlinux/contrib/local.conf conf/
-else
- echo "Leaving existing conf/local.conf alone."
-fi
+ echo ""
+ response=y
+ test -f conf/local.conf && read -p "Overwrite conf/local.conf with defaults? (y/N) " response
+ if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
+ echo "Creating default bitbake configuration..."
+ cp layers/meta-mlinux/contrib/local.conf conf/
+ else
+ echo "Leaving existing conf/local.conf alone."
+ fi
-echo ""
-echo "Creating user-layer..."
-mkdir -p layers/user-layer/conf
-mkdir -p layers/user-layer/recipes-core
+ echo ""
+ echo "Creating user-layer..."
+ mkdir -p layers/user-layer/conf
+ mkdir -p layers/user-layer/recipes-core
-echo ""
-response=y
-test -f layers/user-layer/conf/layer.conf && read -p "Overwrite layers/user-layer/conf/layer.conf with defaults? (y/N) " response
-if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
- echo "Creating default user-layer configuration..."
- cp layers/meta-mlinux/contrib/user-layer.conf layers/user-layer/conf/layer.conf
-else
- echo "Leaving existing layers/user-layer/conf/layer.conf alone."
-fi
+ echo ""
+ response=y
+ test -f layers/user-layer/conf/layer.conf && read -p "Overwrite layers/user-layer/conf/layer.conf with defaults? (y/N) " response
+ if [[ $response =~ ^y$ || $response =~ ^yes$ ]]; then
+ echo "Creating default user-layer configuration..."
+ cp layers/meta-mlinux/contrib/user-layer.conf layers/user-layer/conf/layer.conf
+ else
+ echo "Leaving existing layers/user-layer/conf/layer.conf alone."
+ fi
-echo ""
-echo "Creating directory structure..."
-mkdir -p downloads
-mkdir -p build
+ echo ""
+ echo "Creating directory structure..."
+ mkdir -p downloads
+ mkdir -p build
+fi
echo ""
echo "Setup Done."