Changeset 275


Ignore:
Timestamp:
Jun 17, 2009, 4:18:03 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Updated error checking in SambaInit.vrs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/guitools-1.0/shared/sambainit.vrs

    r269 r275  
    1111    /* Error status and file variables */
    1212    ErrorFile  = Tempdir'smbutil.error'
    13     ErrorState = 0 /* _ErrorNotFound() changes this variable */
     13    ErrorState = 0 /* _ErrorBinaryNotFound() changes this variable */
     14    DataErrorState = 0 /* _ErrorDataFileNotFound() changes this variable */
    1415
    1516    /* Evaluate environment */
     
    8384    end
    8485
    85     if samba.!smbd = "" then call _ErrorNotFound " could not find smbd.exe!"
     86    if samba.!smbd = "" then call _ErrorBinaryNotFound " could not find smbd.exe!"
    8687
    8788    samba.!bin = VRParseFileName(samba.!smbd,'DP')
     
    9293    if \VRFileExists(samba.!smbcmd) then do
    9394        samba.!smbcmd = samba.!bin'\smb.cmd'
    94         if \VRFileExists(samba.!smbcmd) then call _ErrorNotFound " could not find smb.cmd!"
     95        if \VRFileExists(samba.!smbcmd) then call _ErrorBinaryNotFound " could not find smb.cmd!"
    9596    end
    9697    IF options.!debug == 1 THEN say '  smb.cmd        = "'samba.!smbcmd'"'
     
    9899    /* smbpasswd.exe */
    99100    samba.!smbpasswdexe = samba.!bin'\smbpasswd.exe'
    100     if \VRFileExists(samba.!smbpasswdexe) then call _ErrorNotFound " could not find smbpasswd.exe!"
     101    if \VRFileExists(samba.!smbpasswdexe) then call _ErrorBinaryNotFound " could not find smbpasswd.exe!"
    101102    IF options.!debug == 1 THEN say '  smbpasswd.exe  = "'samba.!smbpasswdexe'"'
    102103
    103104    /* pdbedit.exe */
    104105    samba.!pdbeditexe = samba.!bin'\pdbedit.exe'
    105     if \VRFileExists(samba.!pdbeditexe) then call _ErrorNotFound " could not find pdbedit.exe!"
     106    if \VRFileExists(samba.!pdbeditexe) then call _ErrorBinaryNotFound " could not find pdbedit.exe!"
    106107    IF options.!debug == 1 THEN say '  pdbedit.exe    = "'samba.!pdbeditexe'"'
    107108
    108109    /* net.exe */
    109110    samba.!netexe = samba.!bin'\net.exe'
    110     if \VRFileExists(samba.!netexe) then call _ErrorNotFound " could not find net.exe!"
     111    if \VRFileExists(samba.!netexe) then call _ErrorBinaryNotFound " could not find net.exe!"
    111112    IF options.!debug == 1 THEN say '  net.exe        = "'samba.!netexe'"'
    112113
    113114    /* testparm.exe */
    114115    samba.!testparmexe = samba.!bin'\testparm.exe'
    115     if \VRFileExists(samba.!testparmexe) then call _ErrorNotFound " could not find testparm.exe!"
     116    if \VRFileExists(samba.!testparmexe) then call _ErrorBinaryNotFound " could not find testparm.exe!"
    116117    IF options.!debug == 1 THEN say '  testparm.exe   = "'samba.!testparmexe'"'
    117118
    118119    /* smbtree.exe */
    119120    samba.!smbtreeexe = samba.!bin'\smbtree.exe'
    120     if \VRFileExists(samba.!smbtreeexe) then call _ErrorNotFound " could not find smbtree.exe!"
     121    if \VRFileExists(samba.!smbtreeexe) then call _ErrorBinaryNotFound " could not find smbtree.exe!"
    121122    IF options.!debug == 1 THEN say '  smbtree.exe    = "'samba.!smbtreeexe'"'
    122123
    123124    /* smbstatus.exe */
    124125    samba.!smbstatusexe = samba.!bin'\smbstatus.exe'
    125     if \VRFileExists(samba.!smbstatusexe) then call _ErrorNotFound " could not find smbstatus.exe!"
     126    if \VRFileExists(samba.!smbstatusexe) then call _ErrorBinaryNotFound " could not find smbstatus.exe!"
    126127    IF options.!debug == 1 THEN say '  smbstatus.exe  = "'samba.!smbstatusexe'"'
    127128
    128129    /* smbcontrol.exe */
    129130    samba.!smbcontrolexe = samba.!bin'\smbcontrol.exe'
    130     if \VRFileExists(samba.!smbcontrolexe) then call _ErrorNotFound " could not find smbcontrol.exe!"
     131    if \VRFileExists(samba.!smbcontrolexe) then call _ErrorBinaryNotFound " could not find smbcontrol.exe!"
    131132    IF options.!debug == 1 THEN say '  smbcontrol.exe = "'samba.!smbcontrolexe'"'
    132133
    133134    /* smbclient.exe */
    134135    samba.!smbclientexe = samba.!bin'\smbclient.exe'
    135     if \VRFileExists(samba.!smbclientexe) then call _ErrorNotFound " could not find smbclient.exe!"
     136    if \VRFileExists(samba.!smbclientexe) then call _ErrorBinaryNotFound " could not find smbclient.exe!"
    136137    IF options.!debug == 1 THEN say '  smbclient.exe  = "'samba.!smbclientexe'"'
    137138
     
    158159    end
    159160
    160     if samba.!pwd_mkdb = "" then call _ErrorNotFound " could not find pwd_mkdb.exe!"
     161    if samba.!pwd_mkdb = "" then call _ErrorBinaryNotFound " could not find pwd_mkdb.exe!"
    161162    IF options.!debug == 1 THEN say '  pwd_mkdb.exe   = "'samba.!pwd_mkdb'"'
    162163
     
    175176    end
    176177
    177     if samba.!log = "" then call _ErrorNotFound " could not find logfiles!"
     178    if samba.!log = "" then call _ErrorDataFileNotFound " could not find logfiles!"
    178179    IF options.!debug == 1 THEN say '  Samba logfiles = "'samba.!log'"'
    179180
    180181    /* smb.conf */
    181182    samba.!smbconf = ETC'\samba\smb.conf'
    182     ok = stream(samba.!smbconf,'c','query exists')
    183     if ok = "" then do
    184         call _ErrorNotFound samba.!smbconf' is not present.'
    185     end
     183    if \VRFileExists(samba.!smbconf) then call _ErrorDataFileNotFound samba.!smbconf' is not present.'
    186184    IF options.!debug == 1 THEN say '  Samba smb.conf = "'samba.!smbconf'"'
    187185
     
    189187    /* the password files - we'll create them if they don't exist */
    190188    samba.!masterpasswd = unixetc'\master.passwd'
     189    if \VRFileExists(samba.!masterpasswd) then call _ErrorDataFileNotFound " could not find master.passwd!"
    191190    IF options.!debug == 1 THEN say '  master.passwd  = "'samba.!masterpasswd'"'
    192     if \VRFileExists(samba.!masterpasswd) then call _ErrorNotFound " could not find master.passwd!"
    193191
    194192    samba.!pwddb = unixetc'\pwd.db'
     193    if \VRFileExists(samba.!pwddb) then call _ErrorDataFileNotFound " could not find pwd.db!"
    195194    IF options.!debug == 1 THEN say '  pwd.db         = "'samba.!pwddb'"'
    196     if \VRFileExists(samba.!pwddb) then call _ErrorNotFound " could not find pwd.db!"
    197195
    198196    samba.!spwddb = unixetc'\spwd.db'
     197    if \VRFileExists(samba.!spwddb) then call _ErrorDataFileNotFound " could not find spwd.db!"
    199198    IF options.!debug == 1 THEN say '  spwd.db        = "'samba.!spwddb'"'
    200     if \VRFileExists(samba.!spwddb) then call _ErrorNotFound " could not find spwd.db!"
    201199
    202200    samba.!group = unixetc'\group'
     201    if \VRFileExists(samba.!group) then call _ErrorDataFileNotFound " could not find "samba.!group"!"
    203202    IF options.!debug == 1 THEN say '  group          = "'samba.!group'"'
    204     if \VRFileExists(samba.!group) then call _ErrorNotFound " could not find "samba.!group"!"
    205203
    206204    samba.!printcap = unixetc'\printcap'
     205    if \VRFileExists(samba.!spwddb) then call _ErrorDataFileNotFound " could not find printcap!"
    207206    IF options.!debug == 1 THEN say '  printcap       = "'samba.!printcap'"'
    208     if \VRFileExists(samba.!spwddb) then call _ErrorNotFound " could not find printcap!"
    209207
    210208    /* Create this directory tree if it does not exist */
     
    239237    /* Do some very basic housekeeping when leaving */
    240238    ok = stream(samba.!msg,'c','close')
    241     ok = stream(samba.!err,'c','close')
     239    ok = stream(samba.!error,'c','close')
    242240    ok = SysFileDelete(samba.!msg)
    243     ok = SysFileDelete(samba.!err)
     241    ok = SysFileDelete(samba.!error)
    244242return
    245243
    246244/*:VRX */
    247 _ErrorNotFound:
     245_ErrorBinaryNotFound:
    248246    /* Set error status variable and show a short message - incomplete! */
    249247    msg = arg(1)
    250248    say "ERROR: "msg
     249    id = VRMessage( VRWindow(), msg, "Samba Installation", "E" )
    251250    ErrorState = (1|ErrorState)
     251return
     252
     253/*:VRX */
     254_ErrorDataFileNotFound:
     255    /* Set error status variable and show a short message - incomplete! */
     256    msg = arg(1)
     257    say "ERROR: "msg
     258    DataErrorState = (1|DataErrorState)
    252259return
    253260
Note: See TracChangeset for help on using the changeset viewer.