Changeset 10917 in hybrid


Ignore:
Timestamp:
May 19, 2012, 4:31:06 PM (13 years ago)
Author:
rick
Message:

POST_CMD is a bit to advanced for our good, make sure to have the user
specify it before doing it.

While here; Make sure we do not mount when we are virtually mounted (e.g. pre-config image).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/files/tools/wl-config

    r10827 r10917  
    4545     STARTUP_LOC="/cfg/local/${FILE}"
    4646     RUNNING_LOC="/usr/local/etc/${FILE}"
    47      FILE_HINT="service isc-dhcpd restart"
     47     POST_CMD="service isc-dhcpd restart"
    4848   ;;
    4949  'dnsmasq.conf')
    5050     STARTUP_LOC="/cfg/local/${FILE}"
    5151     RUNNING_LOC="/usr/local/etc/${FILE}"
    52      FILE_HINT="service dnsmasq restart"
     52     POST_CMD="service dnsmasq restart"
    5353   ;;
    5454   'motd')
     
    6060     STARTUP_LOC="/cfg/namedb/${FILE}"
    6161     RUNNING_LOC="/etc/namedb/${FILE}"
    62      FILE_HINT="service named restart"
     62     POST_CMD="service named restart"
    6363   ;;
    6464  'rc.conf.local')
    6565     STARTUP_LOC="/cfg/${FILE}"
    6666     RUNNING_LOC="/etc/${FILE}"
    67      FILE_HINT="service netif restart"
     67     FILE_HINT="Restart interfaces with: nohup service netif restart"
    6868   ;;
    6969   'resolv.conf')
    7070     STARTUP_LOC="/cfg/${FILE}"
    7171     RUNNING_LOC="/etc/${FILE}"
     72     FILE_HINT="To get the ordering right run: nameserver-shuffle"
    7273   ;;
    7374   'pf.hybrid.conf.local')
     
    8586usage() {
    8687        (
    87         echo "Usage: $0 [-bn] [-c <config>] [-m <all|startup|testing|running>]"
     88        echo "Usage: $0 [-bpn] [-c <config>] [-m <all|startup|testing|running>]"
    8889        echo "  -b          = batch mode, no user input"
    8990        echo "  -c <config> = default configuration to fetch"
    90         echo "  -d          = do not run the POST_CMD commands"
     91        echo "  -d          = do not run the POST_CMD commands [default]"
     92        echo "  -p          = run the POST_CMD commands to activate the services right-away"
    9193        echo "  -n          = do not mount config partition"
    9294        echo "  -m all      = copy config files to running & config partition [default]"
     
    106108OPT_HACK=0              # Hack for people without configuration managment and testing
    107109OPT_BATCH=0
    108 OPT_POSTCMD=true
     110OPT_POSTCMD=false
    109111
    110112parse_options() {
    111   while getopts "bc:nm:d" OPT; do
     113  while getopts "bc:nm:dp" OPT; do
    112114        case "$OPT" in
    113115        b) OPT_BATCH=1;;
     
    124126           esac;;
    125127        h) usage;;
     128        p) OPT_POSTCMD=true;;
    126129        \?) usage;;
    127130        esac
     
    143146    echo "# WARN: Copy running configuration to startup configuration"
    144147    echo "# WARN: Please do mind to document/mention this changes somewhere"
     148  fi
     149
     150  if /bin/df / | grep -q "^/dev/md[0-9]"; then
     151    OPT_MOUNT=0
     152    echo "# WARN: Mount operations disabled as we are running in a md(4) image"
    145153  fi
    146154
     
    264272      if [ $? -eq 0 ]; then
    265273        echo "# INFO: '${FILE}' changed" 
    266         if $OPT_POSTCMD && [ -n "${POST_CMD}" ]; then
    267           echo "## Running post_cmd: $POST_CMD"
    268           $POST_CMD
     274        if [ -n "${POST_CMD}" ]; then
     275          if $OPT_POSTCMD; then
     276            echo "## Running post_cmd: $POST_CMD"
     277            $POST_CMD
     278          else
     279            echo "## To activate run the post_cmd: $POST_CMD"
     280          fi
    269281        fi
    270282        if [ -n "${FILE_HINT}" ]; then
    271           echo "# INFO: For instant activate: ${FILE_HINT}"
     283          echo "# INFO: ${FILE_HINT}"
    272284          echo ""
    273285        fi
Note: See TracChangeset for help on using the changeset viewer.