first implementation of IRC Server miniircd

This commit is contained in:
Matthias Strubel 2013-03-29 09:22:07 +01:00
parent 790b50740f
commit 1aacd6fc2c
6 changed files with 95 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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..."