Changeset 10185 in hybrid for branches/releng-9.0/nanobsd/files/tools
- Timestamp:
- Mar 17, 2012, 11:51:28 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/files/tools/wl-config
r10136 r10185 1 1 #!/bin/sh 2 # Wireless Leiden proxyconfig-update script for FreeBSD 8.0 (nanobsd)2 # Wireless Leiden config-update script for FreeBSD 8.0 (nanobsd) 3 3 # Based on the 'API' of Jasper 4 # Rick van der Zwet ; Richard van Mansom4 # Rick van der Zwet 5 5 # XXX: TODO, some proper error checking for fetch 6 6 7 BASEURL="http://132.229.112.21/config/iris/proxy/FreeBSD/8.0-RELEASE/g_list.pl" 7 8 # Slow connection = no connection 9 HTTP_TIMEOUT=3 10 11 12 check_access() { 13 # Direct Access - Internal IP 14 BASEURL="http://172.16.4.46/wleiden/config/" 15 # Connectivity check 16 fetch -o /dev/null -q $BASEURL > /dev/null && return 17 echo "# WARN: Fetch via internal $BASEURL failed" 18 19 # Direct Access - External DNS 20 BASEURL="http://132.229.112.21/wleiden/config/" 21 fetch -o /dev/null -q $BASEURL > /dev/null && return 22 echo "# CRIT: Fetch via external $BASEURL failed" 23 24 exit 1 25 } 26 check_access 27 8 28 9 29 # Default config to fetch 10 CONFIG=`hostname -s | tr '[A-Z]' '[a-z]'`30 CONFIG=`hostname -s` 11 31 12 32 # Determine it's statup and running location and some other hints 13 33 # Skip named.conf as it not planned in current release 14 FILES="authorized_keys rc.conf.local resolv.conf"34 FILES="authorized_keys dnsmasq.conf rc.conf.local resolv.conf wleiden.yaml" 15 35 file_details() { 16 36 case "$1" in … … 20 40 FILE_HINT="" 21 41 ;; 42 'dnsmasq.conf') 43 STARTUP_LOC="/cfg/local/${FILE}" 44 RUNNING_LOC="/etc/local/${FILE}" 45 FILE_HINT="/usr/local/etc/rc.d/dnsmasq restart" 46 ;; 47 'named.conf') 48 STARTUP_LOC="/cfg/namedb/${FILE}" 49 RUNNING_LOC="/etc/namedb/${FILE}" 50 FILE_HINT="/etc/rc.d/named restart" 51 ;; 22 52 'rc.conf.local') 23 53 STARTUP_LOC="/cfg/${FILE}" … … 30 60 FILE_HINT="" 31 61 ;; 62 'wleiden.yaml') 63 STARTUP_LOC="/cfg/local/${FILE}" 64 RUNNING_LOC="/etc/local/${FILE}" 65 FILE_HINT="" 66 ;; 32 67 esac 33 68 } … … 36 71 ( 37 72 echo "Usage: $0 [-bn] [-c <config>] [-m <all|startup|testing|running>]" 38 echo " -b 39 echo " -c <config> 40 echo " -n 41 echo " -m all 42 echo " -m startup 43 echo " -m testing 44 echo " -m running 45 echo " -m hack copyrunning files to config partition"73 echo " -b = batch mode, no user input" 74 echo " -c <config> = default configuration to fetch" 75 echo " -n = do not mount config partition" 76 echo " -m all = copy config files to running & config partition [default]" 77 echo " -m startup = copy config files to config partition" 78 echo " -m testing = do not copy config files" 79 echo " -m running = copy config files to running partition" 80 echo " -m hack = copy running files to config partition" 46 81 ) 1>&2 47 82 exit 2 … … 80 115 81 116 if [ "${OPT_RUNNING}" -eq 1 ]; then 82 echo " INFO: Storing new config files in running configuration"117 echo "# INFO: Storing new config files in running configuration" 83 118 fi 84 119 85 120 if [ "${OPT_STARTUP}" -eq 1 ]; then 86 echo " INFO: Storing new config files in startup configuration"121 echo "# INFO: Storing new config files in startup configuration" 87 122 fi 88 123 89 124 if [ "${OPT_HACK}" -eq 1 ]; then 90 echo " WARN: Copy running configuration to startup configuration"91 echo " WARN: Please do mind to document/mention this changes somewhere"125 echo "# WARN: Copy running configuration to startup configuration" 126 echo "# WARN: Please do mind to document/mention this changes somewhere" 92 127 fi 93 128 … … 107 142 else 108 143 echo "WARNING: Input '${INPUT}' is not valid, some hints..." 109 grep "${INPUT}" ${TMPDIR}/node_list.txt144 grep -i "${INPUT}" ${TMPDIR}/node_list.txt 110 145 return 1 111 146 fi … … 158 193 SOURCE=$1 159 194 TARGET=$2 160 diff - q ${SOURCE} ${TARGET} >/dev/null2>/dev/null195 diff -I '^# Generated at ' ${SOURCE} ${TARGET} 2>/dev/null 161 196 if [ $? -ne 0 ]; then 162 197 mkdir -p `dirname ${TARGET}` || exit 1 … … 200 235 file_details ${FILE} 201 236 202 echo " INFO: Working on file: '${FILE}'"237 echo "# INFO: Working on file: '${FILE}'" 203 238 # Copy file boot location 204 239 if [ ${OPT_STARTUP} -eq 1 ]; then … … 210 245 copy_file ${FRESH_LOC} ${RUNNING_LOC} 211 246 if [ $? -eq 0 ]; then 212 echo " INFO: '${FILE}' changed"247 echo "# INFO: '${FILE}' changed" 213 248 if [ -n "${FILE_HINT}" ]; then 214 echo " INFO: For instant activate: ${FILE_HINT}"249 echo "# INFO: For instant activate: ${FILE_HINT}" 215 250 echo "" 216 251 fi
Note:
See TracChangeset
for help on using the changeset viewer.