blob: dd16e6e38880178e6f50b9a2cd61ef3fc0e6a19d [file] [log] [blame]
#!/usr/bin/env bash
BASE=$1
DESTINATION=$2
DTS2REPL_SCRIPT=$DESTINATION/tools/dts2repl-version.sh
# Search for marker in the original script and add 1 to skip also the line with marker
SKIP_LINES=$(grep "END OF VERSION CHECK" $BASE/tools/dts2repl-version.sh -n | cut -f1 -d:)
SKIP_LINES=$((SKIP_LINES + 1))
# Get current dts2repl version
DTS2REPL_VERSION=$($BASE/tools/dts2repl-version.sh --commit)
# Construct dts2repl-version.sh script
install -m 755 /dev/null $DTS2REPL_SCRIPT
cat <<EOF >>$DTS2REPL_SCRIPT
#!/usr/bin/env bash
DTS2REPL_VERSION=$DTS2REPL_VERSION
EOF
tail -n +$SKIP_LINES $BASE/tools/dts2repl-version.sh >> $DTS2REPL_SCRIPT