Skip to content

Commit fca4b90

Browse files
committed
new function for enabling and disabling shoutbox on Librarybox
1 parent 1e7ef11 commit fca4b90

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Enable, Disable ftp for librarybox configuration
6+
#
7+
# Available global variables
8+
# CONFIG_TMP_STORE
9+
# CONFIG_STORE
10+
11+
12+
#uncommend the following line for REAL modules
13+
MODULE_LIST="$MODULE_LIST librarybox_shoutbox"
14+
15+
librarybox_shoutbox_myself="librarybox_shoutbox" #contains the name of the module
16+
librarybox_shoutbox_config_file="librarybox_shoutbox.txt"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
### duplicate variable name with different content
21+
librarybox_shoutbox_piratebox_config=/opt/piratebox/conf/hook_custom.conf
22+
23+
# Read configuration out of the system and save it to librarybox_shoutbox_system_config depending on the
24+
# parameter
25+
func_read_system_config_librarybox_shoutbox() {
26+
local path=$1 ; shift
27+
28+
echo "Extracting SHOUTBOX parameter from $librarybox_shoutbox_piratebox_config"
29+
config_line=$(grep SHOUTBOX_ENABLED=\" $librarybox_shoutbox_piratebox_config )
30+
#extract value
31+
config_line=${config_line#SHOUTBOX_ENABLED=\"}
32+
config_value=${config_line%\"}
33+
34+
echo $config_value > $path/$librarybox_shoutbox_config_file
35+
}
36+
37+
# Parse the first parameter with the changed value
38+
# do the stuff you need to do for changing the configuratioj
39+
func_set_system_config_librarybox_ftp(){
40+
local value=$1 ; shift
41+
local old_value=$1; shift
42+
43+
echo "Changing Shoutbox-function for LibraryBox"
44+
sed "s|SHOUTBOX_ENABLED=\"$old_value\"|SHOUTBOX_ENABLED=\"$value\"|" -i $librarybox_shoutbox_piratebox_config
45+
46+
}
47+
48+
49+
#This function is called to compare content and et differences
50+
# to initiate a restart in the end, set "changed=1"
51+
# the easiest comparison can be used with auto_default_compare
52+
# see below
53+
func_compare_and_set_librarybox_ftp(){
54+
55+
auto_config_lookup_and_set "$librarybox_shoutbox_myself" \
56+
"$cfg_auto_folder/$librarybox_shoutbox_config_file" \
57+
"$cfg_tmp_folder/$librarybox_shoutbox_config_file"
58+
59+
}

0 commit comments

Comments
 (0)