summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Järvstrand <tjarvstrand@gmail.com>2018-01-21 21:32:19 +0100
committerJack Humbert <jack.humb@gmail.com>2018-01-25 06:59:35 +0100
commitd837ab586a127721679ac1971874f52e5c72aefb (patch)
tree74003b83e7e2fe9b22b85dec55b9959dfe657d31
parent9a91b42e922ed152cb548c529233cf7f2b6d5183 (diff)
downloadqmk_firmware-d837ab586a127721679ac1971874f52e5c72aefb.tar.gz
qmk_firmware-d837ab586a127721679ac1971874f52e5c72aefb.tar.xz
Make new_project.sh a bit more robust
-rwxr-xr-xutil/new_project.sh18
1 files changed, 5 insertions, 13 deletions
diff --git a/util/new_project.sh b/util/new_project.sh
index 18d16e560..0f507b679 100755
--- a/util/new_project.sh
+++ b/util/new_project.sh
@@ -12,19 +12,11 @@ cd "$(dirname "$0")/.."
KEYBOARD=$1
KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}')
-mkdir keyboards/$1
-mkdir keyboards/$1/keymaps
-mkdir keyboards/$1/keymaps/default
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" quantum/template/template.h > keyboards/$KEYBOARD/$KEYBOARD.h
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/template.c > keyboards/$KEYBOARD/$KEYBOARD.c
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/config.h > keyboards/$KEYBOARD/config.h
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/readme.md > keyboards/$KEYBOARD/readme.md
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/Makefile > keyboards/$KEYBOARD/Makefile
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/rules.mk > keyboards/$KEYBOARD/rules.mk
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/config.h > keyboards/$KEYBOARD/keymaps/default/config.h
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/keymap.c > keyboards/$KEYBOARD/keymaps/default/keymap.c
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/Makefile > keyboards/$KEYBOARD/keymaps/default/Makefile
-sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/readme.md > keyboards/$KEYBOARD/keymaps/default/readme.md
+cp -r quantum/template keyboards/$KEYBOARD
+mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c
+mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h
+find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD%;$KEYBOARD;g" {} \;
+find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \;
echo "######################################################"
echo "# /keyboards/$KEYBOARD project created. To start"