Skip to content

Commit

Permalink
changed config file for openwrt-hostname
Browse files Browse the repository at this point in the history
changed paramters for ftp-sync server
Merge branch 'development'
  • Loading branch information
MaStr committed Oct 25, 2013
2 parents 576be17 + afdd313 commit 17c8828
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules.available/13_openwrt_hostname.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 57 additions & 0 deletions modules.available/51_piratebox_node_ip.sh
Original file line number Diff line number Diff line change
@@ -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"

}
8 changes: 4 additions & 4 deletions modules.available/60_librarybox_ftpsync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ 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
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
Expand All @@ -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

}

Expand Down

0 comments on commit 17c8828

Please sign in to comment.