--- /dev/null
+#!/bin/sh
+# fix/conform all remotes/URLs for wrapfs GIT repos
+
+FSL_GIT="ssh://git.fsl.cs.sunysb.edu/scm/git/ROHIT"
+KORG_GIT="git://git.kernel.org/pub/scm/linux/kernel/git"
+
+# function to execute commands
+runcmd() {
+ echo "CMD: $@"
+ $@
+ ret=$?
+ if [ $ret -ne 0 ] ; then
+ echo "ERROR in running cmd: $@"
+ exit $ret
+ fi
+}
+# show but don't do
+nruncmd() {
+ echo "CMD: $@"
+}
+
+# verify I'm in a top level git repo
+if ! test -d .git ; then
+ echo "Must be in a top level git dir (just above .git)"
+ exit 1
+fi
+
+# find out what repo I'm supposed to be (allow override from cmd-line)
+if test -z "$1"; then
+ THIS_REPO=`basename $PWD | sed -e 's/^wrapfs-//' -e 's/\.y$//'`
+else
+ THIS_REPO="$1"
+fi
+#echo THIS_REPO:$THIS_REPO
+case "$THIS_REPO" in
+ 2.6.* | 3.* | 4.* | 5.* | latest ) ;;
+ * ) echo This repo is unknown: $THIS_REPO
+ exit 1
+ ;;
+esac
+
+# verify we have both master and wrapfs branches
+TMP_BR_LIST=/tmp/.tbr.$$
+(
+cat <<EOF
+ origin/HEAD -> origin/master
+ origin/master
+ origin/wrapfs
+EOF
+) > $TMP_BR_LIST
+EXP_BR_LIST=/tmp/.ebr.$$
+git branch -r > $EXP_BR_LIST
+if ! cmp $TMP_BR_LIST $EXP_BR_LIST 2>/dev/null; then
+ echo "Expected list of branches mismatched for `basename $PWD`"
+ diff -u $TMP_BR_LIST $EXP_BR_LIST
+ /bin/rm -f $TMP_BR_LIST $EXP_BR_LIST
+# exit 1
+fi
+/bin/rm -f $TMP_BR_LIST $EXP_BR_LIST
+
+# find out the URL for the remote "origin"`
+THIS_ORIGIN_URL=`git remote get-url origin 2>/dev/null`
+#echo THIS_ORIGIN_URL=$THIS_ORIGIN_URL
+# expected origin URL
+case "$THIS_REPO" in
+ latest ) EXPECTED_ORIGIN_URL="$FSL_GIT/wrapfs-${THIS_REPO}.git" ;;
+ * ) EXPECTED_ORIGIN_URL="$FSL_GIT/wrapfs-${THIS_REPO}.y.git" ;;
+esac
+#echo EXPECTED_ORIGIN_URL=$EXPECTED_ORIGIN_URL
+
+# set new remote URL as needed
+if test "$THIS_ORIGIN_URL" != "$EXPECTED_ORIGIN_URL" ; then
+ if test -z "$THIS_ORIGIN_URL" ; then
+ # add new URL
+ runcmd git remote add origin $EXPECTED_ORIGIN_URL
+ else
+ # replace existing URL
+ runcmd git remote set-url origin $EXPECTED_ORIGIN_URL
+ fi
+fi
+
+# find out the URL for the remote "korg"`
+THIS_KORG_URL=`git remote get-url korg 2>/dev/null`
+#echo THIS_KORG_URL=$THIS_KORG_URL
+# expected korg URL
+case "$THIS_REPO" in
+ latest )
+ EXPECTED_KORG_URL="$KORG_GIT/torvalds/linux.git"
+ KORG_BRANCH="master"
+ ;;
+ * )
+ EXPECTED_KORG_URL="$KORG_GIT/stable/linux-stable.git"
+ KORG_BRANCH="linux-${THIS_REPO}.y"
+ ;;
+esac
+#echo EXPECTED_KORG_URL=$EXPECTED_KORG_URL
+
+# set new remote URL as needed
+if test "$THIS_KORG_URL" != "$EXPECTED_KORG_URL" ; then
+ if test -z "$THIS_KORG_URL" ; then
+ # add new URL
+ runcmd git remote add korg $EXPECTED_KORG_URL
+ else
+ # replace existing URL
+ runcmd git remote set-url korg $EXPECTED_KORG_URL
+ fi
+fi
--- /dev/null
+#!/bin/sh
+# update a wrapfs repo from stable branch
+
+FSL_GIT="ssh://git.fsl.cs.sunysb.edu/scm/git/ROHIT"
+KORG_GIT="git://git.kernel.org/pub/scm/linux/kernel/git"
+
+# function to execute commands
+runcmd() {
+ echo "CMD: $@"
+ $@
+ ret=$?
+ if [ $ret -ne 0 ] ; then
+ echo "ERROR in running cmd: $@"
+ exit $ret
+ fi
+}
+# show but don't do
+nruncmd() {
+ echo "CMD: $@"
+}
+
+# verify I'm in a top level git repo
+if ! test -d .git ; then
+ echo "Must be in a top level git dir (just above .git)"
+ exit 1
+fi
+
+# find out what repo I'm supposed to be (allow override from cmd-line)
+if test -z "$1"; then
+ THIS_REPO=`basename $PWD | sed -e 's/^wrapfs-//' -e 's/\.y$//'`
+else
+ THIS_REPO="$1"
+fi
+#echo THIS_REPO:$THIS_REPO
+case "$THIS_REPO" in
+ 2.6.* | 3.* | 4.* | 5.* ) ;;
+ latest ) echo latest branch not supported yet
+ exit 1
+ ;;
+ * ) echo This repo is unknown: $THIS_REPO
+ exit 1
+ ;;
+esac
+
+nruncmd git checkout master
+nruncmd git pull korg $THIS_REPO
+nruncmd git checkout wrapfs
+nruncmd git merge wrapfs