1#!/bin/bash 2set -e 3set -u 4 5USAGE="Usage: conversion_to_1.0.sh src-path dest-path" 6 7echo "BTstack conversion to v1.0 helper" 8echo "BlueKitchen GmbH, 2016" 9echo 10 11# command line checks, bash 12if [ $# -ne 2 ]; then 13 echo ${USAGE} 14 exit 0 15fi 16SRC=$1 17DEST=$2 18 19echo "Creating copy of $SRC at $DEST" 20cp -r $SRC/ $DEST 21 22echo "Updating function calls" 23 24# simple function rename 25find $DEST -type f -print0 | xargs -0 sed -i -f convert.sed 26 27# complext function rename using coccinelle 28command -v spatch >/dev/null 2>&1 || { echo >&2 "spatch from cocinelle required but not installed. Aborting."; exit 1; } 29spatch --sp-file convert.cocci --in-place --dir $DEST > /dev/null # 2>&1 30echo "Done. Good luck!" 31 32 33