make new_project.sh work correctly on osx too

This commit is contained in:
skullY 2018-03-23 22:40:12 -07:00
parent 3ee59a79aa
commit 38769dde32

View File

@ -7,16 +7,23 @@ if [ -z "$1" ]; then
exit 1 exit 1
fi fi
if [ -e "keyboards/$1" ]; then
echo "Error! keyboards/$1 already exists!"
exit 1
fi
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
KEYBOARD=$1 KEYBOARD=$1
KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}')
KEYBOARD_NAME=$(basename $1)
KEYBOARD_NAME_UPPERCASE=$(echo $KEYBOARD_NAME | awk '{print toupper($0)}')
cp -r quantum/template keyboards/$KEYBOARD cp -r quantum/template keyboards/$KEYBOARD
mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c mv keyboards/${KEYBOARD}/template.c keyboards/${KEYBOARD}/${KEYBOARD_NAME}.c
mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h mv keyboards/${KEYBOARD}/template.h keyboards/${KEYBOARD}/${KEYBOARD_NAME}.h
find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD%;$KEYBOARD;g" {} \; find keyboards/${KEYBOARD} -type f -exec sed -i '' -e "s;%KEYBOARD%;${KEYBOARD_NAME};g" {} \;
find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; find keyboards/${KEYBOARD} -type f -exec sed -i '' -e "s;%KEYBOARD_UPPERCASE%;${KEYBOARD_NAME_UPPERCASE};g" {} \;
echo "######################################################" echo "######################################################"
echo "# /keyboards/$KEYBOARD project created. To start" echo "# /keyboards/$KEYBOARD project created. To start"