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_FOLDER=image_stuff/openwrt
OPENWRT_CONFIG_FOLDER=$(OPENWRT_FOLDER)/conf 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 .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): $(VERSION):
echo "$(PACKAGE_NAME)" > $(VERSION_FILE) echo "$(PACKAGE_NAME)" > $(VERSION_FILE)
$(PACKAGE): $(VERSION) $(PACKAGE): $(IRC_TARGET_SERVER) $(VERSION)
tar czf $@ $(PB_FOLDER) 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) mkdir -p $(MOUNT_POINT)
echo "#### Mounting image-file" echo "#### Mounting image-file"
sudo mount -o loop,rw,sync $(SRC_IMAGE_UNPACKED) $(MOUNT_POINT) sudo mount -o loop,rw,sync $(SRC_IMAGE_UNPACKED) $(MOUNT_POINT)
@ -62,6 +74,9 @@ package: $(PACKAGE)
all: package shortimage all: package shortimage
clean: cleanimage clean: cleanimage
rm -fr $(WORKFOLDER)
rm -fr $(IRC_WORK_FOLDER)
rm -f $(IRC_TARGET_SERVER)
rm -f $(PACKAGE) rm -f $(PACKAGE)
rm -f $(VERSION_FILE) 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 ## written by Matthias Strubel (matthias.strubel@aod-rpg.de) 2011-02-22
## licenced by gpl ; feel free to improve or send me feedback ## 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 LIGHTTPD_GROUP=nogroup
#------------------------ IRC Configuration
#Switch to yes if you want to enable the IRC-Server
ENABLE_IRC_SERVER="no"
#------------------------ Hook in user-config #------------------------ Hook in user-config
. $PIRATEBOX_FOLDER/conf/hook_custom.conf . $PIRATEBOX_FOLDER/conf/hook_custom.conf

View file

@ -8,7 +8,7 @@
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 6 1 0 # Default-Stop: 6 1 0
# Short-Description: All services around piratebox # 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 ### END INIT INFO
### ###
@ -29,9 +29,11 @@ PIDFILE_HOSTAPN=/var/run/piratebox_hostapn.pid
PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid PIDFILE_DNSMASQ=/var/run/piratebox_dnsmasq.pid
PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid
PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid
PIDFILE_IRC=/opt/piratebox/tmp/irc.pid
PIRATEBOX=/opt/piratebox PIRATEBOX=/opt/piratebox
CONF=$PIRATEBOX/conf/piratebox.conf CONF=$PIRATEBOX/conf/piratebox.conf
CONF_IRC=$PIRATEBOX/conf/irc.conf
#CONF_DROOPY=/opt/piratebox/conf/droopy.conf #not used #CONF_DROOPY=/opt/piratebox/conf/droopy.conf #not used
CONF_APN=$PIRATEBOX/conf/hostapd.conf 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 start-stop-daemon -m --start --background --pidfile $PIDFILE_SHOUTBOX --startas $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF
log_end_msg $? log_end_msg $?
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
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 fi
$PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF"
@ -159,6 +177,12 @@ case "$1" in
$PIRATEBOX/bin/hooks/hook_piratebox_stop.sh "$CONF" $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 if [ "$USE_APN" = "yes" ] ; then
log_daemon_msg "Stopping hostap... " log_daemon_msg "Stopping hostap... "
start-stop-daemon --stop --quiet --pidfile $PIDFILE_HOSTAPN --oknodo --startas "hostapd" 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_DNSMASQ=/var/run/piratebox_dnsmasq.pid
PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid PIDFILE_LIGHTTPD=/opt/piratebox/tmp/lighttpd.pid
PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid
PIDFILE_IRC=/opt/piratebox/tmp/irc.pid
PIRATEBOX=/opt/piratebox PIRATEBOX=/opt/piratebox
CONF=$PIRATEBOX/conf/piratebox.conf 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 CONF_APN=$PIRATEBOX/conf/hostapd.conf
#Some extra config files for dnsmasq #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 start-stop-daemon -S -m -b -p $PIDFILE_SHOUTBOX -x $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF
echo $? 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 fi
$PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF" $PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF"
@ -189,6 +203,12 @@ case "$1" in
echo $? echo $?
fi fi
if [ "$ENABLE_IRC_SERVER" = "yes" ] ; then
echo "Stopping IRC..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE_IRC
echo $?
fi
echo "Stopping lighttpd..." echo "Stopping lighttpd..."