diff --git a/piratebox/piratebox/bin/install_piratebox.sh b/piratebox/piratebox/bin/install_piratebox.sh index 30cc9f9..dd8248c 100755 --- a/piratebox/piratebox/bin/install_piratebox.sh +++ b/piratebox/piratebox/bin/install_piratebox.sh @@ -3,6 +3,22 @@ ## created by Matthias Strubel (c)2011-2014 GPL-3 ## +create_content_folder(){ + + echo "Creating 'content' folder on USB stick and move over stuff" + mkdir -p $WWW_CONTENT + cp -r $PIRATEBOX_FOLDER/www_content/* $WWW_CONTENT + + [ ! -L $PIRATEBOX_FOLDER/www/content ] && \ + ln -s $WWW_CONTENT $WWW_FOLDER/content + [ ! -e $WWW_FOLDER/favicon.ico ] && \ + ln -s $WWW_CONTENT/favicon.ico $WWW_FOLDER + + chown $LIGHTTPD_USER:$LIGHTTPD_GROUP $WWW_CONTENT -R + chmod u+rw $WWW_CONTENT + return 0 +} + # Load configfile if [ -z $1 ] || [ -z $2 ]; then @@ -49,13 +65,6 @@ if [ $2 = 'part2' ] ; then mkdir -p $PIRATEBOX_FOLDER/share/tmp mkdir -p $PIRATEBOX_FOLDER/tmp - #Create a content folder copy to the USB Stick - cp -rv $PIRATEBOX_FOLDER/www_content $PIRATEBOX_FOLDER/share - [ ! -L $PIRATEBOX_FOLDER/www/content ] && \ - ln -s $PIRATEBOX_FOLDER/share/www_content $WWW_FOLDER/content - [ ! -e $WWW_FOLDER/favicon.ico ] && \ - ln -s $PIRATEBOX_FOLDER/share/www_content/favicon.ico $WWW_FOLDER - #Distribute the Directory Listing files $PIRATEBOX_FOLDER/bin/distribute_files.sh $SHARE_FOLDER/Shared true #Set permissions @@ -159,3 +168,6 @@ if [ $2 = "hostname" ] ; then echo "..done" fi +if [ $2 = "content" ] ; then + create_content_folder +fi diff --git a/piratebox/piratebox/conf/piratebox.conf b/piratebox/piratebox/conf/piratebox.conf index 21fd018..e4acc74 100644 --- a/piratebox/piratebox/conf/piratebox.conf +++ b/piratebox/piratebox/conf/piratebox.conf @@ -20,6 +20,7 @@ PIRATEBOX_FOLDER="/opt/piratebox" WWW_FOLDER="/opt/piratebox/www" +WWW_CONTENT="/opt/piratebox/share/content" #Do not change untill really needed. PIRATEBOX_PYTHONPATH="$PIRATEBOX_FOLDER/python_lib" diff --git a/piratebox/piratebox/init.d/piratebox b/piratebox/piratebox/init.d/piratebox index 817fabb..7b95fff 100755 --- a/piratebox/piratebox/init.d/piratebox +++ b/piratebox/piratebox/init.d/piratebox @@ -69,7 +69,12 @@ else fi - +# Recreate the content folder, if it was deleted +# only if it is not already existing. +# This can be any time. +if [ ! -d $WWW_CONTENT ] ; then + $PIRATEBOX/bin/install_piratebox.sh "$CONF" content +fi # Command Line for DNSMASQ, use extra config file generated from command above CMD_DNSMASQ="-x $PIDFILE_DNSMASQ -C $CONF_DNSMASQ " diff --git a/piratebox/piratebox/init.d/piratebox_alt b/piratebox/piratebox/init.d/piratebox_alt index 2158bb0..8c1be33 100755 --- a/piratebox/piratebox/init.d/piratebox_alt +++ b/piratebox/piratebox/init.d/piratebox_alt @@ -62,6 +62,14 @@ else fi +# Recreate the content folder, if it was deleted +# only if it is not already existing. +# This can be any time. +if [ ! -d $WWW_CONTENT ] ; then + $PIRATEBOX/bin/install_piratebox.sh "$CONF" content +fi + + # Command Line for DNSMASQ, use extra config file generated from command above CMD_DNSMASQ="-x $PIDFILE_DNSMASQ -C $CONF_DNSMASQ " diff --git a/piratebox/piratebox/src/redirect.html.schema b/piratebox/piratebox/src/redirect.html.schema index eeb2d67..7dd58cc 100644 --- a/piratebox/piratebox/src/redirect.html.schema +++ b/piratebox/piratebox/src/redirect.html.schema @@ -1,6 +1,6 @@ Redirect... - +