From 3f9cdaa81d0ce0b9b419ba9091a341b281df2983 Mon Sep 17 00:00:00 2001 From: Matthias Strubel Date: Wed, 23 Oct 2013 18:19:51 +0200 Subject: [PATCH 1/3] added extraction for node ipv6 ip for PirateBox config --- modules.available/51_piratebox_node_ip.sh | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 modules.available/51_piratebox_node_ip.sh diff --git a/modules.available/51_piratebox_node_ip.sh b/modules.available/51_piratebox_node_ip.sh new file mode 100644 index 0000000..72527d8 --- /dev/null +++ b/modules.available/51_piratebox_node_ip.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# AutoConfiguration via USB file +# +# Prints out the PirateBox Node IP and changes it +# DOES NOT change IP in OPENWRT network config +# +# Available global variables +# CONFIG_TMP_STORE +# CONFIG_STORE + + +#uncommend the following line for REAL modules +MODULE_LIST="$MODULE_LIST piratebox_node_ip" + +piratebox_node_ip_myself="piratebox_node_ip" #contains the name of the module +piratebox_node_ip_config_file="piratebox_node_ip.txt" + +node_config=/opt/piratebox/conf/node.conf + +# Read configuration out of the system and save it to piratebox_node_ip_system_config depending on the +# parameter +func_read_system_config_piratebox_node_ip() { + local path=$1 ; shift + + echo "Extracting Node-IPv6 IP parameter from $node_config" + config_line=$(grep NODE_IPV6_IP=\" $node_config ) + #extract value + config_line=${config_line#NODE_IPV6_IP=\'} + config_value=${config_line%\'} + + echo $config_value > $path/$piratebox_node_ip_config_file +} + +# Parse the first parameter with the changed value +# do the stuff you need to do for changing the configuratioj +func_set_system_config_piratebox_node_ip(){ + local value=$1 ; shift + local old_value=$1; shift + + echo "Changing PirateBox node ipv6 ip ..." + sed "s|NODE_IPV6_IP='$old_value'|NODE_IPV6_IP='$value'|" -i $node_config + +} + + +#This function is called to compare content and et differences +# to initiate a restart in the end, set "changed=1" +# the easiest comparison can be used with auto_default_compare +# see below +func_compare_and_set_piratebox_node_ip(){ + + auto_config_lookup_and_set "$piratebox_node_ip_myself" \ + "$cfg_auto_folder/$piratebox_node_ip_config_file" \ + "$cfg_tmp_folder/$piratebox_node_ip_config_file" + +} From e775225b1871c0253105cf37846f443010a7f3c4 Mon Sep 17 00:00:00 2001 From: Matthias Strubel Date: Fri, 25 Oct 2013 16:53:43 +0200 Subject: [PATCH 2/3] use different config file for hostname. PirateBox hostname works as domain name. Hostname would be more like node-name in mesh configuration --- modules.available/13_openwrt_hostname.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.available/13_openwrt_hostname.sh b/modules.available/13_openwrt_hostname.sh index de510bb..bbe24f3 100644 --- a/modules.available/13_openwrt_hostname.sh +++ b/modules.available/13_openwrt_hostname.sh @@ -10,7 +10,7 @@ MODULE_LIST="$MODULE_LIST openwrt_hostname" openwrt_hostname_myself="openwrt_hostname" #contains the name of the module -openwrt_hostname_config_file="hostname.txt" +openwrt_hostname_config_file="system_hostname.txt" # Read configuration out of the system and save it to openwrt_hostname_system_config depending on the # parameter From afdd3139f19c4542c07f092a78eabf4bdb060615 Mon Sep 17 00:00:00 2001 From: Matthias Strubel Date: Fri, 25 Oct 2013 16:56:45 +0200 Subject: [PATCH 3/3] reflect changes for overwork of proftpd sync configuration --- modules.available/60_librarybox_ftpsync.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules.available/60_librarybox_ftpsync.sh b/modules.available/60_librarybox_ftpsync.sh index 6e40c81..e639f2a 100644 --- a/modules.available/60_librarybox_ftpsync.sh +++ b/modules.available/60_librarybox_ftpsync.sh @@ -17,7 +17,7 @@ librarybox_ftpsync_config_file="librarybox_ftpsync.txt" # FTP configuration is currently located in the hook #librarybox_config=/opt/piratebox/conf/piratebox.conf -ftp_config=/opt/piratebox/conf/ftp/ftp.conf +ftp_config=/opt/piratebox/conf/hook_custom.conf # Read configuration out of the system and save it to librarybox_ftpsync_system_config depending on the # parameter @@ -25,9 +25,9 @@ func_read_system_config_librarybox_ftpsync() { local path=$1 ; shift echo "Extracting FTP-Sync parameter from $ftp_config" - config_line=$(grep ENABLE_SYNC=\" $ftp_config ) + config_line=$(grep FTP_SYNC_ENABLED=\" $ftp_config ) #extract value - config_line=${config_line#ENABLE_SYNC=\"} + config_line=${config_line#FTP_SYNC_ENABLED=\"} config_value=${config_line%\"} echo $config_value > $path/$librarybox_ftpsync_config_file @@ -40,7 +40,7 @@ func_set_system_config_librarybox_ftpsync(){ local old_value=$1; shift echo "Changing ftp-sync access for LibraryBox" - sed "s|ENABLE_SYNC=\"$old_value\"|ENABLE_SYNC=\"$value\"|" -i $ftp_config + sed "s|FTP_SYNC_ENABLED=\"$old_value\"|FTP_SYNC_ENABLED=\"$value\"|" -i $ftp_config }