Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
NODEJS=$(if $(shell which nodejs),nodejs,node)
PIP_USER_SWITCH=$(if $(VIRTUAL_ENV),,--user)

TEMPLATES_JS=app/js/templates.js
HANDLEBARS_FILES=$(wildcard app/templates/*.handlebars) # Used to generate templates.js
IMAGE=cerowrt/releases/openwireless-openwrt-squashfs-sysupgrade.bin

.PHONY: all
all: $(TEMPLATES_JS)
all: templates image

.PHONY: templates
templates: $(TEMPLATES_JS)

.PHONY: image
image:
git submodule update --init
cp OWrt/config-OWrt cerowrt/.config
if ! grep '^src-git cero' cerowrt/feeds.conf.default; then \
echo 'src-git cero https://github.com/dtaht/ceropackages-3.10' >> cerowrt/feeds.conf.default; \
fi
./cerowrt/scripts/feeds update
cp -r ow-python/python-mini-eff ./cerowrt/feeds/oldpackages/lang/
./cerowrt/scripts/feeds update -a
./sendToBuild
make -C cerowrt
mkdir -p cerowrt/releases
cp cerowrt/bin/ar71xx/openwrt-ar71xx-generic-wndr3800-squashfs-sysupgrade.bin $(IMAGE)
@if [ ! -f $(IMAGE) ]; then \
echo "ERROR: For some reason $IMAGE failed to generate!"; \
exit 1; \
fi

.PHONY: clean
clean:
rm -f $(TEMPLATES_JS)
rm -rf cerowrt/releases/
grep -v '^src-git cero' cerowrt/feeds.conf.default >feeds.conf.tmp
mv feeds.conf.tmp cerowrt/feeds.conf.default


$(TEMPLATES_JS): $(HANDLEBARS_FILES)
Expand All @@ -16,6 +44,21 @@ $(TEMPLATES_JS): $(HANDLEBARS_FILES)
./node_modules/handlebars/bin/handlebars -f $(TEMPFILE) $(HANDLEBARS_FILES)
mv -f $(TEMPFILE) $(TEMPLATES_JS)

.PHONY: deps
deps:
npm install
pip install $(PIP_USER_SWITCH) -qr requirements.txt

# This should depend on "all" instead. See note below for assert_templates_js_up_to_date
.PHONY: test
test: assert_templates_js_up_to_date deps
scripts/unit
$(NODEJS) -e "require('grunt').tasks(['test']);"

.PHONY: test-selenium
test-selenium:
python -m unittest discover -s selenium/ -p '*_test.py'


# NOTE: assert_templates_js_up_to_date is a temporary workaround to confirm
# that templates.js is up-to-date with the handlebars templates used to
Expand All @@ -32,4 +75,7 @@ $(TEMPLATES_JS): $(HANDLEBARS_FILES)
assert_templates_js_up_to_date:
$(eval TEMPFILE=$(shell mktemp --suffix _templates.js))
./node_modules/handlebars/bin/handlebars -f $(TEMPFILE) $(HANDLEBARS_FILES)
diff --brief $(TEMPFILE) $(TEMPLATES_JS) # exit=1 if different
if ! diff --brief $(TEMPFILE) $(TEMPLATES_JS); then \
echo 'Error: templates.js out-of-date. Run `make app/js/templates.js`' 2>&1; \
exit 1; \
fi
47 changes: 1 addition & 46 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
#!/bin/bash


IMAGE="releases/openwireless-openwrt-squashfs-sysupgrade.bin"

git submodule init
git submodule update

#build router image
echo "building openwireless"

#copy the config (kernel + packages)
cp OWrt/config-OWrt cerowrt/.config

#setup the package building system
cd cerowrt

echo 'src-git cero https://github.com/dtaht/ceropackages-3.10' >> feeds.conf.default

./scripts/feeds update
#copy over python package
cp -r ../ow-python/python-mini-eff ./feeds/oldpackages/lang/
./scripts/feeds update -a
#./scripts/feeds install libnettle
#./scripts/feeds install python-mini-eff
#./scripts/feeds install gnupg
#./scripts/feeds install tor



#customize the file system
cd ..
./sendToBuild
cd cerowrt

echo "building cerowrt"
make

cd ..

mkdir -p releases
cp cerowrt/bin/ar71xx/openwrt-ar71xx-generic-wndr3800-squashfs-sysupgrade.bin $IMAGE

if ! [ -f $IMAGE ]; then
echo "ERROR: For some reason $IMAGE failed to generate!"
exit 1
fi

make image
4 changes: 3 additions & 1 deletion run-selenium-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash -e

python -m unittest discover -s selenium/ -p '*_test.py'
# NOTE: Once all machines have been updated to use the Makefile
# directly, remove this script.
make test-selenium
25 changes: 3 additions & 22 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@
# ln -s ../../run-tests.sh .git/hooks/pre-push
#

# Install required packages
npm install
if [ -z "$VIRTUAL_ENV" ] ; then
USER=--user
else
USER=
fi
pip install $USER -qr requirements.txt

if ! make assert_templates_js_up_to_date ; then
echo 'Error: templates.js out-of-date. Run `make app/js/templates.js`'
exit 1
fi

scripts/unit
if which nodejs ; then
NODEJS=nodejs
else
NODEJS=node
fi

$NODEJS -e "require('grunt').tasks(['test']);"
# NOTE: Once all machines have been updated to use the Makefile
# directly, remove this script.
make test
2 changes: 1 addition & 1 deletion sendAppToRouter
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cd $(dirname $0)

[email protected]
sync() {
make app/js/templates.js && \
make templates && \
rsync -au --no-owner --no-group app/ $TARGET:/www/ && \
rsync -au --no-owner --no-group routerapi/ $TARGET:/www/cgi-bin/routerapi/ && \
rsync -au --no-owner --no-group etc/lighttpd/lighttpd.conf $TARGET:/etc/lighttpd/lighttpd.conf && \
Expand Down