mirror of
https://github.com/PirateBox-Dev/PirateBoxScripts_Webserver.git
synced 2023-12-14 07:22:58 +01:00
Nearly everything converted to modules
This commit is contained in:
parent
21a9137b84
commit
3e00601221
|
@ -1,169 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Matthias Strubel (c) 2013-2014
|
|
||||||
# licenced with GPL-3
|
|
||||||
#
|
|
||||||
# Generate severall configuration files out of piratebox.conf
|
|
||||||
# conf/hosts_generated
|
|
||||||
# conf/dnsmasq_generated.conf
|
|
||||||
# conf/radvd_generated.conf
|
|
||||||
# conf/lighttpd/env
|
|
||||||
# conf/hosts_mesh
|
|
||||||
#
|
|
||||||
# There are files for default configuration or adding custom stuff:
|
|
||||||
# conf/hosts
|
|
||||||
# conf/dnsmasq_default.conf
|
|
||||||
#
|
|
||||||
# it is using the following VARS out of piratebox.conf:
|
|
||||||
# NET = The network of your box i.e. 192.168.1
|
|
||||||
# IP_SHORT = The ip of the piratebox i.e. 1 results 192.168.1.1
|
|
||||||
# START_LEASE = Range of dhcp leases start 10
|
|
||||||
# END_LEASE = end 250
|
|
||||||
# LEASE_DURATION = lease time 30min
|
|
||||||
# HOSTNAME = piratebox.lan - o'rly? Maybe generate some additional stuff here
|
|
||||||
# -
|
|
||||||
# GLOBAL_CHAT = Enable Broadcasts
|
|
||||||
# GLOBAL_DEST = Broadcast IP destinations
|
|
||||||
# PYTHONPATH = Path of PirateBox python libs
|
|
||||||
# GEN_CHATFILE = generated html chatfile
|
|
||||||
# PIRATEBOX = PirateBox Folder
|
|
||||||
# CHATFILE = data store for Shoutbox-content
|
|
||||||
#
|
|
||||||
# NODE_CONFIG = Config file for Mesh-Node parameters
|
|
||||||
# -
|
|
||||||
# ipv6.conf (loaded within piratebox.conf)
|
|
||||||
# IPV6_ENABLE = enables IPv6 config
|
|
||||||
# IPV6_ADVERT = which service for advertising IPv6 Prefix
|
|
||||||
# IPV6_MASK = Netmask
|
|
||||||
# IPV6_PREFIX = Which prefix should be announced.
|
|
||||||
# -
|
|
||||||
# node.conf
|
|
||||||
# NODE_CONFIG_ACTIVE = if yes, configure special ipv6-node-hostname
|
|
||||||
# NODE_IPV6_IP = Device specific IP
|
|
||||||
# NODE_NAME & NODE_GEN = Settings for setting up Hostname
|
|
||||||
#
|
|
||||||
# Matthias Strubel -- 08.06.2012
|
|
||||||
# licenced with GPL-3
|
|
||||||
|
|
||||||
CONFIG_PATH="conf"
|
|
||||||
DNSMASQ_CONFIG=""
|
|
||||||
HOSTS_CONFIG=""
|
|
||||||
DEFAULT_HOSTS=""
|
|
||||||
LEASE_FILE=""
|
|
||||||
RADVD_CONFIG=""
|
|
||||||
LIGHTTPD_ENV_CONFIG=""
|
|
||||||
AVAHI_SRC=""
|
|
||||||
AVAHI_CONFIG=""
|
|
||||||
|
|
||||||
set_pathnames() {
|
|
||||||
CONFIG_PATH=$1/conf
|
|
||||||
|
|
||||||
|
|
||||||
RADVD_CONFIG=$CONFIG_PATH/radvd_generated.conf
|
|
||||||
LEASE_FILE=$LEASE_FILE_LOCATION
|
|
||||||
LIGHTTPD_ENV_CONFIG=$CONFIG_PATH/lighttpd/conf.d/env.conf
|
|
||||||
AVAHI_CONFIG=$CONFIG_PATH/avahi/avahi-daemon.conf
|
|
||||||
AVAHI_SRC=$CONFIG_PATH/avahi/avahi-daemon.conf.schema
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_hosts() {
|
|
||||||
set_hostname=$1
|
|
||||||
set_ipv4=$2
|
|
||||||
set_ipv6=$3
|
|
||||||
echo "Generating hosts file .... "
|
|
||||||
cat $DEFAULT_HOSTS > $HOSTS_CONFIG
|
|
||||||
echo "$set_ipv4 $set_hostname " >> $HOSTS_CONFIG
|
|
||||||
echo "$set_ipv6 $set_hostname " >> $HOSTS_CONFIG
|
|
||||||
|
|
||||||
touch "$HOSTS_MESH"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#------------ lighttpd env config - Start ---------------------
|
|
||||||
|
|
||||||
generate_lighttpd_env() {
|
|
||||||
local GLOBAL_CHAT=$1
|
|
||||||
local GLOBAL_DEST="$2"
|
|
||||||
local PYTHONPATH=$3
|
|
||||||
local SHOUTBOX_GEN_HTMLFILE=$4
|
|
||||||
local PIRATEBOX=$5
|
|
||||||
local SHOUTBOX_CHATFILE=$6
|
|
||||||
local SHOUTBOX_CLIENT_TIMESTAMP=$7
|
|
||||||
local IN_UPLOAD_PATH=$8
|
|
||||||
|
|
||||||
echo "Generating Environment-config for lighttpd ....."
|
|
||||||
|
|
||||||
LIGHTTPD_ENV_BR_LINE=""
|
|
||||||
if [ "$GLOBAL_CHAT" = "yes" ] ; then
|
|
||||||
LIGHTTPD_ENV_BR_LINE=" \"SHOUTBOX_BROADCAST_DESTINATIONS\" => \"$GLOBAL_DEST\" , "
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIGHTTPD_ENV="setenv.add-environment = (
|
|
||||||
\"PYTHONPATH\" => \"$PYTHONPATH:$PIRATEBOX/python_lib\",
|
|
||||||
\"SHOUTBOX_GEN_HTMLFILE\" => \"$SHOUTBOX_GEN_HTMLFILE\" ,
|
|
||||||
\"SHOUTBOX_CHATFILE\" => \"$SHOUTBOX_CHATFILE\" ,
|
|
||||||
\"SHOUTBOX_CLIENT_TIMESTAMP\" => \"$SHOUTBOX_CLIENT_TIMESTAMP\" ,
|
|
||||||
\"UPLOAD_PATH\" => \"$IN_UPLOAD_PATH\" ,
|
|
||||||
$LIGHTTPD_ENV_BR_LINE
|
|
||||||
|
|
||||||
)"
|
|
||||||
|
|
||||||
echo $LIGHTTPD_ENV > $LIGHTTPD_ENV_CONFIG
|
|
||||||
}
|
|
||||||
|
|
||||||
#------------ lighttpd env config - End ---------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ -z $1 ] ; then
|
|
||||||
echo "Usage is
|
|
||||||
generate_config_files.sh /opt/piratebox/conf/piratebox.conf
|
|
||||||
"
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
. $1
|
|
||||||
|
|
||||||
. $NODE_CONFIG
|
|
||||||
. $PIRATEBOX_FOLDER/lib/node_name_generation.sh
|
|
||||||
|
|
||||||
IPV6="#"
|
|
||||||
|
|
||||||
set_pathnames $PIRATEBOX_FOLDER
|
|
||||||
|
|
||||||
ipv6_call=''
|
|
||||||
if [ "$IPV6_ENABLE" = "yes" ] ; then
|
|
||||||
ipv6_call=$IPV6_PREFIX
|
|
||||||
IPV6=$IPV6_IP
|
|
||||||
fi
|
|
||||||
generate_hosts $HOST $IP $IPV6
|
|
||||||
|
|
||||||
generate_lighttpd_env $GLOBAL_CHAT "$GLOBAL_DEST" $PIRATEBOX_PYTHONPATH $GEN_CHATFILE $PIRATEBOX_FOLDER $CHATFILE $SHOUTBOX_CLIENT_TIMESTAMP $UPLOADFOLDER
|
|
||||||
|
|
||||||
COMPLETE_HOST=$HOST
|
|
||||||
|
|
||||||
if [ "$NODE_CONFIG_ACTIVE" = "yes" ] ; then
|
|
||||||
echo -n "Appending local node-name hosts entry "
|
|
||||||
if generate_node_name "$HOST" "$NODE_NAME" "$NODE_GEN" ; then
|
|
||||||
echo $NODE_GEN_OUTPUT
|
|
||||||
echo "$NODE_IPV6_IP $NODE_GEN_OUTPUT " >> $HOSTS_CONFIG
|
|
||||||
COMPLETE_HOST=$NODE_GEN_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Error: No valid node-name-config found, skipping"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#We want a long hostname and not only the hostname itself...
|
|
||||||
### PirateBox Scripts generates its own config in /opt/piratebox/conf/avahi
|
|
||||||
### but, the daemon works per default only on /etc/avahi
|
|
||||||
### If you want to enable avahi, then you have to link /etc/avahi to /opt/piratebox/conf/avahi
|
|
||||||
### On OpenWRT this should happen, if avahi is available before installing the piratebox
|
|
||||||
### automtically.
|
|
||||||
AVAHI_HOST=$( echo $COMPLETE_HOST | sed 's|\.|_|g' )
|
|
||||||
sed "s|#####MASKED_HOSTNAME#####|$AVAHI_HOST|" $AVAHI_SRC > $AVAHI_CONFIG
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# ---- TEMPLATE ----
|
|
||||||
|
|
||||||
# Runs on every Startup
|
|
||||||
# get config file
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Load config
|
|
||||||
. $1
|
|
||||||
|
|
||||||
# You can uncommend this line to see when hook is starting:
|
|
||||||
# echo "------------------ Running $0 ------------------"
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# ---- TEMPLATE ----
|
|
||||||
|
|
||||||
# Runs on every Startup after the normal init-steps are done
|
|
||||||
# get config file
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Load config
|
|
||||||
. $1
|
|
||||||
|
|
||||||
# You can uncommend this line to see when hook is starting:
|
|
||||||
# echo "------------------ Running $0 ------------------"
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# ---- TEMPLATE ----
|
|
||||||
|
|
||||||
# Runs on every Stop before anything is stopped
|
|
||||||
# get config file
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Load config
|
|
||||||
. $1
|
|
||||||
|
|
||||||
# You can uncommend this line to see when hook is starting:
|
|
||||||
# echo "------------------ Running $0 ------------------"
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# ---- TEMPLATE ----
|
|
||||||
|
|
||||||
# Rund after every stop command is processed
|
|
||||||
# get config file
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 255
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Load config
|
|
||||||
. $1
|
|
||||||
|
|
||||||
# You can uncommend this line to see when hook is starting:
|
|
||||||
# echo "------------------ Running $0 ------------------"
|
|
||||||
|
|
|
@ -5,8 +5,17 @@
|
||||||
|
|
||||||
PIRATEBOX_CONFIG="/opt/piratebox/conf/piratebox.conf"
|
PIRATEBOX_CONFIG="/opt/piratebox/conf/piratebox.conf"
|
||||||
|
|
||||||
|
##Modules for Creating Wifi and IP setting
|
||||||
|
DEFAULT_MODULES="hostap"
|
||||||
|
##Modules for housekeeping and so on
|
||||||
|
DEFAULT_MODULES="${DEFAULT_MODULES} cleanup_tmp_folder generate_config_hosts generate_json_config"
|
||||||
|
##Modules for serving IPs"
|
||||||
|
DEFAULT_MODULES="${DEFAULT_MODULES} radvd dnsmasq"
|
||||||
|
##Modules for serving the webpage
|
||||||
|
DEFAULT_MODULES="${DEFAULT_MODULES} lighttpd custom_dirlist generate_config_lighttpd_env prepare_shoutbox"
|
||||||
|
|
||||||
DEFAULT_MODULES="lighttpd dnsmasq cleanup_tmp_folder custom_dirlist hostap"
|
#We mostly need lighttpd configuration
|
||||||
|
. "${MODULE_CONFIG}"/lighttpd.conf
|
||||||
|
|
||||||
# Load configfile
|
# Load configfile
|
||||||
|
|
||||||
|
@ -25,13 +34,8 @@ if [ -z $1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
|
||||||
echo "Config-File $1 not found..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ $1 = 'pyForum' ] ; then
|
if [ $1 = 'pyForum' ] ; then
|
||||||
|
|
||||||
cp -v $PIRATEBOX_FOLDER/src/forest.py $WWW_FOLDER/cgi-bin
|
cp -v $PIRATEBOX_FOLDER/src/forest.py $WWW_FOLDER/cgi-bin
|
||||||
cp -v $PIRATEBOX_FOLDER/src/forest.css $WWW_FOLDER/
|
cp -v $PIRATEBOX_FOLDER/src/forest.css $WWW_FOLDER/
|
||||||
cp -v $PIRATEBOX_FOLDER/src/forum_forest.html $WWW_FOLDER/forum.html
|
cp -v $PIRATEBOX_FOLDER/src/forum_forest.html $WWW_FOLDER/forum.html
|
||||||
|
@ -60,6 +64,7 @@ if [ $1 = 'part2' ] ; then
|
||||||
#Distribute the Directory Listing files
|
#Distribute the Directory Listing files
|
||||||
$PIRATEBOX_FOLDER/bin/distribute_files.sh $SHARE_FOLDER/Shared true
|
$PIRATEBOX_FOLDER/bin/distribute_files.sh $SHARE_FOLDER/Shared true
|
||||||
#Set permissions
|
#Set permissions
|
||||||
|
|
||||||
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share -R
|
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share -R
|
||||||
chmod u+rw $PIRATEBOX_FOLDER/share
|
chmod u+rw $PIRATEBOX_FOLDER/share
|
||||||
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/www -R
|
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/www -R
|
||||||
|
@ -114,6 +119,7 @@ if [ $1 = 'imageboard' ] ; then
|
||||||
cd $PIRATEBOX_FOLDER/share/board
|
cd $PIRATEBOX_FOLDER/share/board
|
||||||
cp -R mode_image/* ./
|
cp -R mode_image/* ./
|
||||||
cp $PIRATEBOX_FOLDER/src/kareha_img_config.pl $PIRATEBOX_FOLDER/share/board/config.pl
|
cp $PIRATEBOX_FOLDER/src/kareha_img_config.pl $PIRATEBOX_FOLDER/share/board/config.pl
|
||||||
|
|
||||||
chown -R $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share/board
|
chown -R $LIGHTTPD_USER:$LIGHTTPD_GROUP $PIRATEBOX_FOLDER/share/board
|
||||||
#Install filetype thumbnails
|
#Install filetype thumbnails
|
||||||
mv $PIRATEBOX_FOLDER/share/board/extras/icons $PIRATEBOX_FOLDER/share/board/
|
mv $PIRATEBOX_FOLDER/share/board/extras/icons $PIRATEBOX_FOLDER/share/board/
|
||||||
|
@ -156,8 +162,10 @@ fi
|
||||||
set_hostname() {
|
set_hostname() {
|
||||||
local name=$1 ; shift;
|
local name=$1 ; shift;
|
||||||
|
|
||||||
|
. "${MODULE_CONFIG}"/hostname.conf
|
||||||
|
|
||||||
sed "s|#####HOST#####|$name|g" $PIRATEBOX_FOLDER/src/redirect.html.schema > $WWW_FOLDER/redirect.html
|
sed "s|#####HOST#####|$name|g" $PIRATEBOX_FOLDER/src/redirect.html.schema > $WWW_FOLDER/redirect.html
|
||||||
sed "s|HOST=\"$HOST\"|HOST=\"$name\"|" -i $PIRATEBOX_CONFIG
|
sed "s|HOST=\"$HOST\"|HOST=\"$name\"|" -i "${MODULE_CONFIG}"/hostname.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $1 = "hostname" ] ; then
|
if [ $1 = "hostname" ] ; then
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
. $1
|
. $1
|
||||||
|
|
||||||
# json.conf contains some information about modules on the frontend
|
# json.conf contains some information about modules on the frontend
|
||||||
. $PIRATEBOX_FOLDER/conf/json.conf
|
. "${MODULE_CONFIG}"/config_generation.conf
|
||||||
|
|
||||||
|
###. $PIRATEBOX_FOLDER/conf/json.conf
|
||||||
|
|
||||||
### JSON convert functions
|
### JSON convert functions
|
||||||
. $PIRATEBOX_FOLDER/lib/json_func.sh
|
. $PIRATEBOX_FOLDER/lib/json_func.sh
|
||||||
|
@ -21,6 +23,13 @@ JSON_FILE=$PBX_JSON_FILE
|
||||||
# DROOPY_PORT => droopy_port
|
# DROOPY_PORT => droopy_port
|
||||||
# HOST => droopy_host
|
# HOST => droopy_host
|
||||||
|
|
||||||
|
DROPPY_ENABLED="no"
|
||||||
|
[ $PIRATEBOX_FOLDER/bin/piratebox_modules.sh droopy ] && DROOPY_ENABLED="yes"
|
||||||
|
|
||||||
|
|
||||||
|
. "${MODULE_CONFIG}"/shoutbox.conf
|
||||||
|
. "${MODULE_CONFIG}"/droopy.conf
|
||||||
|
|
||||||
json_droopy_enabled=`convert_yn_to_tf $DROOPY_ENABLED`
|
json_droopy_enabled=`convert_yn_to_tf $DROOPY_ENABLED`
|
||||||
json_shoutbox_enabled=`convert_yn_to_tf $SHOUTBOX_ENABLED`
|
json_shoutbox_enabled=`convert_yn_to_tf $SHOUTBOX_ENABLED`
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ PIRATEBOX_CONF="${PIRATEBOX_FOLDER}/conf/piratebox.conf"
|
||||||
# export DEBUG=true
|
# export DEBUG=true
|
||||||
DEBUG=${DEBUG:=false}
|
DEBUG=${DEBUG:=false}
|
||||||
|
|
||||||
|
export PYTHONPATH=:$PYTHONPATH:$PIRATEBOX_PYTHONPATH
|
||||||
|
|
||||||
export cfg_modules=${MODULE_ENABLED}
|
export cfg_modules=${MODULE_ENABLED}
|
||||||
export cfg_modules_lib=${MODULE_AVAILABLE}
|
export cfg_modules_lib=${MODULE_AVAILABLE}
|
||||||
|
|
||||||
|
@ -26,6 +28,9 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
enable)
|
enable)
|
||||||
_enable_ "$2"
|
_enable_ "$2"
|
||||||
|
;;
|
||||||
|
enabled)
|
||||||
|
exit _enabled_ "$2"
|
||||||
;;
|
;;
|
||||||
disable)
|
disable)
|
||||||
_disable_ "$2"
|
_disable_ "$2"
|
||||||
|
@ -34,8 +39,9 @@ case "$1" in
|
||||||
# ;;
|
# ;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: piratebox_modules.sh {start|stop|restart}"
|
echo "Usage: piratebox_modules.sh {start|stop|restart}"
|
||||||
echo " piratebox_modules.sh enable module"
|
echo " piratebox_modules.sh enable module -enable for start"
|
||||||
echo " piratebox_modules.sh disable module"
|
echo " piratebox_modules.sh enabled module -Test if it is enabled"
|
||||||
|
echo " piratebox_modules.sh disable module "
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -8,43 +8,23 @@
|
||||||
# Netmask
|
# Netmask
|
||||||
# Interface
|
# Interface
|
||||||
|
|
||||||
probe() {
|
|
||||||
if [ "$PROBE_INTERFACE" = "yes" ] ; then
|
PIRATEBOX_CONFIG="/opt/piratebox/conf/piratebox.conf"
|
||||||
echo -n "Probing interface $INTERFACE"
|
|
||||||
ifconfig "$INTERFACE" >> /dev/null 2>&1
|
|
||||||
TEST_OK=$?
|
|
||||||
CNT=$PROBE_TIME
|
|
||||||
while [[ "$TEST_OK" != "0" && "$CNT" != "0" ]]
|
|
||||||
do
|
|
||||||
echo -n "."
|
|
||||||
sleep 1
|
|
||||||
CNT=$(( $CNT - 1 ))
|
|
||||||
if [ "$CNT" = 0 ] ; then
|
|
||||||
exit 99
|
|
||||||
fi
|
|
||||||
ifconfig "$INTERFACE" >> /dev/null 2>&1
|
|
||||||
TEST_OK=$?
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Load configfile
|
# Load configfile
|
||||||
|
|
||||||
if [ -z $1 ] || [ -z $2 ]; then
|
if [ -z $1 ] then
|
||||||
echo "Usage piratebox_setup_wlan.sh my_config <start|stop|probe>"
|
echo "Usage piratebox_setup_wlan.sh <start|stop>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
. $PIRATEBOX_CONFIG
|
||||||
echo "Config-File $1 not found..."
|
. "${MODULE_CONFIG}"/wifi.conf
|
||||||
exit 1
|
. "${MODULE_CONFIG}"/
|
||||||
fi
|
|
||||||
|
|
||||||
#Load config
|
|
||||||
. $1
|
|
||||||
|
|
||||||
|
|
||||||
### Check config
|
### Check config
|
||||||
|
@ -81,7 +61,7 @@ if [ $2 = "start" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting up $INTERFACE"
|
echo "Setting up $INTERFACE"
|
||||||
ifconfig $INTERFACE $IP netmask $NETMASK
|
ifconfig $INTERFACE $IP netmask $NETMASK
|
||||||
|
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo "..failed ";
|
echo "..failed ";
|
||||||
|
@ -112,9 +92,6 @@ elif [ $2 = "stop" ] ; then
|
||||||
echo "Removing the Node-Address again..."
|
echo "Removing the Node-Address again..."
|
||||||
ifconfig $NODE_INTERFACE del $NODE_IPV6_IP"$NODE_IPV6_MASK"
|
ifconfig $NODE_INTERFACE del $NODE_IPV6_IP"$NODE_IPV6_MASK"
|
||||||
fi
|
fi
|
||||||
elif [ $2 = "probe" ] ; then
|
|
||||||
# simply check if the interface is available
|
|
||||||
probe
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Matthias Strubel - (c)2012-2014 with GPL-3
|
|
||||||
#
|
|
||||||
# Only calls generate-Routing in piratebox-folder
|
|
||||||
# gets Piratebox-Folder into www
|
|
||||||
|
|
||||||
|
|
||||||
# $1 www folder
|
|
||||||
# $2 pirtatebox config file
|
|
||||||
|
|
||||||
|
|
||||||
. $2
|
|
||||||
|
|
||||||
|
|
||||||
cd $PIRATEBOX_FOLDER
|
|
||||||
cd python_lib
|
|
||||||
|
|
||||||
export SHOUTBOX_CHATFILE=$CHATFILE
|
|
||||||
export SHOUTBOX_GEN_HTMLFILE=$GEN_CHATFILE
|
|
||||||
export SHOUTBOX_CLIENT_TIMESTAMP=$SHOUTBOX_CLIENT_TIMESTAMP
|
|
||||||
|
|
||||||
|
|
||||||
#Writing init-message and reset chat..
|
|
||||||
if [ "$RESET_CHAT" = "yes" ] ; then
|
|
||||||
cat $PIRATEBOX_FOLDER/conf/chat_init.txt > $CHATFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Generate content file
|
|
||||||
python psogen.py generate
|
|
||||||
|
|
||||||
if [ "$SHOUTBOX_ENABLED" = "no" ] ; then
|
|
||||||
# If the shoutbox is disabled, we remove the writable flag
|
|
||||||
echo -n "Making shoutbox readonly..."
|
|
||||||
chmod a-w $CHATFILE
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Set correct permissions
|
|
||||||
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_CHATFILE
|
|
||||||
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_GEN_HTMLFILE
|
|
||||||
chmod ug+rw $SHOUTBOX_CHATFILE
|
|
||||||
chmod ug+rw $SHOUTBOX_GEN_HTMLFILE
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ fi
|
||||||
|
|
||||||
. $1
|
. $1
|
||||||
|
|
||||||
|
. $PIRATEBOX_FOLDER/conf/modules_conf/timesave.conf
|
||||||
|
|
||||||
if [ "$2" = "install" ] ; then
|
if [ "$2" = "install" ] ; then
|
||||||
crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null
|
crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
### TODO - Create a new Bridge netowrk
|
|
||||||
#DO_CREATE_BRIDGE
|
|
||||||
#BRIDGE_NAME="br0"
|
|
||||||
##Include the following interface, which are already active on the box
|
|
||||||
## does not include the AP network...
|
|
||||||
## example
|
|
||||||
##BRIDGE_INTERFACES="eth0"
|
|
||||||
#BRIDGE_INTERFACES=""
|
|
|
@ -1,28 +0,0 @@
|
||||||
# Mesh-Node configuration
|
|
||||||
# Contains the configuration which makes this node individual, like
|
|
||||||
# random hostname & and specific IPv6 IP.
|
|
||||||
NODE_CONFIG_ACTIVE='no'
|
|
||||||
|
|
||||||
#
|
|
||||||
NODE_IPV6_IP=''
|
|
||||||
NODE_IPV6_MASK='/64'
|
|
||||||
# Node-Name without domain suffix, like
|
|
||||||
# foobar = Node-name
|
|
||||||
# piratebox.lan = Host-Name (and base Domain-Name)
|
|
||||||
# Fully Name will be later
|
|
||||||
# foobar.piratebox.lan
|
|
||||||
# If your leave the nodename empty, that will result in publishing hostname only.
|
|
||||||
# Setting NODE_GEN to "no" it will take the NODE_NAME 1:1 for anouncements etc. without
|
|
||||||
# adding the hostname as a suffix
|
|
||||||
NODE_NAME=''
|
|
||||||
NODE_GEN="yes"
|
|
||||||
|
|
||||||
## Node-Interface
|
|
||||||
# Currently the same interface then the other wlan interface
|
|
||||||
# But had to be used if mesh node interface is different and
|
|
||||||
# initialized by PBx scripts.
|
|
||||||
# If the node_interface is different, it has to be up and running.
|
|
||||||
NODE_INTERFACE='$INTERFACE'
|
|
||||||
# Should the Node-Interface setup via the PirateBox-Scripts
|
|
||||||
NODE_IPV6_SET_IP='no'
|
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
# reused on different places
|
# reused on different places
|
||||||
HOSTS_CONFIG="${PIRATEBOX_FOLDER}/conf/generated/hosts_generated"
|
HOSTS_CONFIG="${PIRATEBOX_FOLDER}/conf/generated/hosts_generated"
|
||||||
HOSTS_MESH="${PIRATEBOX_FOLDER}/conf/generated/hosts_mesh"
|
HOSTS_MESH="${PIRATEBOX_FOLDER}/conf/generated/hosts_mesh"
|
||||||
DEFAULT_HOSTS="${PIRATEBOX_FOLDER}/conf/hosts"
|
HOSTS_DEFAULT="${PIRATEBOX_FOLDER}/conf/hosts"
|
||||||
|
|
||||||
|
|
||||||
#Generate config json for frontend
|
#Generate config json for frontend
|
||||||
PBX_JSON_GENERATION="yes"
|
|
||||||
PBX_JSON_FILE="$WWW_FOLDER/piratebox_config.json"
|
PBX_JSON_FILE="$WWW_FOLDER/piratebox_config.json"
|
||||||
|
|
||||||
CHAT_MODULE_FILE="modules/chat.html"
|
CHAT_MODULE_FILE="modules/chat.html"
|
||||||
UPLOAD_MODULE_FILE="modules/upload.html"
|
UPLOAD_MODULE_FILE="modules/upload.html"
|
||||||
|
|
||||||
|
##Avahi generation
|
||||||
|
AVAHI_CONFIG="${PIRATEBOX_FOLDER}/conf/avahi/avahi-daemon.conf
|
||||||
|
AVAHI_SRC="${PIRATEBOX_FOLDER}/conf/avahi/avahi-daemon.conf.schema
|
|
@ -2,6 +2,7 @@
|
||||||
LIGHTTPD_PIDFILE="${PIRATEBOX_TMP_FOLDER}/lighttpd.pid"
|
LIGHTTPD_PIDFILE="${PIRATEBOX_TMP_FOLDER}/lighttpd.pid"
|
||||||
|
|
||||||
LIGHTTPD_CONF="${PIRATEBOX_FOLDER}/conf/lighttpd/lighttpd.conf"
|
LIGHTTPD_CONF="${PIRATEBOX_FOLDER}/conf/lighttpd/lighttpd.conf"
|
||||||
|
LIGHTTPD_ENV_CONFIG="${PIRATEBOX_FOLDER}/conf/lighttpd/conf.d/env.conf"
|
||||||
|
|
||||||
LIGHTTPD_USER=nobody
|
LIGHTTPD_USER=nobody
|
||||||
LIGHTTPD_GROUP=nogroup
|
LIGHTTPD_GROUP=nogroup
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
####--------------
|
####--------------
|
||||||
|
|
||||||
#Enable IPv6 Setup (yes|no) on you interface
|
#Enable IPv6 Setup (yes|no) on you interface
|
||||||
IPV6_ENABLE="no"
|
IPV6_ENABLE="yes"
|
||||||
|
|
||||||
|
|
||||||
#absolute Node-Adress
|
#absolute Node-Adress
|
||||||
|
|
|
@ -5,23 +5,24 @@
|
||||||
SHOUTBOX_ENABLED="yes"
|
SHOUTBOX_ENABLED="yes"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Use client time instead of system time
|
||||||
|
SHOUTBOX_CLIENT_TIMESTAMP="yes"
|
||||||
#Configuration for chat (If you decide to move the chat folder, you have to change
|
#Configuration for chat (If you decide to move the chat folder, you have to change
|
||||||
/opt/piratebox/chat/cgi-bin/py* files )
|
# /opt/piratebox/chat/cgi-bin/py* files )
|
||||||
CHATFILE="$WWW_FOLDER/cgi-bin/data.pso"
|
SHOUTBOX_CHATFILE="$WWW_FOLDER/cgi-bin/data.pso"
|
||||||
#Generated File
|
#Generated File
|
||||||
GEN_CHATFILE="$WWW_FOLDER/chat_content.html"
|
SHOUTBOX_GEN_CHATFILE="$WWW_FOLDER/chat_content.html"
|
||||||
# Reset Shoutbox on Startup?
|
# Reset Shoutbox on Startup?
|
||||||
RESET_CHAT="yes"
|
SHOUTBOX_RESET_CHAT="yes"
|
||||||
|
|
||||||
#Inititiation Chat-Message
|
#Inititiation Chat-Message
|
||||||
### This option was removed, you can find the chat message in conf/chat_init.txt
|
### This option was removed, you can find the chat message in conf/chat_init.txt
|
||||||
|
SHOUTBOX_TEXT_TEMPLATE_FILE="$PIRATEBOX_FOLDER/conf/chat_init.txt"
|
||||||
#Activate Global chat
|
|
||||||
# Still experimentall!
|
|
||||||
GLOBAL_CHAT="no"
|
|
||||||
|
|
||||||
#On which broadcast address should it send
|
#On which broadcast address should it send
|
||||||
# Take care on the syntax!!
|
# Take care on the syntax!!
|
||||||
GLOBAL_DEST="[ #255.255.255.255# , #10.255.255.255# , #$NET.255# ]"
|
GLOBAL_DEST="[ #255.255.255.255# , #10.255.255.255# , #$NET.255# ]"
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL_SHOUTBOX_PIDFILE="${PIRATEBOX_FOLDER}/tmp/shoutbox_daemon.pid"
|
|
@ -25,14 +25,14 @@ PATH=$PATH:/opt/piratebox/bin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PIDFILE_SHOUTBOX=/opt/piratebox/tmp/shoutbox_daemon.pid
|
|
||||||
|
|
||||||
|
|
||||||
PIRATEBOX=/opt/piratebox
|
PIRATEBOX=/opt/piratebox
|
||||||
CONF=$PIRATEBOX/conf/piratebox.conf
|
CONF=$PIRATEBOX/conf/piratebox.conf
|
||||||
|
|
||||||
|
|
||||||
export PYTHONPATH=:$PYTHONPATH:$PIRATEBOX_PYTHONPATH
|
|
||||||
|
|
||||||
if [ -f $CONF ] ; then
|
if [ -f $CONF ] ; then
|
||||||
. $CONF
|
. $CONF
|
||||||
|
@ -57,29 +57,9 @@ case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting script piratebox "
|
echo "Starting script piratebox "
|
||||||
|
|
||||||
# Generate hosts & dnsmasq file
|
|
||||||
$PIRATEBOX/bin/generate_config_files.sh "$CONF"
|
|
||||||
|
|
||||||
$PIRATEBOX/bin/hooks/hook_piratebox_start.sh "$CONF"
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$PBX_JSON_GENERATION" = "yes" ]; then
|
|
||||||
$PIRATEBOX_FOLDER/bin/json_generation.sh $CONF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DO_IW" = "yes" ] ; then
|
|
||||||
log_daemon_msg " Setting up Interface (iw) "
|
|
||||||
iw $PHY_IF interface add $INTERFACE type managed
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PROBE_INTERFACE" = "yes" ] ; then
|
|
||||||
echo " Probe wlan"
|
|
||||||
#Setting up WLAN Interface
|
|
||||||
piratebox_setup_wlan.sh $CONF probe
|
|
||||||
fi
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo "failed probing Interface"
|
|
||||||
else
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$DO_IFCONFIG" = "yes" ] ; then
|
if [ "$DO_IFCONFIG" = "yes" ] ; then
|
||||||
|
@ -103,47 +83,23 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#Do shoutbox stuff
|
|
||||||
$PIRATEBOX/bin/shoutbox_stuff.sh $WWW_FOLDER $CONF
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Start Global Chat daemon if needed.
|
|
||||||
if [ "$GLOBAL_CHAT" = "yes" ] ; then
|
|
||||||
echo "Starting global chat service..."
|
|
||||||
start-stop-daemon -S -m -b -p $PIDFILE_SHOUTBOX -x $PIRATEBOX/bin/shoutbox_daemon.sh -- $CONF
|
|
||||||
echo $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PIRATEBOX/bin/hooks/hook_piratebox_start_done.sh "$CONF"
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping script piratebox"
|
echo "Stopping script piratebox"
|
||||||
|
|
||||||
$PIRATEBOX/bin/hooks/hook_piratebox_stop.sh "$CONF"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Start Global Chat daemon if needed.
|
|
||||||
if [ "$GLOBAL_CHAT" = "yes" ] ; then
|
|
||||||
echo "Stopping global chat service..."
|
|
||||||
start-stop-daemon -K -q -p $PIDFILE_SHOUTBOX
|
|
||||||
echo $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$DO_IFCONFIG" = "yes" ] ; then
|
if [ "$DO_IFCONFIG" = "yes" ] ; then
|
||||||
piratebox_setup_wlan.sh $CONF stop
|
piratebox_setup_wlan.sh $CONF stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DO_IW" = "yes" ] ; then
|
|
||||||
iw dev $INTERFACE del
|
|
||||||
fi
|
|
||||||
|
|
||||||
#BRIDGE
|
#BRIDGE
|
||||||
if [ "$DO_BRIDGE" = "yes" ] ; then
|
if [ "$DO_BRIDGE" = "yes" ] ; then
|
||||||
|
@ -157,7 +113,6 @@ $BRIDGE $INTERFACE "
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PIRATEBOX/bin/hooks/hook_piratebox_stop_done.sh "$CONF"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/piratebox {start|stop}"
|
echo "Usage: /etc/init.d/piratebox {start|stop}"
|
||||||
|
|
|
@ -175,6 +175,36 @@ _enable_(){
|
||||||
ln -s "../modules.available/${module_name}" "${linkname_stop}"
|
ln -s "../modules.available/${module_name}" "${linkname_stop}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_enabled_(){
|
||||||
|
MODULE_LIST=""
|
||||||
|
local module_name="$1"
|
||||||
|
|
||||||
|
# check if $cfg_modules is available
|
||||||
|
if [ ! -d $cfg_modules ] ; then
|
||||||
|
echo "config module folder $cfg_modules does not exists"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e $cfg_modules_lib/$module_name ] ; then
|
||||||
|
echo "unknown module ${module_name}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$DEBUG && echo "Loading Module $module_name"
|
||||||
|
. $cfg_modules_lib/$module_name
|
||||||
|
|
||||||
|
local start_num=$( "func_${module_name}_get_start_order" )
|
||||||
|
local stop_num=$( "func_${module_name}_get_stop_order" )
|
||||||
|
|
||||||
|
local linkname_start="${PREFIX_START}${start_num}_${module_name}"
|
||||||
|
local linkname_stop="${PREFIX_STOP}${stop_num}_${module_name}"
|
||||||
|
|
||||||
|
cd $cfg_modules
|
||||||
|
|
||||||
|
return test -e $linkname_start
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
_disable_(){
|
_disable_(){
|
||||||
local module_name="$1"
|
local module_name="$1"
|
||||||
cd $cfg_modules
|
cd $cfg_modules
|
||||||
|
|
|
@ -8,15 +8,15 @@ MODULE_LIST="$MODULE_LIST cleanup_tmp_files"
|
||||||
|
|
||||||
|
|
||||||
cleanup_tmp_files_myself="cleanup_tmp_files"
|
cleanup_tmp_files_myself="cleanup_tmp_files"
|
||||||
cleanup_tmp_files_start_order=05
|
cleanup_tmp_files_start_order=11
|
||||||
cleanup_tmp_files_stop_order=99
|
cleanup_tmp_files_stop_order=99
|
||||||
cleanup_tmp_files_needed_config=" "
|
cleanup_tmp_files_needed_config="cleanUP_Upload.conf"
|
||||||
cleanup_tmp_files_crucial="no"
|
cleanup_tmp_files_crucial="no"
|
||||||
|
|
||||||
func_cleanup_tmp_files_start(){
|
func_cleanup_tmp_files_start(){
|
||||||
#Start here the cleanup_tmp_files i.e.
|
#Start here the cleanup_tmp_files i.e.
|
||||||
find "$UPLOADFOLDER"/ -iname tmp\* -exec rm {} \;
|
find "$CLEANUP_FOLDER"/ -iname tmp\* -exec rm {} \;
|
||||||
$PIRATEBOX_FOLDER/bin/delete_empty.sh "$UPLOADFOLDER"
|
$PIRATEBOX_FOLDER/bin/delete_empty.sh "$CLEANUP_FOLDER"
|
||||||
local RC=0
|
local RC=0
|
||||||
_check_rc_ "$cleanup_tmp_files_myself" "$RC" "$cleanup_tmp_files_crucial"
|
_check_rc_ "$cleanup_tmp_files_myself" "$RC" "$cleanup_tmp_files_crucial"
|
||||||
return $RC
|
return $RC
|
||||||
|
|
|
@ -6,7 +6,7 @@ MODULE_LIST="$MODULE_LIST cleanup_tmp_folder"
|
||||||
|
|
||||||
|
|
||||||
cleanup_tmp_folder_myself="cleanup_tmp_folder"
|
cleanup_tmp_folder_myself="cleanup_tmp_folder"
|
||||||
cleanup_tmp_folder_start_order=05
|
cleanup_tmp_folder_start_order=11
|
||||||
cleanup_tmp_folder_stop_order=99
|
cleanup_tmp_folder_stop_order=99
|
||||||
cleanup_tmp_folder_needed_config=" "
|
cleanup_tmp_folder_needed_config=" "
|
||||||
cleanup_tmp_folder_crucial="no"
|
cleanup_tmp_folder_crucial="no"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
MODULE_LIST="$MODULE_LIST custom_dirlist"
|
MODULE_LIST="$MODULE_LIST custom_dirlist"
|
||||||
|
|
||||||
custom_dirlist_myself="custom_dirlist"
|
custom_dirlist_myself="custom_dirlist"
|
||||||
custom_dirlist_start_order=05
|
custom_dirlist_start_order=13
|
||||||
custom_dirlist_stop_order=99
|
custom_dirlist_stop_order=99
|
||||||
custom_dirlist_needed_config=" "
|
custom_dirlist_needed_config=" "
|
||||||
custom_dirlist_crucial="no"
|
custom_dirlist_crucial="no"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
MODULE_LIST="$MODULE_LIST dnsmasq"
|
MODULE_LIST="$MODULE_LIST dnsmasq"
|
||||||
|
|
||||||
dnsmasq_myself="dnsmasq"
|
dnsmasq_myself="dnsmasq"
|
||||||
dnsmasq_start_order=13
|
dnsmasq_start_order=31
|
||||||
dnsmasq_stop_order=70
|
dnsmasq_stop_order=70
|
||||||
dnsmasq_needed_config="network.conf config_generation.conf dnsmasq.conf"
|
dnsmasq_needed_config="network.conf config_generation.conf dnsmasq.conf"
|
||||||
dnsmasq_crucial="no"
|
dnsmasq_crucial="no"
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
MODULE_LIST="$MODULE_LIST droopy"
|
MODULE_LIST="$MODULE_LIST droopy"
|
||||||
|
|
||||||
droopy_myself="droopy"
|
droopy_myself="droopy"
|
||||||
droopy_start_order=50
|
droopy_start_order=51
|
||||||
droopy_stop_order=10
|
droopy_stop_order=23
|
||||||
droopy_needed_config="droopy.conf lighttpd.conf"
|
droopy_needed_config="droopy.conf lighttpd.conf"
|
||||||
droopy_crucial="no"
|
droopy_crucial="no"
|
||||||
|
|
||||||
|
|
59
piratebox/piratebox/modules.available/generate_config_hosts
Normal file
59
piratebox/piratebox/modules.available/generate_config_hosts
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
### This module replaces the old generate_config_hosts_files script
|
||||||
|
## It generates:
|
||||||
|
## - an environment file for lighttpd
|
||||||
|
## - a static hosts file including
|
||||||
|
## the short hostname
|
||||||
|
##
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST generate_config_hosts"
|
||||||
|
|
||||||
|
generate_config_hosts_myself="generate_config_hosts"
|
||||||
|
generate_config_hosts_start_order=12
|
||||||
|
generate_config_hosts_stop_order=99
|
||||||
|
generate_config_hosts_needed_config="network.conf network_ipv6.conf hostname.conf config_generation.conf"
|
||||||
|
generate_config_hosts_crucial="no"
|
||||||
|
|
||||||
|
func_generate_config_hosts_start(){
|
||||||
|
#Start here the generate_config_hosts i.e.
|
||||||
|
|
||||||
|
|
||||||
|
. "${PIRATEBOX_FOLDER}"/lib/node_name_generation.sh
|
||||||
|
|
||||||
|
cat "${HOSTS_DEFAULT}" > "${HOSTS_CONFIG}"
|
||||||
|
touch "${HOSTS_MESH}"
|
||||||
|
|
||||||
|
echo "${IP} ${HOST} " >> $HOSTS_CONFIG
|
||||||
|
echo "${IPV6_IP} ${HOST} " >> $HOSTS_CONFIG
|
||||||
|
|
||||||
|
|
||||||
|
#We want a long hostname and not only the hostname itself...
|
||||||
|
### PirateBox Scripts generates its own config in /opt/piratebox/conf/avahi
|
||||||
|
### but, the daemon works per default only on /etc/avahi
|
||||||
|
### If you want to enable avahi, then you have to link /etc/avahi to /opt/piratebox/conf/avahi
|
||||||
|
### On OpenWRT this should happen, if avahi is available before installing the piratebox
|
||||||
|
### automtically.
|
||||||
|
AVAHI_HOST=$( echo "${HOST}" | sed 's|\.|_|g' )
|
||||||
|
sed "s|#####MASKED_HOSTNAME#####|$AVAHI_HOST|" $AVAHI_SRC > $AVAHI_CONFIG
|
||||||
|
|
||||||
|
|
||||||
|
local RC=0
|
||||||
|
_check_rc_ "$generate_config_hosts_myself" "$RC" "$generate_config_hosts_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_config_hosts_stop(){
|
||||||
|
_check_rc_ "$generate_config_hosts_myself" "0"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_config_hosts_get_config(){
|
||||||
|
echo $generate_config_hosts_needed_config
|
||||||
|
}
|
||||||
|
func_generate_config_hosts_get_start_order(){
|
||||||
|
echo $generate_config_hosts_start_order
|
||||||
|
}
|
||||||
|
func_generate_config_hosts_get_stop_order(){
|
||||||
|
echo $generate_config_hosts_stop_order
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST generate_config_lighttpd_env"
|
||||||
|
|
||||||
|
generate_config_lighttpd_env_myself="generate_config_lighttpd_env"
|
||||||
|
generate_config_lighttpd_env_start_order=12
|
||||||
|
generate_config_lighttpd_env_stop_order=99
|
||||||
|
generate_config_lighttpd_env_needed_config="shoutbox.conf lighttpd.conf"
|
||||||
|
generate_config_lighttpd_env_crucial="no"
|
||||||
|
|
||||||
|
func_generate_config_lighttpd_env_start(){
|
||||||
|
#Start here the generate_config_lighttpd_env i.e.
|
||||||
|
|
||||||
|
local LIGHTTPD_ENV_BR_LINE=""
|
||||||
|
if _enabled_ "global_shoutbox" ; then
|
||||||
|
LIGHTTPD_ENV_BR_LINE=" \"SHOUTBOX_BROADCAST_DESTINATIONS\" => \"$GLOBAL_DEST\" , "
|
||||||
|
fi
|
||||||
|
|
||||||
|
local LIGHTTPD_ENV="setenv.add-environment = (
|
||||||
|
\"PYTHONPATH\" => \"$PYTHONPATH:${PIRATEBOX_FOLDER}/python_lib\",
|
||||||
|
\"SHOUTBOX_GEN_HTMLFILE\" => \"$SHOUTBOX_GEN_CHATFILE\" ,
|
||||||
|
\"SHOUTBOX_CHATFILE\" => \"$SHOUTBOX_CHATFILE\" ,
|
||||||
|
\"SHOUTBOX_CLIENT_TIMESTAMP\" => \"$SHOUTBOX_CLIENT_TIMESTAMP\" ,
|
||||||
|
\"UPLOAD_PATH\" => \"$UPLOAD_PATH\" ,
|
||||||
|
$LIGHTTPD_ENV_BR_LINE
|
||||||
|
|
||||||
|
)"
|
||||||
|
|
||||||
|
echo $LIGHTTPD_ENV > $LIGHTTPD_ENV_CONFIG
|
||||||
|
local RC=$?
|
||||||
|
|
||||||
|
_check_rc_ "$generate_config_lighttpd_env_myself" "$RC" "$generate_config_lighttpd_env_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_config_lighttpd_env_stop(){
|
||||||
|
_check_rc_ "$generate_config_lighttpd_env_myself" "$RC"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_config_lighttpd_env_get_config(){
|
||||||
|
echo $generate_config_lighttpd_env_needed_config
|
||||||
|
}
|
||||||
|
func_generate_config_lighttpd_env_get_start_order(){
|
||||||
|
echo $generate_config_lighttpd_env_start_order
|
||||||
|
}
|
||||||
|
func_generate_config_lighttpd_env_get_stop_order(){
|
||||||
|
echo $generate_config_lighttpd_env_stop_order
|
||||||
|
}
|
32
piratebox/piratebox/modules.available/generate_json_config
Normal file
32
piratebox/piratebox/modules.available/generate_json_config
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST generate_json_config"
|
||||||
|
|
||||||
|
generate_json_config_myself="generate_json_config"
|
||||||
|
generate_json_config_start_order=12
|
||||||
|
generate_json_config_stop_order=99
|
||||||
|
generate_json_config_needed_config=" "
|
||||||
|
generate_json_config_crucial="no"
|
||||||
|
|
||||||
|
func_generate_json_config_start(){
|
||||||
|
#Start here the generate_json_config i.e.
|
||||||
|
$PIRATEBOX_FOLDER/bin/json_generation.sh "${PIRATEBOX_FOLDER}/conf/piratebox.conf"
|
||||||
|
local RC=$?
|
||||||
|
_check_rc_ "$generate_json_config_myself" "$RC" "$generate_json_config_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_json_config_stop(){
|
||||||
|
_check_rc_ "$generate_json_config_myself" "0"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_generate_json_config_get_config(){
|
||||||
|
echo $generate_json_config_needed_config
|
||||||
|
}
|
||||||
|
func_generate_json_config_get_start_order(){
|
||||||
|
echo $generate_json_config_start_order
|
||||||
|
}
|
||||||
|
func_generate_json_config_get_stop_order(){
|
||||||
|
echo $generate_json_config_stop_order
|
||||||
|
}
|
33
piratebox/piratebox/modules.available/global_shoutbox
Normal file
33
piratebox/piratebox/modules.available/global_shoutbox
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST global_shoutbox"
|
||||||
|
|
||||||
|
global_shoutbox_myself="global_shoutbox"
|
||||||
|
global_shoutbox_start_order=53
|
||||||
|
global_shoutbox_stop_order=21
|
||||||
|
global_shoutbox_needed_config="shoutbox.conf"
|
||||||
|
global_shoutbox_crucial="no"
|
||||||
|
|
||||||
|
func_global_shoutbox_start(){
|
||||||
|
#Start here the global_shoutbox i.e.
|
||||||
|
start-stop-daemon -S -m -b -p $GLOBAL_SHOUTBOX_PIDFILE -x $PIRATEBOX_FOLDER/bin/shoutbox_daemon.sh -- "${MODULE_CONFIG}/${shoutbox.conf}"
|
||||||
|
local RC=$?
|
||||||
|
_check_rc_ "$global_shoutbox_myself" "$RC" "$global_shoutbox_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_global_shoutbox_stop(){
|
||||||
|
start-stop-daemon -K -q -p $GLOBAL_SHOUTBOX_PIDFILE
|
||||||
|
_check_rc_ "$global_shoutbox_myself" "$RC"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_global_shoutbox_get_config(){
|
||||||
|
echo $global_shoutbox_needed_config
|
||||||
|
}
|
||||||
|
func_global_shoutbox_get_start_order(){
|
||||||
|
echo $global_shoutbox_start_order
|
||||||
|
}
|
||||||
|
func_global_shoutbox_get_stop_order(){
|
||||||
|
echo $global_shoutbox_stop_order
|
||||||
|
}
|
|
@ -6,8 +6,8 @@
|
||||||
MODULE_LIST="$MODULE_LIST hostap"
|
MODULE_LIST="$MODULE_LIST hostap"
|
||||||
|
|
||||||
hostap_myself="hostap"
|
hostap_myself="hostap"
|
||||||
hostap_start_order=11
|
hostap_start_order=23
|
||||||
hostap_stop_order=80
|
hostap_stop_order=11
|
||||||
hostap_needed_config="wifi.conf hostap.conf"
|
hostap_needed_config="wifi.conf hostap.conf"
|
||||||
hostap_crucial="yes"
|
hostap_crucial="yes"
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
MODULE_LIST="$MODULE_LIST ircserver"
|
MODULE_LIST="$MODULE_LIST ircserver"
|
||||||
|
|
||||||
ircserver_myself="ircserver"
|
ircserver_myself="ircserver"
|
||||||
ircserver_start_order=50
|
ircserver_start_order=71
|
||||||
ircserver_stop_order=01
|
ircserver_stop_order=41
|
||||||
ircserver_needed_config="irc.conf"
|
ircserver_needed_config="irc.conf"
|
||||||
ircserver_crucial="no"
|
ircserver_crucial="no"
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
MODULE_LIST="$MODULE_LIST lighttpd"
|
MODULE_LIST="$MODULE_LIST lighttpd"
|
||||||
|
|
||||||
lighttpd_myself="lighttpd"
|
lighttpd_myself="lighttpd"
|
||||||
lighttpd_start_order=30
|
lighttpd_start_order=52
|
||||||
lighttpd_stop_order=10
|
lighttpd_stop_order=22
|
||||||
lighttpd_needed_config="lighttpd.conf"
|
lighttpd_needed_config="lighttpd.conf"
|
||||||
lighttpd_crucial="no"
|
lighttpd_crucial="no"
|
||||||
|
|
||||||
|
|
63
piratebox/piratebox/modules.available/prepare_shoutbox
Normal file
63
piratebox/piratebox/modules.available/prepare_shoutbox
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST prepare_shoutbox"
|
||||||
|
|
||||||
|
prepare_shoutbox_myself="prepare_shoutbox"
|
||||||
|
prepare_shoutbox_start_order=12
|
||||||
|
prepare_shoutbox_stop_order=99
|
||||||
|
prepare_shoutbox_needed_config="shoutbox.conf"
|
||||||
|
prepare_shoutbox_crucial="no"
|
||||||
|
|
||||||
|
func_prepare_shoutbox_start(){
|
||||||
|
#Start here the prepare_shoutbox i.e.
|
||||||
|
|
||||||
|
cd $PIRATEBOX_FOLDER
|
||||||
|
cd python_lib
|
||||||
|
|
||||||
|
export SHOUTBOX_CHATFILE=$SHOUTBOX_CHATFILE
|
||||||
|
export SHOUTBOX_GEN_HTMLFILE=$SHOUTBOX_GEN_CHATFILE
|
||||||
|
export SHOUTBOX_CLIENT_TIMESTAMP=$SHOUTBOX_CLIENT_TIMESTAMP
|
||||||
|
|
||||||
|
|
||||||
|
#Writing init-message and reset chat..
|
||||||
|
if [ "$SHOUTBOX_RESET_CHAT" = "yes" ] ; then
|
||||||
|
cat $SHOUTBOX_TEXT_TEMPLATE_FILE > $CHATFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Generate content file
|
||||||
|
python psogen.py generate
|
||||||
|
|
||||||
|
if [ "$SHOUTBOX_ENABLED" = "no" ] ; then
|
||||||
|
# If the shoutbox is disabled, we remove the writable flag
|
||||||
|
echo -n "Making shoutbox readonly..."
|
||||||
|
chmod a-w $SHOUTBOX_CHATFILE
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Set correct permissions
|
||||||
|
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_CHATFILE
|
||||||
|
chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $SHOUTBOX_GEN_HTMLFILE
|
||||||
|
chmod ug+rw $SHOUTBOX_CHATFILE
|
||||||
|
chmod ug+rw $SHOUTBOX_GEN_HTMLFILE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local RC=0
|
||||||
|
_check_rc_ "$prepare_shoutbox_myself" "$RC" "$prepare_shoutbox_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_prepare_shoutbox_stop(){
|
||||||
|
_check_rc_ "$prepare_shoutbox_myself" "0"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_prepare_shoutbox_get_config(){
|
||||||
|
echo $prepare_shoutbox_needed_config
|
||||||
|
}
|
||||||
|
func_prepare_shoutbox_get_start_order(){
|
||||||
|
echo $prepare_shoutbox_start_order
|
||||||
|
}
|
||||||
|
func_prepare_shoutbox_get_stop_order(){
|
||||||
|
echo $prepare_shoutbox_stop_order
|
||||||
|
}
|
|
@ -5,8 +5,8 @@
|
||||||
MODULE_LIST="$MODULE_LIST radvd"
|
MODULE_LIST="$MODULE_LIST radvd"
|
||||||
|
|
||||||
radvd_myself="radvd"
|
radvd_myself="radvd"
|
||||||
radvd_start_order=20
|
radvd_start_order=32
|
||||||
radvd_stop_order=20
|
radvd_stop_order=13
|
||||||
# dnsmasq.conf is needed, because radvd.conf reads the configured interface
|
# dnsmasq.conf is needed, because radvd.conf reads the configured interface
|
||||||
# so, there is need to load that config file
|
# so, there is need to load that config file
|
||||||
radvd_needed_config="network_ipv6.conf dnsmasq.conf radvd.conf"
|
radvd_needed_config="network_ipv6.conf dnsmasq.conf radvd.conf"
|
||||||
|
|
32
piratebox/piratebox/modules.available/wifi_iw
Normal file
32
piratebox/piratebox/modules.available/wifi_iw
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST wifi_iw"
|
||||||
|
|
||||||
|
wifi_iw_myself="wifi_iw"
|
||||||
|
wifi_iw_start_order=21
|
||||||
|
wifi_iw_stop_order=74
|
||||||
|
wifi_iw_needed_config="wifi.conf"
|
||||||
|
wifi_iw_crucial="no"
|
||||||
|
|
||||||
|
func_wifi_iw_start(){
|
||||||
|
#Start here the wifi_iw i.e.
|
||||||
|
iw $PHY_IF interface add $AP_INTERFACE type managed
|
||||||
|
local RC=$?
|
||||||
|
_check_rc_ "$wifi_iw_myself" "$RC" "$wifi_iw_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_wifi_iw_stop(){
|
||||||
|
iw dev $INTERFACE del
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_wifi_iw_get_config(){
|
||||||
|
echo $wifi_iw_needed_config
|
||||||
|
}
|
||||||
|
func_wifi_iw_get_start_order(){
|
||||||
|
echo $wifi_iw_start_order
|
||||||
|
}
|
||||||
|
func_wifi_iw_get_stop_order(){
|
||||||
|
echo $wifi_iw_stop_order
|
||||||
|
}
|
51
piratebox/piratebox/modules.available/wifi_probe
Normal file
51
piratebox/piratebox/modules.available/wifi_probe
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
MODULE_LIST="$MODULE_LIST wifi_probe"
|
||||||
|
|
||||||
|
wifi_probe_myself="wifi_probe"
|
||||||
|
wifi_probe_start_order=22
|
||||||
|
wifi_probe_stop_order=99
|
||||||
|
wifi_probe_needed_config="wifi.conf"
|
||||||
|
wifi_probe_crucial="yes"
|
||||||
|
|
||||||
|
func_wifi_probe_start(){
|
||||||
|
#Start here the wifi_probe i.e.
|
||||||
|
func_wifi_probe_do
|
||||||
|
local RC=$?
|
||||||
|
_check_rc_ "$wifi_probe_myself" "$RC" "$wifi_probe_crucial"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_wifi_probe_stop(){
|
||||||
|
_check_rc_ "$wifi_probe_myself" "$0"
|
||||||
|
return $RC
|
||||||
|
}
|
||||||
|
|
||||||
|
func_wifi_probe_get_config(){
|
||||||
|
echo $wifi_probe_needed_config
|
||||||
|
}
|
||||||
|
func_wifi_probe_get_start_order(){
|
||||||
|
echo $wifi_probe_start_order
|
||||||
|
}
|
||||||
|
func_wifi_probe_get_stop_order(){
|
||||||
|
echo $wifi_probe_stop_order
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func_wifi_probe_do() {
|
||||||
|
ifconfig "$AP_INTERFACE" >> /dev/null 2>&1
|
||||||
|
local TEST_OK=$?
|
||||||
|
local CNT=$PROBE_TIME
|
||||||
|
while [[ "$TEST_OK" != "0" && "$CNT" != "0" ]]
|
||||||
|
do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
CNT=$(( $CNT - 1 ))
|
||||||
|
if [ "$CNT" = 0 ] ; then
|
||||||
|
return 99
|
||||||
|
fi
|
||||||
|
ifconfig "$AP_INTERFACE" >> /dev/null 2>&1
|
||||||
|
TEST_OK=$?
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
Loading…
Reference in a new issue