diff --git a/.gitignore b/.gitignore index d529ca8..7cfd078 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ piratebox/piratebox/version piratebox/piratebox/www/chat_content.html image_stuff/* -piratebox/piratebox/bin/miniircd.py piratebox_ws_* piratebox-ws_* +tmp/* +piratebox/piratebox/bin/miniircd.py diff --git a/Makefile b/Makefile index 56a1a91..868272d 100644 --- a/Makefile +++ b/Makefile @@ -17,18 +17,31 @@ OPENWRT_FOLDER=image_stuff/openwrt OPENWRT_CONFIG_FOLDER=$(OPENWRT_FOLDER)/conf OPENWRT_BIN_FOLDER=$(OPENWRT_FOLDER)/bin +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) echo `git status -sb --porcelain` >> $(VERSION_FILE) echo ` git log -1 --oneline` >> $(VERSION_FILE) -$(PACKAGE): $(VERSION) +$(PACKAGE): $(IRC_TARGET_SERVER) $(VERSION) tar czf $@ $(PB_FOLDER) -$(IMAGE_FILE): $(VERSION) $(SRC_IMAGE_UNPACKED) $(OPENWRT_CONFIG_FOLDER) $(OPENWRT_BIN_FOLDER) +$(IMAGE_FILE): $(IRC_TARGET_SERVER) $(VERSION) $(SRC_IMAGE_UNPACKED) $(OPENWRT_CONFIG_FOLDER) $(OPENWRT_BIN_FOLDER) mkdir -p $(MOUNT_POINT) echo "#### Mounting image-file" sudo mount -o loop,rw,sync $(SRC_IMAGE_UNPACKED) $(MOUNT_POINT) @@ -70,6 +83,13 @@ 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) + cleanimage: - rm -f $(TGZ_IMAGE_FILE) - rm -f $(SRC_IMAGE_UNPACKED) @@ -77,9 +97,6 @@ cleanimage: - rm -v $(IMAGE_FILE) - rm -rv $(OPENWRT_BIN_FOLDER) -clean: cleanimage - rm -f $(PACKAGE) - rm -f $(VERSION_FILE) shortimage: $(IMAGE_FILE) $(TGZ_IMAGE_FILE) diff --git a/README.md b/README.md index 247fc96..e3c36f5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ PirateBox scripts can: * Optional Inihibit starting upload-script * Optional Timesave script (for devices without RTC) - can be found in piratebox/bin/timesave.sh * Optional Poll for WLAN device until it available (for USB wifi cards) - + * Optional IRC-Server More information can be found ont http://piratebox.aod-rpg.de Installation-HowTo und current Download-Link: http://piratebox.aod-rpg.de/dokuwiki/doku.php/piratebox_lighttpd 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 cd531c3..73b3f81 100644 --- a/piratebox/piratebox/conf/piratebox.conf +++ b/piratebox/piratebox/conf/piratebox.conf @@ -170,5 +170,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 1bbba88..4404133 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 ### @@ -30,9 +30,11 @@ PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid PIDFILE_RADVD=/opt/piratebox/tmp/radvd.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 @@ -179,6 +181,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" @@ -190,6 +208,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 284987f..1412cf7 100755 --- a/piratebox/piratebox/init.d/piratebox_alt +++ b/piratebox/piratebox/init.d/piratebox_alt @@ -28,12 +28,11 @@ PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid PIDFILE_RADVD=/opt/piratebox/tmp/radvd.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 @@ -172,7 +171,20 @@ case "$1" in echo "Starting global chat service..." start-stop-daemon -S -m -b -p $PIDFILE_SHOUTBOX -x $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF echo $? - fi + 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" @@ -215,6 +227,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..."