From 21e494d030febe31a3aa2ba542a1b47dfa4cf644 Mon Sep 17 00:00:00 2001 From: ezk Date: Fri, 1 Feb 2019 02:51:17 +0000 Subject: [PATCH] * README: reformat. * wrapfs-patch-release.sh, wrapfs-fix-branch.sh: cleanups, fixes. --- ChangeLog | 6 ++++ README | 71 ++++++++++++++++++++--------------------- wrapfs-fix-branch.sh | 17 ++++------ wrapfs-patch-release.sh | 24 +++++++------- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3562d5c..b3503b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-01-31 Erez Zadok + + * README: reformat. + + * wrapfs-patch-release.sh, wrapfs-fix-branch.sh: cleanups, fixes. + 2018-03-21 Erez Zadok * wrapfs-fix-branch.sh: commit initial script. diff --git a/README b/README index 6eb17ab..2d0d0b5 100644 --- a/README +++ b/README @@ -1,41 +1,38 @@ +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 repository and pulls the latest code from that as remote (korg). - The local branch wrapfs tracks the wrapfs repository and pushes and - pulls latest code from that as remote (wrapfs). The kernel branch tracks the - 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 repository and pulls the latest code from that as +remote (korg). The local branch "wrapfs" tracks the wrapfs +repository and pushes and pulls latest code from that as remote (wrapfs). +The kernel branch tracks the 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 + diff --git a/wrapfs-fix-branch.sh b/wrapfs-fix-branch.sh index ec6cc2d..770f050 100755 --- a/wrapfs-fix-branch.sh +++ b/wrapfs-fix-branch.sh @@ -1,24 +1,22 @@ #!/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 @@ -26,7 +24,6 @@ fi # 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 @@ -35,7 +32,7 @@ fi # 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 @@ -52,7 +49,7 @@ trim() { # remove leading whitespace characters var="${var#"${var%%[![:space:]]*}"}" # remove trailing whitespace characters - var="${var%"${var##*[![:space:]]}"}" + var="${var%"${var##*[![:space:]]}"}" echo -n "$var" } @@ -86,7 +83,7 @@ case "$WRAPFS_REPO" in 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" diff --git a/wrapfs-patch-release.sh b/wrapfs-patch-release.sh index 2c1f24b..02be6ab 100755 --- a/wrapfs-patch-release.sh +++ b/wrapfs-patch-release.sh @@ -9,7 +9,7 @@ _=${PATCH_FILE:=""} _=${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 @@ -20,17 +20,17 @@ eval set -- "$TEMP" 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 @@ -52,7 +52,7 @@ trim() { # remove leading whitespace characters var="${var#"${var%%[![:space:]]*}"}" # remove trailing whitespace characters - var="${var%"${var##*[![:space:]]}"}" + var="${var%"${var##*[![:space:]]}"}" echo -n "$var" } @@ -82,7 +82,7 @@ get_linux_version() { 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 @@ -102,7 +102,7 @@ case "$WRAPFS_REPO" in 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) ;; * ) @@ -118,7 +118,7 @@ runcmd git fetch korg --tags $LINUX_BRANCH if [[ "$LINUX_VERSION" != "" ]]; then runcmd git reset --hard "v$LINUX_VERSION" -else +else runcmd git pull korg ${LINUX_BRANCH} fi @@ -145,7 +145,7 @@ if [ "${RELEASE_PATCH}" == "yes" ]; then 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 -- 2.43.0