Skip to content

Commit fbd41c3

Browse files
committed
Update for JSON file generation.
Fixes on FTP configuration-tool and config itself JSON as mime-type application/json now and not "stream" anymore Merge branch 'development'
2 parents 8a45fae + f606b7c commit fbd41c3

File tree

15 files changed

+131
-38
lines changed

15 files changed

+131
-38
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME = librarybox
2-
VERSION = 2.0.0_alpha5
2+
VERSION = 2.0.0_alpha7
33
ARCH = all
44

55
#PIRATEBOX_IMG_URL = "http://piratebox.aod-rpg.de/piratebox_ws_0.6_img.gz"
@@ -49,7 +49,7 @@ $(SRC_VERSION_TAG):
4949
# Create version tags
5050
# copy over stuff
5151
prepare_build: $(BUILD_FOLDER) $(SRC_VERSION_TAG) $(BUILD_SCRIPT_LOCATION)
52-
cp -vr $(SRC_SCRIPT_LOCATION) $(BUILD_SCRIPT_LOCATION)
52+
# cp -vr $(SRC_SCRIPT_LOCATION) $(BUILD_SCRIPT_LOCATION)
5353

5454

5555
$(BUILD_SCRIPT_LOCATION):
@@ -123,6 +123,7 @@ clean_image:
123123
cleanall: clean
124124
- rm -v $(MOD_IMAGE_TGZ)
125125
- rm -v $(MOD_PACKAGE_TGZ)
126+
- cd piratebox_origin && make clean
126127

127128
clean:
128129
- rm -rvf $(PACKAGE_FOLDER)

customization/bin/ftp_enable.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ mainmenu() {
198198
echo " With choosing hn like h1 , you get some help about the topic"
199199
echo " Every other button is a clean exit. "
200200
echo " "
201-
read -p " Coose an option: " option
201+
read -p " Choose an option: " option
202202

203203
case $option in
204204
("1") _toggle_ "FTP_ENABLED" ;;
205205
("2") _toggle_ "ADMIN_ACCESS" ;;
206206
("3") _toggle_ "ENABLE_SYNC" ;;
207207
("4") _toggle_ "ENABLE_ANON" ;;
208-
("5") passwd $SYNC_SYSTEM_USER ;;
209-
("6") passwd $BOX_SYSTEM_USER ;;
208+
("5") echo "System-User for Sync Access is $SYNC_SYSTEM_USER" && passwd $SYNC_SYSTEM_USER ;;
209+
("6") echo "System-User for Admin access is $BOX_SYSTEM_USER" && passwd $BOX_SYSTEM_USER ;;
210210
("h1") print_help_ftp ;;
211211
("h2") print_help_admin ;;
212212
("h3") print_help_sync ;;

customization/bin/hooks/hook_piratebox_start_done.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ if [ "$FTP_ENABLED" = "yes" ] ; then
3030
####### AnonAccess <-> $ENABLE_ANON
3131
####### SyncAccess <-> $ENABLE_SYNC
3232

33-
local proftpd_opt_admin=""
34-
local proftpd_opt_anon=""
35-
local proftpd_opt_sync=""
33+
proftpd_opt_admin=""
34+
proftpd_opt_anon=""
35+
proftpd_opt_sync=""
3636

3737
[ "$ADMIN_ACCESS" = "yes" ] && proftpd_opt_admin="-D AdminAccess"
3838
[ "$ENABLE_ANON" = "yes" ] && proftpd_opt_anon="-D AnonAccess"
@@ -44,3 +44,11 @@ if [ "$FTP_ENABLED" = "yes" ] ; then
4444

4545
fi
4646

47+
if [ "$SHOUTBOX_ENABLED" == "no" ] ; then
48+
# If the shoutbox is disabled, we remove the writable flag
49+
echo -n "Making shoutbox readonly..."
50+
chmod a-w $CHATFILE
51+
echo "done"
52+
fi
53+
54+
$PIRATEBOX_FOLDER/bin/json_generation.sh $1

customization/bin/hooks/hook_piratebox_stop.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ if [ -e "$PROFTPD_PID" ]; then
2222
kill $(cat $PROFTPD_PID)
2323
echo $?
2424
rm $PROFTPD_PID
25-
fi
25+
fi
26+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
# Matthias Strubel (c) 2013 - GPL3
4+
# Generate a JSON file, which relfects some part of the current configuration
5+
6+
# First parameter is the piratebox.conf
7+
### Used parameter : JSON_FILE
8+
9+
. $1
10+
11+
# json.conf contains some information about modules on the frontend
12+
. $PIRATEBOX_FOLDER/conf/json.conf
13+
14+
### JSON convert functions
15+
. $PIRATEBOX_FOLDER/lib/json_func.sh
16+
17+
18+
####
19+
# DROOPY_ENABLED => upload_droopy
20+
# DROOPY_PORT => droopy_port
21+
# HOST => droopy_host
22+
23+
json_droopy_enabled=`convert_yn_to_tf $DROOPY_ENABLED`
24+
json_shoutbox_enabled=`convert_yn_to_tf $SHOUTBOX_ENABLED`
25+
26+
echo "Generating json configuration file: $JSON_FILE"
27+
28+
echo "" > $JSON_FILE
29+
echo "{ \"librarybox\" : { \"module\" : { " >> $JSON_FILE
30+
#------------ upload configuration
31+
echo -n " \"upload\" : { \"status\" : $json_droopy_enabled , \"file\" : \"$UPLOAD_MODULE_FILE\" " >> $JSON_FILE
32+
#----------- droopy specialities
33+
if [ "$DROOPY_ENABLED" == "yes" ] ; then
34+
echo -n ", " >> $JSON_FILE
35+
echo -n " \"upload_style\" : \"droopy\" , " >> $JSON_FILE
36+
echo -n " \"droopy_port\" : \"$DROOPY_PORT\", \"droopy_host\" : \"$HOST\" " >> $JSON_FILE
37+
fi
38+
echo " } " >> $JSON_FILE
39+
40+
#--------------- Shoutbox config file
41+
echo ", \"shoutbox\" : { \"status\" : $json_shoutbox_enabled , \"file\" : \"$CHAT_MODULE_FILE\" } " >> $JSON_FILE
42+
43+
#---------------
44+
echo " } } }" >> $JSON_FILE

customization/conf/ftp/proftpd.conf.schema

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ AuthUserFile /etc/shadow
2222
AllowOverwrite on
2323
UserAlias #####BOX_USER##### #####BOX_SYSTEM_USER#####
2424
DefaultRoot #####ADMIN_FOLDER##### #####BOX_SYSTEM_GROUP#####
25+
DefaultChdir /
2526
<Limit LOGIN>
2627
DenyAll
2728
#####ADMIN_ACCESS#####

customization/conf/hook_custom.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ WWW_CONTENT="$SHARE_FOLDER/Content"
1111
FTP_ENABLED="yes"
1212
PROFTPD_CONFIG_FILE="$PIRATEBOX_FOLDER/conf/ftp/proftpd.conf"
1313
PROFTPD_PID="$PIRATEBOX_FOLDER/tmp/proftpd.pid"
14+
15+
16+
### Shoutbox
17+
SHOUTBOX_ENABLED="yes"
18+
19+
### JSON Configuration file for frontend
20+
JSON_FILE="$WWW_FOLDER/config.json"

customization/conf/json.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
###
3+
# This file contains some valid informations for the content
4+
##
5+
6+
7+
CHAT_MODULE_FILE="modules/chat.html"
8+
UPLOAD_MODULE_FILE="modules/upload.html"
9+
10+

customization/lib/json_func.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
# Matthias Strubel (c) 2013 - GPL3
4+
5+
convert_yn_to_tf(){
6+
local value=$1 ; shift
7+
if [ "$value" == "yes" ] ; then
8+
echo "true"
9+
else
10+
echo "false"
11+
fi
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head><title>Redirect...</title>
3+
<meta http-equiv="refresh" content="0;url=http://#####HOST#####/content" />
4+
</head>
5+
<body>
6+
<img src="../vc_counter.php" />Redirect
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)