compat-wireles: add scripts to help standalone development trees
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Fri, 4 May 2012 22:27:35 +0000 (15:27 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Fri, 4 May 2012 22:27:35 +0000 (15:27 -0700)
This adds a set of scripts to help you use compat-wireless to maintain
standalone development trees that use compat-wireless and synch with it.

An example standalone development git tree will be provided later.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
scripts/refresh-compat [new file with mode: 0755]
scripts/refresh-compat-local [new file with mode: 0755]

diff --git a/scripts/refresh-compat b/scripts/refresh-compat
new file mode 100755 (executable)
index 0000000..d4c44c8
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# Copyright 2012    Luis R. Rodriguez <mcgrof@frijolero.org>
+#
+# The purpose of this script is to enable developers use compat-wireless
+# backport work without having to carry code on their tree. This lets
+# developers synch to newer compat-wireless releases to gain more backport
+# work. If you use this throw the files into your .gitignore:
+#
+# compat/
+# udev/
+# include/
+# scripts/
+# compat_base_tree
+# compat_base_tree_version
+# compat_version
+# config.mk
+#
+# An example git tree for standalone development will be provided later.
+# Once run you can then just run on your standalone development tree:
+#
+# ./refresh-compat
+#
+# This is a copy of refresh-compat-local that we maintain here
+# You can keep that in your git tree as otherwise its hard for users to
+# know what to run.
+
+# Pretty colors
+GREEN="\033[01;32m"
+YELLOW="\033[01;33m"
+NORMAL="\033[00m"
+BLUE="\033[34m"
+RED="\033[31m"
+PURPLE="\033[35m"
+CYAN="\033[36m"
+UNDERLINE="\033[02m"
+
+COMPAT_SRC="$HOME/devel/compat-wireless/"
+EXTRA_COPY=""
+
+if [[ -f .compat_copy ]]; then
+       source .compat_copy
+fi
+
+COPY=""
+COPY="$COPY compat/"
+COPY="$COPY include/"
+COPY="$COPY udev/"
+COPY="$COPY scripts/check_config.sh"
+COPY="$COPY scripts/check_depmod"
+COPY="$COPY scripts/compress_modules"
+COPY="$COPY scripts/gen-compat-autoconf.sh"
+COPY="$COPY scripts/modlib.sh"
+COPY="$COPY scripts/update-initramfs"
+COPY="$COPY compat_base_tree"
+COPY="$COPY compat_base_tree_version"
+COPY="$COPY compat_version"
+COPY="$COPY config.mk"
+COPY="$COPY $EXTRA_COPY"
+
+REFRESH_LOCAL="scripts/refresh-compat-local"
+REFRESH_TARGET="refresh-compat"
+
+for i in $COPY ; do
+       if [[ -d ${COMPAT_SRC}${i} ]]; then
+               echo -e "Copying ${BLUE}${i}${NORMAL} ..."
+               cp -a ${COMPAT_SRC}/$i .
+               continue
+       fi
+       if [[ -f ${COMPAT_SRC}${i} ]]; then
+               DIR=$(dirname $i)
+               if [[ ! -d $DIR ]]; then
+                       mkdir $DIR
+               fi
+
+               if [[ -x ${COMPAT_SRC}${i} ]]; then
+                       echo -e "Copying ${GREEN}${i}${NORMAL} ..."
+               else
+                       echo -e "Copying ${i}${NORMAL} ..."
+               fi
+
+               cp -f ${COMPAT_SRC}/${i} $i
+               continue
+       fi
+done
+
+rm -f include/linux/compat_autoconfig.h
+rm -f .config
+
+cp -f ${COMPAT_SRC}/${REFRESH_LOCAL} ${REFRESH_TARGET}
+
+if [[ ! -f compat_base_tree_version ]]; then
+       echo -e "Failed at copying files over..."
+       exit 1
+fi
+
+echo
+echo -e "Synched with ${CYAN}$(cat compat_version)${NORMAL}"
diff --git a/scripts/refresh-compat-local b/scripts/refresh-compat-local
new file mode 100755 (executable)
index 0000000..3122995
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Copyright 2012    Luis R. Rodriguez <mcgrof@frijolero.org>
+#
+# You can keep this in synch with your git tree after running
+# This script just update your local copy.
+
+source .compat_copy
+UPDATE_SCRIPT="$COMPAT_SRC/scripts/refresh-compat"
+
+if [[ ! -d $COMPAT_SRC ]]; then
+       echo -e "You should have compat-wireless.git cloned and checked out under $COMPAT_SRC"
+       echo -e "The git tree: git://github.com/mcgrof/compat-wireless.git"
+       exit 1
+fi
+
+if [[ ! -f $UPDATE_SCRIPT ]]; then
+       echo -e "$UPDATE_SCRIPT must exist"
+       exit 1
+fi
+
+exec $UPDATE_SCRIPT