[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r21713: {projects} All the tools required for a build of the Chumby One (in projects/chumby: . src src/tor src/tor/scripts)
Author: ioerror
Date: 2010-02-22 01:25:39 +0000 (Mon, 22 Feb 2010)
New Revision: 21713
Added:
projects/chumby/Makefile
projects/chumby/build/
projects/chumby/src/
projects/chumby/src/instructions.txt
projects/chumby/src/tor/
projects/chumby/src/tor/ipaddress
projects/chumby/src/tor/makeswap
projects/chumby/src/tor/scripts/
projects/chumby/src/tor/scripts/todo.txt
projects/chumby/src/tor/torexists.jpg
projects/chumby/src/tor/torinstall.jpg
projects/chumby/src/tor/torlog
projects/chumby/src/tor/torlogo.jpg
projects/chumby/src/tor/torrc
projects/chumby/src/tor/userhook2.resident
projects/chumby/src/userhook2
Modified:
projects/chumby/README
projects/chumby/build.sh
Log:
All the tools required for a build of the Chumby One
Added: projects/chumby/Makefile
===================================================================
--- projects/chumby/Makefile (rev 0)
+++ projects/chumby/Makefile 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,7 @@
+# This is a basic Makefile to produce a Chumby One package
+
+package: clean
+ ./build.sh
+
+clean:
+ rm -rf build/*
Modified: projects/chumby/README
===================================================================
--- projects/chumby/README 2010-02-21 23:27:49 UTC (rev 21712)
+++ projects/chumby/README 2010-02-22 01:25:39 UTC (rev 21713)
@@ -16,15 +16,11 @@
linux base. It possible to run common free software like Tor without too much
effort.
-If you'd like a set of custom compiled binaries ready to be packaged for the
-Chumby One, run the following:
+To download, compile and package Tor for the Chumby One, run the following:
- ./build.sh
+ make
-Once you've built libevent, zlib, OpenSSL, and Tor, you will be ready to create
-a mod for the Chumby One.
+If all goes well, you'll get a .zip file that is ready for distribution.
- # Steps to create the .tar.gz mod go here XXX TODO :-)
-
"Do you want to help with Tor? Great. Buy a Chumby One and fight
censorship with an alarm clock in your sleep."
Modified: projects/chumby/build.sh
===================================================================
--- projects/chumby/build.sh 2010-02-21 23:27:49 UTC (rev 21712)
+++ projects/chumby/build.sh 2010-02-22 01:25:39 UTC (rev 21713)
@@ -20,6 +20,9 @@
ZLIB_VER="1.2.3";
ZLIB_SRC="http://www.zlib.net/zlib-$ZLIB_VER.tar.gz";
+START_DIR="`pwd`";
+BUILD_DIR="`pwd`/build";
+SRC_DIR="`pwd`/src";
PATCH_DIR="`pwd`/patches";
TMP_DIR="`mktemp -d`";
@@ -66,12 +69,35 @@
echo "Building Tor $TOR_VER";
cd tor-$TOR_VER;
./configure --host=arm-linux \
- --with-libevent-dir=/home/chumby/tor/libevent-1.4.13-stable/.libs/ \
+ --with-libevent-dir=$TMP_DIR/libevent-$LIBEVENT_VER/.libs/ \
--with-openssl-dir=/usr/arm-linux/local/ssl/ \
-includedir=/usr/arm-linux/local/ssl/include/ \
- --with-zlib-dir=/home/chumby/tor/zlib-1.2.3/
+ --with-zlib-dir=$TMP_DIR/zlib-$ZLIB_VER/;
make
-cd $TMP_DIR;
-# Report useful information
-echo "Everything you seek is inside of $TMP_DIR - go forth and package!";
+# Now we'll build the mod
+echo "Copying the contents of $SRC_DIR to our build directory...";
+cp -arv $SRC_DIR/* $BUILD_DIR/;
+
+# Now we'll pack the following most current files into the build
+echo "Copying libevent into our build directory...";
+cp -v $TMP_DIR/libevent-$LIBEVENT_VER/.libs/*.so $BUILD_DIR/tor/libs/;
+cp -v $TMP_DIR/libevent-$LIBEVENT_VER/.libs/*.so.* $BUILD_DIR/tor/libs/;
+echo "Copying Tor into our build directory...";
+cp -v $TMP_DIR/tor-$TOR_VER/src/or/tor $BUILD_DIR/tor/;
+cp -v $TMP_DIR/tor-$TOR_VER/src/config/geoip $BUILD_DIR/tor/;
+
+echo "Creating tar.gz package for Chumby...";
+# This is how we build the actual package that the Chumby unpacks
+cd $BUILD_DIR/;
+tar -cvzf torpkg.tar.gz tor;
+# now zip it to be called torbridge_c1_fw1.0.3.zip
+echo "Creating .zip file for distribution...";
+zip torbridge_c1_fw1.0.3.zip torpkg.tar.gz \
+ instructions.txt userhook2;
+
+echo "It appears that everything worked!";
+echo "Your Chumby Tor bridge mod is located in " \
+ "$BUILD_DIR/torbridge_c1_fw1.0.3.zip";
+echo "All build files should be located in $TMP_DIR";
+echo "If the package is properly build, feel free to erase $TMP_DIR";
Added: projects/chumby/src/instructions.txt
===================================================================
--- projects/chumby/src/instructions.txt (rev 0)
+++ projects/chumby/src/instructions.txt 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,17 @@
+Unzip to the root directory of a blank USB thumb drive.
+
+The drive should have these files:
+
+userhook2
+torpkg.tar.gz
+
+Insert thumb drive into chumby One.
+Reboot.
+Wait.
+Once the Tor logo disappears, you may remove the thumb drive.
+
+The Tor install will persist through reboots.
+
+To remove the Tor install, hold down the screen while rebooting,
+and select "Restore factory settings" when the menu appears.
+The system will automatically reboot once the procedure is completed.
Added: projects/chumby/src/tor/ipaddress
===================================================================
--- projects/chumby/src/tor/ipaddress (rev 0)
+++ projects/chumby/src/tor/ipaddress 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ifconfig wlan0 | grep "inet addr" | awk -F ":" '{print $2}' | awk '{print $1}'
Property changes on: projects/chumby/src/tor/ipaddress
___________________________________________________________________
Added: svn:executable
+ *
Added: projects/chumby/src/tor/makeswap
===================================================================
--- projects/chumby/src/tor/makeswap (rev 0)
+++ projects/chumby/src/tor/makeswap 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ ! -e /mnt/storage/swap ]
+then
+ echo "Making 128M swapfile"
+ dd if=/dev/zero of=/mnt/storage/swap bs=1M count=128
+ mkswap /mnt/storage/swap
+fi
+swapon /mnt/storage/swap
+
Property changes on: projects/chumby/src/tor/makeswap
___________________________________________________________________
Added: svn:executable
+ *
Added: projects/chumby/src/tor/scripts/todo.txt
===================================================================
--- projects/chumby/src/tor/scripts/todo.txt (rev 0)
+++ projects/chumby/src/tor/scripts/todo.txt 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,3 @@
+add /psp/rfs1/userhook2 that loads the tor client and then shows the logo for three seconds on boot
+create an autoinstaller script that copies all the libraries to the right spots and sets everything up
+is there some way to confirm NAT/firewall operation automatically, or to notify a user if it's not working right?
Added: projects/chumby/src/tor/torexists.jpg
===================================================================
(Binary files differ)
Property changes on: projects/chumby/src/tor/torexists.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: projects/chumby/src/tor/torinstall.jpg
===================================================================
(Binary files differ)
Property changes on: projects/chumby/src/tor/torinstall.jpg
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: projects/chumby/src/tor/torlog
===================================================================
--- projects/chumby/src/tor/torlog (rev 0)
+++ projects/chumby/src/tor/torlog 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+RETURN="cgi-bin/custom/torlog"
+
+echo "Content-type: text/html"
+echo ""
+echo "<html><head>"
+
+echo "<title>Tor stats</title>"
+#echo "<meta http-equiv=\"Refresh\" content=\"10\";>"
+echo "</head></html>"
+echo "<body>"
+
+echo "Tor mod installed.<br><br>To remove the mod, go to special options mode (reboot while touching the screen) and select 'Restore Factory Defaults'. This will also remove all local network settings on the device.<br><br>"
+
+echo "You should see something like this at the bottom of this status page:<br>"
+echo "<pre>"
+echo "[notice] Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor."
+echo "</pre>"
+echo "If you do not, then it's likely your router is not allowing the tor port through to your chumby. You will need to configure your router to forward port 443 to your chumby's IP. See <a href="http://portforward.com">http://portforward.com</a> for help on how to do this.<br>"
+
+echo "<h4>torrc file:</h4>"
+echo "<pre>"
+#echo "Using torrc file at /mnt/storage/tor/torrc:<br><br>"
+echo "Using torrc file at /mnt/storage/tor/torrc (<a href="http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Hidden_screen_in_Control_Panel">turn on sshd and login</a> to modify this):<br><br>"
+cat /mnt/storage/tor/torrc
+echo "</pre>"
+
+echo "<hr/>"
+echo "<h4>Top process info</h4>"
+echo "<pre>"
+top -b -n 1 -d 0
+echo "</pre>"
+
+echo "<hr/>"
+
+echo "<h4>Memory usage stats</h4>"
+echo "<pre>"
+cat /proc/meminfo
+echo "</pre>"
+
+echo "<hr/>"
+
+echo "<h4>Tor log file</h4>"
+echo "<a href=\"/${RETURN}\">back</a>"
+echo "<pre>"
+cat /mnt/storage/tor/torlog.txt
+echo "</pre>"
+
+echo "<hr/>"
+
+echo "<a href=\"/${RETURN}\">back</a>"
+echo "</body></html>"
Property changes on: projects/chumby/src/tor/torlog
___________________________________________________________________
Added: svn:executable
+ *
Added: projects/chumby/src/tor/torlogo.jpg
===================================================================
(Binary files differ)
Property changes on: projects/chumby/src/tor/torlogo.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: projects/chumby/src/tor/torrc
===================================================================
--- projects/chumby/src/tor/torrc (rev 0)
+++ projects/chumby/src/tor/torrc 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,19 @@
+#
+# This is a torrc file tuned for a Chumby One
+#
+
+DataDirectory /mnt/storage/tor/.tor/
+AvoidDiskWrites 1
+RunAsDaemon 1
+BandwidthRate 24 KB
+BandwidthBurst 64 KB
+MaxAdvertisedBandwidth 64 KB
+GeoIPFile /mnt/storage/tor/geoip
+
+Log notice file /mnt/storage/tor/torlog.txt
+
+SocksPort 0
+ORPort 443
+BridgeRelay 1
+Exitpolicy reject *:*
+
Added: projects/chumby/src/tor/userhook2.resident
===================================================================
--- projects/chumby/src/tor/userhook2.resident (rev 0)
+++ projects/chumby/src/tor/userhook2.resident 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+##### Tor startup script, draft v0.1 - 12/28/2009
+#####
+##### If you see this on your machine, someone has installed tor onto your chumby
+##### This is not part of the standard chumby distribution. If you experience problems
+##### or slow performance due to Tor, you can remove Tor by going into special options mode
+##### (by touching the screen on reboot) and selecting "Restore Factory Settings".
+##### Note: you will lose all your other settings when you do this as well.
+
+##### bunnie@xxxxxxxxxx
+
+# Copyright (c) Chumby Industries, 2009-2010
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# make and activate swap space; tor can use a lot of RAM when running
+system("/mnt/storage/tor/makeswap");
+
+$ipaddress = `/mnt/storage/tor/ipaddress`;
+chomp $ipaddress;
+
+# throw up the tor logo
+system("/usr/bin/imgtool /mnt/storage/tor/torlogo.jpg");
+$ipmsg = "\"\<chumbyip\> is " . $ipaddress . ". ORPort is 443.\"";
+system("fbwrite $ipmsg");
+
+# set up log files in a fashion that users can browse it from the web, so they can check on tor's status
+system("rm -f /mnt/storage/tor/torlog.txt"); # nuke the old log file so we aren't leaking memory
+system("touch /mnt/storage/tor/torlog.txt");
+system("chmod a+r /mnt/storage/tor/torlog.txt"); # make sure the logfile is readable
+
+# now start the tor client
+$ENV{'LD_LIBRARY_PATH'} = '/lib:/lib:/usr/lib:/usr/local/lib:/mnt/storage/lib:/mnt/storage/local/lib';
+`/mnt/storage/tor/tor -f /mnt/storage/tor/torrc > /tmp/tor.log 2> /tmp/torerr.log`; # starts as a daemon
+
+sleep 5; # let the logo stay up for a couple seconds so people can see it
+
+# done!
Property changes on: projects/chumby/src/tor/userhook2.resident
___________________________________________________________________
Added: svn:executable
+ *
Added: projects/chumby/src/userhook2
===================================================================
--- projects/chumby/src/userhook2 (rev 0)
+++ projects/chumby/src/userhook2 2010-02-22 01:25:39 UTC (rev 21713)
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+##### Installs Tor in a semi-permanent fashion onto a chumby One device.
+##### draft v0.1 - 12/28/2009
+#####
+##### This script is run exactly once, when you try to install the Tor client the first time.
+#####
+##### This is not part of the standard chumby distribution. If you experience problems
+##### or slow performance due to Tor, you can remove Tor by going into special options mode
+##### (by touching the screen on reboot) and selecting "Restore Factory Settings".
+##### Note: you will lose all your other settings when you do this as well.
+
+##### bunnie@xxxxxxxxxx
+
+# Copyright (c) Chumby Industries, 2009-2010
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+# Should probably do a more strict version check someday
+$storage = '/mnt/storage';
+if ( !( -e $storage ) ) {
+ print "No /mnt/storage, this might not be a falconwing install. Aborting install.";
+ exit 0;
+}
+
+$pathname = '/mnt/storage/tor';
+if ( -e $pathname ) {
+ # don't run the script twice
+ system("imgtool /mnt/storage/tor/torexists.jpg"); # inform the user that it's already been installed
+ sleep 8;
+ exit 0;
+}
+
+# unpack tor
+system("tar -C /mnt/storage/ -xzf /mnt/usb/torpkg.tar.gz"); # torpkg has the tor/ path built into it
+system("imgtool /mnt/storage/tor/torinstall.jpg");
+
+# install the necessary libraries into the library path
+system("mkdir -p /mnt/storage/lib");
+system("mv -f /mnt/storage/tor/lib/* /mnt/storage/lib");
+
+# create symlinks so we can access the tor logfile from the web
+system("mkdir -p /psp/cgi-bin");
+system("rm -f /mnt/storage/tor/torlog.txt"); # nuke the old log file so we aren't leaking memory
+system("touch /mnt/storage/tor/torlog.txt");
+system("chmod a+r /mnt/storage/tor/torlog.txt");
+
+# copy over the cgi script that generates the logfile page
+system("cp -f /mnt/storage/tor/torlog /psp/cgi-bin/");
+system("cp -f /mnt/storage/tor/sshd_on /psp/cgi-bin/");
+system("chmod a+rx /psp/cgi-bin/torlog");
+system("chmod a+rx /psp/cgi-bin/sshd_on");
+
+# install the boot script
+system("mkdir -p /psp/rfs1/");
+system("mv /mnt/storage/tor/userhook2.resident /psp/rfs1/userhook2"); # this will be run on boot automagically
+
+# sync it all up so we don't lose it on reboot
+system("sync");
+system("sync");
+
+# the tor userhook2 script should now run...