diff --git a/Makefile b/Makefile index 29fc860..6ecd3e5 100644 --- a/Makefile +++ b/Makefile @@ -16,17 +16,29 @@ MOUNT_POINT=image_stuff/image OPENWRT_FOLDER=image_stuff/openwrt OPENWRT_CONFIG_FOLDER=$(OPENWRT_FOLDER)/conf +WORKFOLDER=tmp + +###IRC deployment +IRC_GITHUB_ULR=git://github.com/jrosdahl/miniircd.git +IRC_WORK_FOLDER=$(WORKFOLDER)/irc +IRC_SRC_SERVER=$(IRC_WORK_FOLDER)/miniircd +IRC_TARGET_SERVER=$(PB_SRC_FOLDER)/bin/miniircd.py .DEFAULT_GOAL = package +$(IRC_TARGET_SERVER): + mkdir -p $(WORKFOLDER) + git clone $(IRC_GITHUB_ULR) $(IRC_WORK_FOLDER) + cp $(IRC_SRC_SERVER) $(IRC_TARGET_SERVER) + $(VERSION): echo "$(PACKAGE_NAME)" > $(VERSION_FILE) -$(PACKAGE): $(VERSION) +$(PACKAGE): $(IRC_TARGET_SERVER) $(VERSION) tar czf $@ $(PB_FOLDER) -$(IMAGE_FILE): $(VERSION) $(SRC_IMAGE_UNPACKED) $(OPENWRT_CONFIG_FOLDER) +$(IMAGE_FILE): $(IRC_TARGET_SERVER) $(VERSION) $(SRC_IMAGE_UNPACKED) $(OPENWRT_CONFIG_FOLDER) mkdir -p $(MOUNT_POINT) echo "#### Mounting image-file" sudo mount -o loop,rw,sync $(SRC_IMAGE_UNPACKED) $(MOUNT_POINT) @@ -62,6 +74,9 @@ package: $(PACKAGE) all: package shortimage clean: cleanimage + rm -fr $(WORKFOLDER) + rm -fr $(IRC_WORK_FOLDER) + rm -f $(IRC_TARGET_SERVER) rm -f $(PACKAGE) rm -f $(VERSION_FILE) diff --git a/piratebox/piratebox/conf/irc.conf b/piratebox/piratebox/conf/irc.conf new file mode 100644 index 0000000..0c4c922 --- /dev/null +++ b/piratebox/piratebox/conf/irc.conf @@ -0,0 +1,13 @@ +### Configuration file for mniircd server + + +IRC_CONFIG_FOLDER=$PIRATEBOX_FOLDER/conf/irc + +#Save state ; keeps topic config. Enable with removing # +#IRC_STATEDIR=$IRC_CONFIG_FOLDER/state + +#MOTD Message +IRC_MOTD=$IRC_CONFIG_FOLDER/motd.txt + + + diff --git a/piratebox/piratebox/conf/irc/motd.txt b/piratebox/piratebox/conf/irc/motd.txt new file mode 100644 index 0000000..9fbc93d --- /dev/null +++ b/piratebox/piratebox/conf/irc/motd.txt @@ -0,0 +1,13 @@ +Welcome to IRC-Piratebox! + +Inspired by pirate radio and the free culture movment, PirateBox is a self-contained mobile collaboration and file sharing +device. PirateBox utilizes Free, Libre and Open Source software (FLOSS) to create mobile wireless file sharing networks +where users can anonymously share images, video, audio, documents, and other digital content. + +PirateBox is designed to be safe and secure. No logins are required and no user data is logged. The system is purposely not +connected to the Internet in order to prevent tracking and preserve user privacy. + +PirateBox was created by David Darts and is registered under a Free Art License (2011). To learn more about the project or +to find out how to build your own PirateBox system, please visit http://wiki.daviddarts.com/piratebox + + diff --git a/piratebox/piratebox/conf/piratebox.conf b/piratebox/piratebox/conf/piratebox.conf index 97d6bf5..9928260 100644 --- a/piratebox/piratebox/conf/piratebox.conf +++ b/piratebox/piratebox/conf/piratebox.conf @@ -3,11 +3,6 @@ ## written by Matthias Strubel (matthias.strubel@aod-rpg.de) 2011-02-22 ## licenced by gpl ; feel free to improve or send me feedback ## -## 2012-04-12 Created -## 2012-06-08 Changed IP Stuff to generating dnsmasq.conf stuff -## ADDed SubConfig for IPV6 config -## Changed Order of config -## ######## ####### @@ -150,5 +145,10 @@ LIGHTTPD_USER=nobody LIGHTTPD_GROUP=nogroup +#------------------------ IRC Configuration + +#Switch to yes if you want to enable the IRC-Server +ENABLE_IRC_SERVER="no" + #------------------------ Hook in user-config . $PIRATEBOX_FOLDER/conf/hook_custom.conf diff --git a/piratebox/piratebox/init.d/piratebox b/piratebox/piratebox/init.d/piratebox index 34b494d..01b3b57 100755 --- a/piratebox/piratebox/init.d/piratebox +++ b/piratebox/piratebox/init.d/piratebox @@ -8,7 +8,7 @@ # Default-Start: 2 3 4 5 # Default-Stop: 6 1 0 # Short-Description: All services around piratebox -# Description: Based on /opt/piratebox/conf/piratebox.conf starts: * DNSMASQ * HOSTAPD * DROOPY * WLAN-config * CHAT +# Description: Based on /opt/piratebox/conf/piratebox.conf starts several services ### END INIT INFO ### @@ -29,9 +29,11 @@ PIDFILE_HOSTAPN=/var/run/piratebox_hostapn.pid PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid +PIDFILE_IRC=/opt/piratebox/tmp/irc.pid PIRATEBOX=/opt/piratebox CONF=$PIRATEBOX/conf/piratebox.conf +CONF_IRC=$PIRATEBOX/conf/irc.conf #CONF_DROOPY=/opt/piratebox/conf/droopy.conf #not used CONF_APN=$PIRATEBOX/conf/hostapd.conf @@ -148,6 +150,22 @@ case "$1" in start-stop-daemon -m --start --background --pidfile $PIDFILE_SHOUTBOX --startas $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF log_end_msg $? fi + + #Start IRC Server + if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then + + . $CONF_IRC + + IRC_PARMS="--daemon --motd $IRC_MOTD " + + if [ ! -z $STATEDIR ] ; then + IRC_PARMS=" $IRCPARMS --statedir $STATEDIR " + fi + + log_daemon_msg "Starting Miniircd..." + start-stop-daemon -m --start --pidfile $PIDFILE_IRC --exec python $PIRATEBOX/bin/miniircd.py -- $IRC_PARMS + log_end_msg $? + fi fi $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" @@ -159,6 +177,12 @@ case "$1" in $PIRATEBOX/bin/hooks/hook_piratebox_stop.sh "$CONF" + if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then + log_daemon_msg "Stopping IRC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE_IRC + log_end_msg $? + fi + if [ "$USE_APN" = "yes" ] ; then log_daemon_msg "Stopping hostap... " start-stop-daemon --stop --quiet --pidfile $PIDFILE_HOSTAPN --oknodo --startas "hostapd" diff --git a/piratebox/piratebox/init.d/piratebox_alt b/piratebox/piratebox/init.d/piratebox_alt index 427a969..7e7930d 100755 --- a/piratebox/piratebox/init.d/piratebox_alt +++ b/piratebox/piratebox/init.d/piratebox_alt @@ -27,11 +27,11 @@ PIDFILE_HOSTAPN=/var/run/piratebox_hostapn.pid PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid - +PIDFILE_IRC=/opt/piratebox/tmp/irc.pid PIRATEBOX=/opt/piratebox CONF=$PIRATEBOX/conf/piratebox.conf -#CONF_DROOPY=/opt/piratebox/conf/droopy.conf #not used +CONF_IRC=$PIRATEBOX/conf/irc.conf CONF_APN=$PIRATEBOX/conf/hostapd.conf #Some extra config files for dnsmasq @@ -154,6 +154,20 @@ case "$1" in start-stop-daemon -S -m -b -p $PIDFILE_SHOUTBOX -x $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF echo $? fi + + + #Start IRC Server + if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then + . $CONF_IRC + IRC_PARMS="--daemon --motd $IRC_MOTD " + + if [ ! -z $STATEDIR ] ; then + IRC_PARMS=" $IRCPARMS --statedir $STATEDIR " + fi + echo "Starting Miniircd..." + start-stop-daemon -m -S -p $PIDFILE_IRC --exec python $PIRATEBOX/bin/miniircd.py -- $IRC_PARMS + echo $? + fi fi $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" @@ -189,6 +203,12 @@ case "$1" in echo $? fi + if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then + echo "Stopping IRC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE_IRC + echo $? + fi + echo "Stopping lighttpd..."