Changeset 23118


Ignore:
Timestamp:
2010-09-24T17:57:53+02:00 (6 years ago)
Author:
acoul
Message:

package/dropbear: simplify & reduce init script size (closes #7985)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/dropbear/files/dropbear.init

    r22393 r23118  
    2727        PIDCOUNT="$(( ${PIDCOUNT} + 1))" 
    2828 
    29         # prepare parameters 
     29        # prepare parameters (initialise with pid file) 
     30        local args="-P /var/run/${NAME}.${PIDCOUNT}.pid" 
     31        local val 
    3032        # A) password authentication 
    31         local nopasswd 
    32         local passauth 
    33         config_get_bool passauth "${section}" PasswordAuth 1 
    34         [ "${passauth}" -eq 0 ] && nopasswd=1 
     33        config_get_bool val "${section}" PasswordAuth 1 
     34        [ "${val}" -eq 0 ] && append args "-s" 
    3535        # B) listen interface and port 
    36         local port 
    3736        local interface 
    3837        local address 
    39         config_get port "${section}" Port 
    4038        config_get interface "${section}" Interface 
    4139        config_get address "${interface}" ipaddr 
    42         port="${address:+${address}:}${port}" 
     40        config_get val "${section}" Port 
     41        val="${address:+${address}:}${val}" 
     42        [ -n "${val}" ] && append args "-p ${val}" 
    4343        # C) banner file 
    44         local bannerfile 
    45         config_get bannerfile "${section}" BannerFile 
    46         [ -f "$bannerfile" ] || bannerfile='' 
     44        config_get val "${section}" BannerFile 
     45        [ -f "${val}" ] && append args "-b ${val}" 
    4746        # D) gatewayports 
    48         local gatewayports 
    49         config_get_bool gatewayports "${section}" GatewayPorts 0 
    50         [ "${gatewayports}" -eq 1 ] || gatewayports='' 
     47        config_get_bool val "${section}" GatewayPorts 0 
     48        [ "${val}" -eq 1 ] && append args "-a" 
    5149        # E) root password authentication 
    52         local norootpasswd 
    53         local rootpassauth 
    54         config_get_bool rootpassauth "${section}" RootPasswordAuth 1 
    55         [ "${rootpassauth}" -eq 0 ] && norootpasswd=1 
    56         local rootloginallowed 
    57         local norootlogin 
    58         config_get_bool rootloginallowed "${section}" RootLogin 1 
    59         [ "${rootloginallowed}" -eq 0 ] && norootlogin=1 
    60         # concatenate parameters 
    61         local args 
    62         args="${nopasswd:+-s }${norootpasswd:+-g }${norootlogin:+-w }${port:+-p ${port} }${bannerfile:+-b $bannerfile }${gatewayports:+-a }-P /var/run/${NAME}.${PIDCOUNT}.pid" 
     50        config_get_bool val "${section}" RootPasswordAuth 1 
     51        [ "${val}" -eq 0 ] && append args "-g" 
     52        # F) root login 
     53        config_get_bool val "${section}" RootLogin 1 
     54        [ "${val}" -eq 0 ] && append args "-w" 
    6355 
    6456        # execute program and return its exit code 
Note: See TracChangeset for help on using the changeset viewer.