Created
November 3, 2016 16:38
-
-
Save MattAtkinson/6577c6f06359aac9cb683f6bdc6abd32 to your computer and use it in GitHub Desktop.
This file contains 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 | |
#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 ../openwrt-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