Changeset 994


Ignore:
Timestamp:
Dec 17, 2016, 11:35:37 AM (9 years ago)
Author:
Herwig Bauernfeind
Message:

b4smb: Automatically detect fixed and DHCP controlled interfaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/scripts/smb_init/b4smb.cmd

    r993 r994  
    1111 */
    1212setupCMD = SysBootDrive()'\MPTN\BIN\Setup.CMD'
    13 LANx     = 'lan0' /* Check this interface for a fixed IP */
    1413ArchLogs =  1     /* Move previous logfiles to archive (by Yuri Dario) */
    1514DelLogs  =  0     /* Remove previous logfiles only */
     
    2726'@echo off'
    2827
    29 do while lines(SetupCMD) > 0 /* Check LANx interface for fixed IP address */
     28do while lines(SetupCMD) > 0 /* Check interfaces for fixed IP address */
    3029    SL = translate(linein(SetupCMD))
    31     if word(SL,1) = "IFCONFIG" & word(SL,2) = translate(LANx) then do
     30    if word(SL,1) = "IFCONFIG" & word(SL,2) <> "LO" then do
     31        IF = word(SL,2)
    3232        IP = word(SL,3)
    33         address cmd '@ifconfig 'LANx' | rxqueue'
    34         if queued() = 2 then do
     33        address cmd '@ifconfig 'IF' | rxqueue'
     34        if queued() > 1 then do
    3535            parse pull .
    36             parse pull . IPIFC .
    37             if IPIFC = IP then DHCPWait = 0
     36            parse pull ipline ipc rest
     37            if ipc = IP then do
     38                DHCPWait = 0
     39                say IF': Fixed IP 'IP', valid.'
     40            end
    3841        end
     42        else say IF': Fixed IP 'IP', invalid.'
    3943    end
     44    if word(SL,1) = "DHCPSTRT" then do
     45        say "DHCP for "word(SL,3)' not recommended for Samba, waiting...'
     46        DHCPWait = 1
     47    end
    4048end
    4149ok = stream(SetupCMD,'c','close')
     50
     51do while queued() > 0
     52    parse pull .
     53end
    4254
    4355if ArchLogs = 1 then do /* Creative logfile archive */
Note: See TracChangeset for help on using the changeset viewer.