Skip to content

Instantly share code, notes, and snippets.

@MattAtkinson
Created January 23, 2017 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MattAtkinson/3f50a76e77391cafe910877c0cf15a19 to your computer and use it in GitHub Desktop.
Save MattAtkinson/3f50a76e77391cafe910877c0cf15a19 to your computer and use it in GitHub Desktop.
#!/bin/bash
#getting user input for name
name=${1}
namecap="$(tr '[:lower:]' '[:upper:]' <<< ${name:0:1})${name:1}"
#making sure user provided a name
if [ $# -eq 0 ]
then
printf "Please provide a name for your new application\ne.g. ./createapp.sh sensorapp\n"
exit
fi
#downloading switch example to use as base for application
echo Creating new application: $name
git clone https://github.com/CreatorDev/w1-switchcounter.git $name
#renaming files and folders
mv $name/Switch $name/$namecap
mv $name/$namecap/switch.c $name/$namecap/$name.c
#configuring makefile
sed -i "s/switch/$name/g" $name/$namecap/Makefile $name/Makefile
sed -i "s/Switch/$namecap/g" $name/Makefile
#adding new application to feed
cd ../creator-sdk
./scripts/feeds update -a && ./scripts/feeds install -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment