* wrapfs-patch-release.sh, wrapfs-fix-branch.sh: cleanups, fixes.
+2019-01-31 Erez Zadok <ezk@fsl.cs.sunysb.edu>
+
+ * README: reformat.
+
+ * wrapfs-patch-release.sh, wrapfs-fix-branch.sh: cleanups, fixes.
+
2018-03-21 Erez Zadok <ezk@fsl.cs.sunysb.edu>
* wrapfs-fix-branch.sh: commit initial script.
+Wrapfs follows the following branching scheme.
-Wrapfs follows the following branching scheme.
-
- There are two local branches called master and kernel. The master branch tracks
- the linux <latest> repository and pulls the latest code from that as remote (korg).
- The local branch wrapfs tracks the wrapfs <latest> repository and pushes and
- pulls latest code from that as remote (wrapfs). The kernel branch tracks the
- <git.kernel.org> as remote and fetches the latest from there. In order to setup
- this branching scheme please run the script - "wrapfs-fix-branch.sh"
+There are two local branches called master and kernel. The master branch
+tracks the linux <latest> repository and pulls the latest code from that as
+remote (korg). The local branch "wrapfs" tracks the wrapfs <latest>
+repository and pushes and pulls latest code from that as remote (wrapfs).
+The kernel branch tracks the <git.kernel.org> as remote and fetches the
+latest from there. In order to setup this branching scheme please run the
+script - "wrapfs-fix-branch.sh"
We can use "wrapfs-patch-release.sh" script for the following:
- 1.) Updating the kernel version to the korg latest linux version -
- Run it without any arguments. No patchfile will be released. For e.g.:
-
- ./wrapfs-patch-release.sh
-
- 2.) Updating it to a known linux release version -
- Use '-v' or '--version' and pass the respective linux version.
- No patch file will be released. For e.g.:
-
- ./wrapfs-patch-release.sh -v 2.6.32.21
-
- ./wrapfs-patch-release.sh --version 2.6.32.21
-
- 3.) Releasing a patch file with specific kernel version
- Use '-r' or '--release-patch' option. For e.g. -
-
- ./wrapfs-patch-release.sh --version 2.6.32.21 -r yes
-
- ./wrapfs-patch-release.sh --version 2.6.32.21 --release-patch yes
-
- 4.) Releasing a patch file with current kernel version
- Does a git pull to the latest kernel released version on master branch.
- Does a merge of master branch on wrapfs branch and then releases a
- respective patch. Use '-r' or '--release-patch' option. For e.g. -
-
- ./wrapfs-patch-release.sh -r yes
-
- ./wrapfs-patch-release.sh --release-patch yes
-
+1. Updating the kernel version to the korg latest linux version - Run it
+ without any arguments. No patchfile will be released. For e.g.:
+
+$ ./wrapfs-patch-release.sh
+
+2. Updating it to a known linux release version: Use '-v' or '--version'
+ and pass the respective linux version. No patch file will be
+ released. For example:
+
+$ ./wrapfs-patch-release.sh -v 2.6.32.21
+$ ./wrapfs-patch-release.sh --version 2.6.32.21
+
+3. Releasing a patch file with specific kernel version. Use '-r' or
+ '--release-patch' option. For example:
+
+$ ./wrapfs-patch-release.sh --version 2.6.32.21 -r yes
+$ ./wrapfs-patch-release.sh --version 2.6.32.21 --release-patch yes
+
+4. Releasing a patch file with current kernel version. Does a git pull to
+ the latest kernel released version on master branch. Does a merge of
+ master branch on wrapfs branch and then releases a respective patch. Use
+ '-r' or '--release-patch' option. For example
+
+$ ./wrapfs-patch-release.sh -r yes
+$ ./wrapfs-patch-release.sh --release-patch yes
+
#!/bin/bash
-
set -u -e
_=${LINUX_REPO:=""}
_=${LINUX_BRANCH:=""}
-_=${LOG_FILE:="/tmp/wrapfs-fix-branch.log"}
+_=${LOG_FILE:="/tmp/wrapfs-fix-branch.$$.log"}
_=${LOCATION:=$(pwd)}
-# check if the script is running for a git repository or not
+# check if the script is running for a git repository or not
if [ ! -d .git ]; then
echo "Please run this script in a git directory."
- exit
+ exit 1
fi
LINUX_PREFIX="git://git.kernel.org/pub/scm/linux/kernel/git"
LINUX_BRANCH="master"
-# fetch the wrapfs url from .git/config
+# fetch the wrapfs url from .git/config
WRAPFS_URL=`git config --get-regexp remote.origin.url wrapfs | cut -f 2 -d ' '`
-
if [ -z "${WRAPFS_URL:+x}" ]; then
echo "Wrapfs url missing .git/config"
exit 1
# fetch the wrapfs repository name from the wrapfs-url
WRAPFS_REPO=`git config --get-regexp remote.origin.url wrapfs | sed 's/.*\///g'`
-
if [ -z "${WRAPFS_REPO:+x}" ]; then
echo "Missing repository name in url $WRAPFS_URL"
exit 1
# Log info in a file
LOG_FILE="/tmp/log-${WRAPFS_REPO}"
-# function to execute commands
+# function to execute commands
runcmd() {
echo "----------------------------------------------------------------------" 2>&1 | tee -a $LOG_FILE
echo "CMD: $@" 2>&1 | tee -a $LOG_FILE
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
- var="${var%"${var##*[![:space:]]}"}"
+ var="${var%"${var##*[![:space:]]}"}"
echo -n "$var"
}
LINUX_REPO="torvalds/linux.git"
LINUX_BRANCH="korg/master"
;;
- wrapfs-2.* | wrapfs-3.* | wrapfs-4.* )
+ wrapfs-2.* | wrapfs-3.* | wrapfs-4.* )
LINUX_REPO="stable/linux-stable.git"
LINUX_BRANCH=$(get_linux_version $LOCATION/Makefile)
LINUX_BRANCH="v$LINUX_BRANCH"
_=${RELEASE_PATCH:=""}
_=${PATCH_VERSION:=""}
-# check if the script is running for a git repository or not
+# check if the script is running for a git repository or not
if [ ! -d .git ]; then
echo "Please run this script in a git directory."
exit
while true; do
case "$1" in
- -v | --version ) LINUX_VERSION=$2; shift 2;;
- -r | --release-patch ) RELEASE_PATCH=$2; shift 2;;
- -- ) shift;break;;
- * ) echo $1; break;;
+ -v | --version ) LINUX_VERSION=$2; shift 2 ;;
+ -r | --release-patch ) RELEASE_PATCH=$2; shift 2 ;;
+ -- ) shift; break ;;
+ * ) echo $1; break ;;
esac
done
-# function to execute commands
+# function to execute commands
runcmd() {
echo "----------------------------------------------------------------------"
- echo "CMD: $@"
+ echo "CMD: $@"
$@
ret=$?
if [ $ret -ne 0 ] ; then
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
- var="${var%"${var##*[![:space:]]}"}"
+ var="${var%"${var##*[![:space:]]}"}"
echo -n "$var"
}
echo -n $ret
}
-# fetch the wrapfs url from .git/config
+# fetch the wrapfs url from .git/config
WRAPFS_URL=`git config --get-regexp remote.origin.url wrapfs | cut -f 2 -d ' '`
if [ -z "${WRAPFS_URL:+x}" ]; then
wrapfs-latest*)
LINUX_BRANCH="master"
;;
- wrapfs-2.* | wrapfs-3.* | wrapfs-4.* )
+ wrapfs-2.* | wrapfs-3.* | wrapfs-4.* )
LINUX_BRANCH=$(echo $WRAPFS_REPO | sed s/wrapfs/linux/g | sed s/\.git//g)
;;
* )
if [[ "$LINUX_VERSION" != "" ]]; then
runcmd git reset --hard "v$LINUX_VERSION"
-else
+else
runcmd git pull korg ${LINUX_BRANCH}
fi
if [[ "$LINUX_VERSION" != "" ]]; then
PATCH_VERSION="v${LINUX_VERSION}"
patch $PATCH_VERSION $PATCH_FILE
- else
+ else
PATCH_VERSION=$(get_linux_version $LOCATION/Makefile )
PATCH_VERSION="v$PATCH_VERSION"
patch $PATCH_VERSION $PATCH_FILE