mirror of
https://github.com/PirateBox-Dev/PirateBoxScripts_Webserver.git
synced 2026-12-04 16:28:42 +00:00
install_piratebox.sh : Remove the need to provide config file
This commit is contained in:
1 parent
70e90727e9
commit
22cd996dd5
4 files changed
+22
-21
No files matched your search
@@ -3,7 +3,7 @@
|
||||
if [[ ! -d /opt/piratebox/share/board ]]; then
|
||||
echo "You have to install the imageboard first!"
|
||||
echo "Run (as root):"
|
||||
echo "\t/opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard"
|
||||
echo "\t/opt/piratebox/bin/install_piratebox.sh imageboard"
|
||||
else
|
||||
echo -n "Imageboard admin password: "
|
||||
read -s BOARDPASSWORD
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/bin/sh
|
||||
## PirateBox installer script
|
||||
## created by Matthias Strubel (c)2011-2014 GPL-3
|
||||
## created by Matthias Strubel (c)2011-2017 GPL-3
|
||||
##
|
||||
|
||||
PIRATEBOX_CONFIG="/opt/piratebox/conf/piratebox.con"
|
||||
|
||||
create_content_folder(){
|
||||
|
||||
echo "Creating 'content' folder on USB stick and move over stuff"
|
||||
@@ -21,8 +23,8 @@ create_content_folder(){
|
||||
|
||||
# Load configfile
|
||||
|
||||
if [ -z $1 ] || [ -z $2 ]; then
|
||||
echo "Usage install_piratebox my_config <part>"
|
||||
if [ -z $1 ]; then
|
||||
echo "Usage install_piratebox <part>"
|
||||
echo " Parts: "
|
||||
echo " part2 : sets Permissions and links correctly"
|
||||
echo " imageboard : configures kareha imageboard with Basic configuration"
|
||||
@@ -35,16 +37,15 @@ if [ -z $1 ] || [ -z $2 ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f $1 ] ; then
|
||||
echo "Config-File $1 not found..."
|
||||
if [ ! -f "$PIRATEBOX_CONFIG" ] ; then
|
||||
echo "Config-File "$PIRATEBOX_CONFIG" not found..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Load config
|
||||
PIRATEBOX_CONFIG=$1
|
||||
. $1
|
||||
. "$PIRATEBOX_CONFIG"
|
||||
|
||||
if [ $2 = 'pyForum' ] ; then
|
||||
if [ $1 = 'pyForum' ] ; then
|
||||
cp -v $PIRATEBOX_FOLDER/src/forest.py $WWW_FOLDER/cgi-bin
|
||||
cp -v $PIRATEBOX_FOLDER/src/forest.css $WWW_FOLDER/content/css
|
||||
mkdir -p $PIRATEBOX_FOLDER/forumspace
|
||||
@@ -56,7 +57,7 @@ fi
|
||||
|
||||
|
||||
|
||||
if [ $2 = 'part2' ] ; then
|
||||
if [ $1 = 'part2' ] ; then
|
||||
echo "Starting initialize PirateBox Part2.."
|
||||
#Create directories
|
||||
# mkdir -p $PIRATEBOX_FOLDER/share/Shared
|
||||
@@ -89,7 +90,7 @@ if [ $2 = 'part2' ] ; then
|
||||
fi
|
||||
|
||||
#Install the image-board
|
||||
if [ $2 = 'imageboard' ] ; then
|
||||
if [ $1 = 'imageboard' ] ; then
|
||||
|
||||
if [ -e $PIRATEBOX_FOLDER/share/board/init_done ] ; then
|
||||
echo "$PIRATEBOX_FOLDER/share/board/init_done file Found in Kareha folder. Won't reinstall board."
|
||||
@@ -138,7 +139,7 @@ if [ $2 = 'imageboard' ] ; then
|
||||
touch $PIRATEBOX_FOLDER/share/board/init_done
|
||||
fi
|
||||
|
||||
if [ $2 = "station_cnt" ] ; then
|
||||
if [ $1 = "station_cnt" ] ; then
|
||||
#we want to append the crontab, not overwrite
|
||||
crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null
|
||||
echo "#--- Crontab for PirateBox-Station-Cnt" >> $PIRATEBOX_FOLDER/tmp/crontab
|
||||
@@ -149,7 +150,7 @@ if [ $2 = "station_cnt" ] ; then
|
||||
echo "installed, now every 2 minutes your station count is refreshed"
|
||||
fi
|
||||
|
||||
if [ $2 = "flush_dns_reg" ] ; then
|
||||
if [ $1 = "flush_dns_reg" ] ; then
|
||||
crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null
|
||||
echo "#--- Crontab for dnsmasq flush" >> $PIRATEBOX_FOLDER/tmp/crontab
|
||||
echo " */2 * * * * $PIRATEBOX_FOLDER/bin/flush_dnsmasq.sh > $PIRATEBOX_FOLDER/tmp/dnsmasq_flush.log " >> $PIRATEBOX_FOLDER/tmp/crontab
|
||||
@@ -165,12 +166,12 @@ set_hostname() {
|
||||
sed "s|HOST=\"$HOST\"|HOST=\"$name\"|" -i $PIRATEBOX_CONFIG
|
||||
}
|
||||
|
||||
if [ $2 = "hostname" ] ; then
|
||||
echo "Switching hostname to $3"
|
||||
set_hostname "$3"
|
||||
if [ $1 = "hostname" ] ; then
|
||||
echo "Switching hostname to $2"
|
||||
set_hostname "$2"
|
||||
echo "..done"
|
||||
fi
|
||||
|
||||
if [ $2 = "content" ] ; then
|
||||
if [ $1 = "content" ] ; then
|
||||
create_content_folder
|
||||
fi
|
||||
@@ -63,7 +63,7 @@ if [ -f $PIRATEBOX/conf/init_done ] ; then
|
||||
INIT=OK
|
||||
else
|
||||
$PIRATEBOX/bin/hooks/hook_pre_init.sh "$CONF"
|
||||
$PIRATEBOX/bin/install_piratebox.sh "$CONF" part2
|
||||
$PIRATEBOX/bin/install_piratebox.sh part2
|
||||
$PIRATEBOX/bin/hooks/hook_post_init.sh "$CONF"
|
||||
touch $PIRATEBOX/conf/init_done
|
||||
fi
|
||||
@@ -73,7 +73,7 @@ fi
|
||||
# only if it is not already existing.
|
||||
# This can be any time.
|
||||
if [ ! -d $WWW_CONTENT ] ; then
|
||||
$PIRATEBOX/bin/install_piratebox.sh "$CONF" content
|
||||
$PIRATEBOX/bin/install_piratebox.sh content
|
||||
fi
|
||||
|
||||
# Command Line for DNSMASQ, use extra config file generated from command above
|
||||
|
||||
@@ -56,7 +56,7 @@ if [[ -f $PIRATEBOX/conf/init_done ]] ; then
|
||||
INIT=OK
|
||||
else
|
||||
$PIRATEBOX/bin/hooks/hook_pre_init.sh "$CONF"
|
||||
$PIRATEBOX/bin/install_piratebox.sh "$CONF" part2
|
||||
$PIRATEBOX/bin/install_piratebox.sh part2
|
||||
$PIRATEBOX/bin/hooks/hook_post_init.sh "$CONF"
|
||||
touch $PIRATEBOX/conf/init_done
|
||||
fi
|
||||
@@ -66,7 +66,7 @@ fi
|
||||
# only if it is not already existing.
|
||||
# This can be any time.
|
||||
if [ ! -d $WWW_CONTENT ] ; then
|
||||
$PIRATEBOX/bin/install_piratebox.sh "$CONF" content
|
||||
$PIRATEBOX/bin/install_piratebox.sh content
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user