Last active
January 9, 2017 05:32
-
-
Save flashvoid/91fe970428c062affd1da5cc9bbc1649 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
replace_template_entries() { | |
MAP=$1 | |
REPLACEMENT_TAG=$2 | |
ACTION=$3 | |
TOOLCHAIN_DOCKERFILE="/tmp/testsetup" | |
echo "MAP=$MAP, REPLACEMENT_TAG=$REPLACEMENT_TAG, ACTION=$ACTION" | |
for PAIR in $MAP | |
do | |
SRC=$(echo $PAIR | cut -f1 -d=) | |
DEST=$(echo $PAIR | cut -f2 -d=) | |
sed -i.bak "/$REPLACEMENT_TAG/i \\ | |
$ACTION $SRC $DEST" $TOOLCHAIN_DOCKERFILE | |
done | |
sed -i.bak "s#$REPLACEMENT_TAG##g" $TOOLCHAIN_DOCKERFILE | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment