Skip to content

Commit 17c8828

Browse files
committed
changed config file for openwrt-hostname
changed paramters for ftp-sync server Merge branch 'development'
2 parents 576be17 + afdd313 commit 17c8828

File tree

3 files changed

+62
-5
lines changed

3 files changed

+62
-5
lines changed

modules.available/13_openwrt_hostname.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
MODULE_LIST="$MODULE_LIST openwrt_hostname"
1111

1212
openwrt_hostname_myself="openwrt_hostname" #contains the name of the module
13-
openwrt_hostname_config_file="hostname.txt"
13+
openwrt_hostname_config_file="system_hostname.txt"
1414

1515
# Read configuration out of the system and save it to openwrt_hostname_system_config depending on the
1616
# parameter
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/sh
2+
#
3+
# AutoConfiguration via USB file
4+
#
5+
# Prints out the PirateBox Node IP and changes it
6+
# DOES NOT change IP in OPENWRT network config
7+
#
8+
# Available global variables
9+
# CONFIG_TMP_STORE
10+
# CONFIG_STORE
11+
12+
13+
#uncommend the following line for REAL modules
14+
MODULE_LIST="$MODULE_LIST piratebox_node_ip"
15+
16+
piratebox_node_ip_myself="piratebox_node_ip" #contains the name of the module
17+
piratebox_node_ip_config_file="piratebox_node_ip.txt"
18+
19+
node_config=/opt/piratebox/conf/node.conf
20+
21+
# Read configuration out of the system and save it to piratebox_node_ip_system_config depending on the
22+
# parameter
23+
func_read_system_config_piratebox_node_ip() {
24+
local path=$1 ; shift
25+
26+
echo "Extracting Node-IPv6 IP parameter from $node_config"
27+
config_line=$(grep NODE_IPV6_IP=\" $node_config )
28+
#extract value
29+
config_line=${config_line#NODE_IPV6_IP=\'}
30+
config_value=${config_line%\'}
31+
32+
echo $config_value > $path/$piratebox_node_ip_config_file
33+
}
34+
35+
# Parse the first parameter with the changed value
36+
# do the stuff you need to do for changing the configuratioj
37+
func_set_system_config_piratebox_node_ip(){
38+
local value=$1 ; shift
39+
local old_value=$1; shift
40+
41+
echo "Changing PirateBox node ipv6 ip ..."
42+
sed "s|NODE_IPV6_IP='$old_value'|NODE_IPV6_IP='$value'|" -i $node_config
43+
44+
}
45+
46+
47+
#This function is called to compare content and et differences
48+
# to initiate a restart in the end, set "changed=1"
49+
# the easiest comparison can be used with auto_default_compare
50+
# see below
51+
func_compare_and_set_piratebox_node_ip(){
52+
53+
auto_config_lookup_and_set "$piratebox_node_ip_myself" \
54+
"$cfg_auto_folder/$piratebox_node_ip_config_file" \
55+
"$cfg_tmp_folder/$piratebox_node_ip_config_file"
56+
57+
}

modules.available/60_librarybox_ftpsync.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ librarybox_ftpsync_config_file="librarybox_ftpsync.txt"
1717

1818
# FTP configuration is currently located in the hook
1919
#librarybox_config=/opt/piratebox/conf/piratebox.conf
20-
ftp_config=/opt/piratebox/conf/ftp/ftp.conf
20+
ftp_config=/opt/piratebox/conf/hook_custom.conf
2121

2222
# Read configuration out of the system and save it to librarybox_ftpsync_system_config depending on the
2323
# parameter
2424
func_read_system_config_librarybox_ftpsync() {
2525
local path=$1 ; shift
2626

2727
echo "Extracting FTP-Sync parameter from $ftp_config"
28-
config_line=$(grep ENABLE_SYNC=\" $ftp_config )
28+
config_line=$(grep FTP_SYNC_ENABLED=\" $ftp_config )
2929
#extract value
30-
config_line=${config_line#ENABLE_SYNC=\"}
30+
config_line=${config_line#FTP_SYNC_ENABLED=\"}
3131
config_value=${config_line%\"}
3232

3333
echo $config_value > $path/$librarybox_ftpsync_config_file
@@ -40,7 +40,7 @@ func_set_system_config_librarybox_ftpsync(){
4040
local old_value=$1; shift
4141

4242
echo "Changing ftp-sync access for LibraryBox"
43-
sed "s|ENABLE_SYNC=\"$old_value\"|ENABLE_SYNC=\"$value\"|" -i $ftp_config
43+
sed "s|FTP_SYNC_ENABLED=\"$old_value\"|FTP_SYNC_ENABLED=\"$value\"|" -i $ftp_config
4444

4545
}
4646

0 commit comments

Comments
 (0)