Created
December 11, 2013 16:03
-
-
Save nunogmartins/7913063 to your computer and use it in GitHub Desktop.
Script to download backfire version from openwrt servers, setup image configuration options and build the openwrt image
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 | |
# | |
# Copyright (c) 2012, 2013. Caixa Magica Software. | |
# Author: Nuno Martins <nuno.martins@caixamagica.pt> | |
# | |
# GNU LESSER GENERAL PUBLIC LICENSE | |
# Version 3, 29 June 2007 | |
# | |
# Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
# Everyone is permitted to copy and distribute verbatim copies | |
# of this license document, but changing it is not allowed. | |
# | |
# Full text can be viewed at: | |
# http://opensource.org/licenses/lgpl-3.0.html | |
# | |
# | |
# Description: | |
# | |
# Download OpenWrt source code and build | |
DESTINATION=openwrt | |
VERSION=1.0 | |
function update_and_install_feeds () | |
{ | |
scripts/feeds update -a | |
} | |
function add_necessary_packages () | |
{ | |
#svn co svn://svn.openwrt.org/openwrt/packages/libs/protobuf-c/ package/libprotobuf-c/ | |
#svn co svn://svn.openwrt.org/openwrt/packages/libs/jansson package/jansson | |
} | |
function download_openwrt () | |
{ | |
svn co svn://svn.openwrt.org/openwrt/tags/backfire_10.03.1 $1 | |
cd $1 | |
update_and_install_feeds | |
add_necessary_packages | |
cd - | |
} | |
function verify_packages() | |
{ | |
ubuntu_package=( subversion build-essential zlib1g-dev libfl-dev gawk libncurses5-dev quilt protobuf-c-compiler ) | |
ok=true | |
for up in "${ubuntu_package[@]}"; | |
do | |
if [ "$ok" == true ]; | |
then | |
package=$(dpkg -l | grep $up | awk '{ print $2 }';) | |
echo -n "Checking package $up " | |
if [ "$package" = "$up" ] ; | |
then | |
echo " You have it !" | |
else | |
echo "You don't have it and you need to install: " | |
ok=false | |
fi | |
else | |
echo "" | |
echo "To compile the software you need the following packages: " | |
echo "" | |
echo "${ubuntu_package[@]}" | |
exit | |
fi | |
done | |
} | |
function select_model_profile_and_packages() | |
{ | |
cd $1 | |
make menuconfig | |
cd - | |
} | |
function compile_selected_openwrt_image() | |
{ | |
cd $1 | |
make V=99 | |
cd - | |
} | |
function help () | |
{ | |
echo "You must choose one option: [ --help | --all | --dev ]" | |
} | |
case $1 in | |
"--all") | |
verify_packages | |
download_openwrt $DESTINATION | |
select_model_profile_and_packages $DESTINATION | |
compile_selected_openwrt_image $DESTINATION | |
;; | |
"--dev") | |
verify_packages | |
download_openwrt $DESTINATION | |
;; | |
"--help") | |
help | |
;; | |
*) | |
verify_packages | |
download_openwrt $DESTINATION | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment