Skip to content

Commit f29bd93

Browse files
committed
new modules for librarybox and some fixes
1 parent b8c1664 commit f29bd93

10 files changed

Lines changed: 300 additions & 4 deletions

modules.available/10_openwrt_ssid.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func_read_system_config_openwrt_ssid() {
2828
func_set_system_config_openwrt_ssid(){
2929
local value=$1 ; shift
3030
uci set "wireless.@wifi-iface[$interface_no].ssid=$value"
31+
uci_commit_needed="1"
3132
}
3233

3334

modules.available/11_openwrt_txpower.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func_read_system_config_openwrt_txpower() {
2828
func_set_system_config_openwrt_txpower(){
2929
local value=$1 ; shift
3030
uci set "wireless.radio0.txpower=$value"
31+
uci_commit_needed="1"
3132
}
3233

3334

modules.available/12_openwrt_channel.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func_read_system_config_openwrt_channel() {
2828
func_set_system_config_openwrt_channel(){
2929
local value=$1 ; shift
3030
uci set "wireless.radio0.channel=$value"
31+
uci_commit_needed="1"
32+
3133
}
3234

3335

modules.available/13_openwrt_hostname.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ func_set_system_config_openwrt_hostname(){
2929
ip=$(uci get network.lan.ipaddr)
3030

3131
uci set "system.@system[0].hostname=$value"
32+
uci_commit_needed="1"
33+
3234
echo "127.0.0.1 $value localhost." >/etc/hosts
3335
echo "$ip $value" >>/etc/hosts
3436

modules.available/50_piratebox_hostname.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
#uncommend the following line for REAL modules
13-
#MODULE_LIST="$MODULE_LIST piratebox_hostname"
13+
MODULE_LIST="$MODULE_LIST piratebox_hostname"
1414

1515
piratebox_hostname_myself="piratebox_hostname" #contains the name of the module
1616
piratebox_hostname_config_file="hostname"
@@ -49,8 +49,8 @@ func_set_system_config_piratebox_hostname(){
4949
# see below
5050
func_compare_and_set_piratebox_hostname(){
5151

52-
auto_config_lookup_and_set "$openwrt_ssid_myself" \
53-
"$cfg_auto_folder/$openwrt_ssid_config_file" \
54-
"$cfg_tmp_folder/$openwrt_ssid_config_file"
52+
auto_config_lookup_and_set "$piratebox_hostname_myself" \
53+
"$cfg_auto_folder/$piratebox_hostename_config_file" \
54+
"$cfg_tmp_folder/$piratebox_hostename_config_file"
5555

5656
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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_ftp"
14+
15+
librarybox_ftp_myself="librarybox_ftp" #contains the name of the module
16+
librarybox_ftp_config_file="librarybox_ftp"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
piratebox_config=/opt/piratebox/conf/hook_custom.conf
21+
22+
# Read configuration out of the system and save it to librarybox_ftp_system_config depending on the
23+
# parameter
24+
func_read_system_config_librarybox_ftp() {
25+
local path=$1 ; shift
26+
27+
echo "Extracting FTP parameter from $piratebox_config"
28+
config_line=$(grep FTP_ENABLED=\" $piratebox_config )
29+
#extract value
30+
config_line=${config_line#FTP_ENABLED=\"}
31+
config_value=${config_line%\"}
32+
33+
echo $config_value > $path/$librarybox_ftp_config_file
34+
}
35+
36+
# Parse the first parameter with the changed value
37+
# do the stuff you need to do for changing the configuratioj
38+
func_set_system_config_librarybox_ftp(){
39+
local value=$1 ; shift
40+
local old_value=$1; shift
41+
42+
echo "Changing ftp for LibraryBox"
43+
sed "s|FTP_ENABLED=\"$old_value\"|FTP_ENABLED=\"$value\"|" -i $piratebox_config
44+
45+
}
46+
47+
48+
#This function is called to compare content and et differences
49+
# to initiate a restart in the end, set "changed=1"
50+
# the easiest comparison can be used with auto_default_compare
51+
# see below
52+
func_compare_and_set_librarybox_ftp(){
53+
54+
auto_config_lookup_and_set "$librarybox_ftp_myself" \
55+
"$cfg_auto_folder/$librarybox_ftp_config_file" \
56+
"$cfg_tmp_folder/$librarybox_ftp_config_file"
57+
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Enable, Disable ftpadmin 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_ftpadmin"
14+
15+
librarybox_ftpadmin_myself="librarybox_ftpadmin" #contains the name of the module
16+
librarybox_ftpadmin_config_file="librarybox_ftpadmin"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
ftp_config=/opt/piratebox/conf/ftp/ftp.conf
21+
22+
# Read configuration out of the system and save it to librarybox_ftpadmin_system_config depending on the
23+
# parameter
24+
func_read_system_config_librarybox_ftpadmin() {
25+
local path=$1 ; shift
26+
27+
echo "Extracting FTP-admin parameter from $ftp_config"
28+
config_line=$(grep ADMIN_ACCESS=\" $ftp_config )
29+
#extract value
30+
config_line=${config_line#ADMIN_ACCESS=\"}
31+
config_value=${config_line%\"}
32+
33+
echo $config_value > $path/$librarybox_ftpadmin_config_file
34+
}
35+
36+
# Parse the first parameter with the changed value
37+
# do the stuff you need to do for changing the configuratioj
38+
func_set_system_config_librarybox_ftpadmin(){
39+
local value=$1 ; shift
40+
local old_value=$1; shift
41+
42+
echo "Changing ftp-admin access for LibraryBox"
43+
sed "s|ADMIN_ACCESS=\"$old_value\"|ADMIN_ACCESS=\"$value\"|" -i $ftp_config
44+
45+
}
46+
47+
48+
#This function is called to compare content and et differences
49+
# to initiate a restart in the end, set "changed=1"
50+
# the easiest comparison can be used with auto_default_compare
51+
# see below
52+
func_compare_and_set_librarybox_ftpadmin(){
53+
54+
auto_config_lookup_and_set "$librarybox_ftpadmin_myself" \
55+
"$cfg_auto_folder/$librarybox_ftpadmin_config_file" \
56+
"$cfg_tmp_folder/$librarybox_ftpadmin_config_file"
57+
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Enable, Disable anonymous FTP access 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_ftpanon"
14+
15+
librarybox_ftpanon_myself="librarybox_ftpanon" #contains the name of the module
16+
librarybox_ftpanon_config_file="librarybox_ftpanon"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
ftp_config=/opt/piratebox/conf/ftp/ftp.conf
21+
22+
# Read configuration out of the system and save it to librarybox_ftpanon_system_config depending on the
23+
# parameter
24+
func_read_system_config_librarybox_ftpanon() {
25+
local path=$1 ; shift
26+
27+
echo "Extracting FTP-Anon parameter from $ftp_config"
28+
config_line=$(grep ENABLE_SYNC=\" $ftp_config )
29+
#extract value
30+
config_line=${config_line#ENABLE_ANON=\"}
31+
config_value=${config_line%\"}
32+
33+
echo $config_value > $path/$librarybox_ftpanon_config_file
34+
}
35+
36+
# Parse the first parameter with the changed value
37+
# do the stuff you need to do for changing the configuratioj
38+
func_set_system_config_librarybox_ftpanon(){
39+
local value=$1 ; shift
40+
local old_value=$1; shift
41+
42+
echo "Changing ftp-anonymous access for LibraryBox"
43+
sed "s|ENABLE_ANON=\"$old_value\"|ENABLE_ANON=\"$value\"|" -i $ftp_config
44+
45+
}
46+
47+
48+
#This function is called to compare content and et differences
49+
# to initiate a restart in the end, set "changed=1"
50+
# the easiest comparison can be used with auto_default_compare
51+
# see below
52+
func_compare_and_set_librarybox_ftpanon(){
53+
54+
auto_config_lookup_and_set "$librarybox_ftpanon_myself" \
55+
"$cfg_auto_folder/$librarybox_ftpanon_config_file" \
56+
"$cfg_tmp_folder/$librarybox_ftpanon_config_file"
57+
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Enable, Disable sync access 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_ftpsync"
14+
15+
librarybox_ftpsync_myself="librarybox_ftpsync" #contains the name of the module
16+
librarybox_ftpsync_config_file="librarybox_ftpsync"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
ftp_config=/opt/piratebox/conf/ftp/ftp.conf
21+
22+
# Read configuration out of the system and save it to librarybox_ftpsync_system_config depending on the
23+
# parameter
24+
func_read_system_config_librarybox_ftpsync() {
25+
local path=$1 ; shift
26+
27+
echo "Extracting FTP-Sync parameter from $ftp_config"
28+
config_line=$(grep ENABLE_SYNC=\" $ftp_config )
29+
#extract value
30+
config_line=${config_line#ENABLE_SYNC=\"}
31+
config_value=${config_line%\"}
32+
33+
echo $config_value > $path/$librarybox_ftpsync_config_file
34+
}
35+
36+
# Parse the first parameter with the changed value
37+
# do the stuff you need to do for changing the configuratioj
38+
func_set_system_config_librarybox_ftpsync(){
39+
local value=$1 ; shift
40+
local old_value=$1; shift
41+
42+
echo "Changing ftp-sync access for LibraryBox"
43+
sed "s|ENABLE_SYNC=\"$old_value\"|ENABLE_SYNC=\"$value\"|" -i $ftp_config
44+
45+
}
46+
47+
48+
#This function is called to compare content and et differences
49+
# to initiate a restart in the end, set "changed=1"
50+
# the easiest comparison can be used with auto_default_compare
51+
# see below
52+
func_compare_and_set_librarybox_ftpsync(){
53+
54+
auto_config_lookup_and_set "$librarybox_ftpsync_myself" \
55+
"$cfg_auto_folder/$librarybox_ftpsync_config_file" \
56+
"$cfg_tmp_folder/$librarybox_ftpsync_config_file"
57+
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Set Port for Sync Access in 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_ftpsyncport"
14+
15+
librarybox_ftpsyncport_myself="librarybox_ftpsyncport" #contains the name of the module
16+
librarybox_ftpsyncport_config_file="librarybox_ftpsyncport"
17+
18+
# FTP configuration is currently located in the hook
19+
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20+
ftp_config=/opt/piratebox/conf/ftp/ftp.conf
21+
22+
# Read configuration out of the system and save it to librarybox_ftpsyncport_system_config depending on the
23+
# parameter
24+
func_read_system_config_librarybox_ftpsyncport() {
25+
local path=$1 ; shift
26+
27+
echo "Extracting FTP-Sync port from $ftp_config"
28+
config_line=$(grep SYNC_PORT=\" $ftp_config )
29+
#extract value
30+
config_line=${config_line#SYNC_PORT=\"}
31+
config_value=${config_line%\"}
32+
33+
echo $config_value > $path/$librarybox_ftpsyncport_config_file
34+
}
35+
36+
# Parse the first parameter with the changed value
37+
# do the stuff you need to do for changing the configuratioj
38+
func_set_system_config_librarybox_ftpsyncport(){
39+
local value=$1 ; shift
40+
local old_value=$1; shift
41+
42+
echo "Changing ftp-sync Port for LibraryBox"
43+
sed "s|SYNC_PORT=\"$old_value\"|SYNC_PORT=\"$value\"|" -i $ftp_config
44+
45+
}
46+
47+
48+
#This function is called to compare content and et differences
49+
# to initiate a restart in the end, set "changed=1"
50+
# the easiest comparison can be used with auto_default_compare
51+
# see below
52+
func_compare_and_set_librarybox_ftpsyncport(){
53+
54+
auto_config_lookup_and_set "$librarybox_ftpsyncport_myself" \
55+
"$cfg_auto_folder/$librarybox_ftpsyncport_config_file" \
56+
"$cfg_tmp_folder/$librarybox_ftpsyncport_config_file"
57+
58+
}

0 commit comments

Comments
 (0)