| BootNet for RISC OS Select

|  2002 RISCOS Ltd.

| This file is used to start up Econet, NetI and NetFS, according to the
| configuration. If the required component is enabled, it will be loaded,
| if it is disabled, it will be killed.

| Check modules are present and correct
Set Alias$FindModule IfThere System:Modules.Network.%%2 Then RMLoad System:Modules.Network.%%2
Set Alias$LoadModule RMEnsure %%0 %%1 FindModule %%0 %%1 %%2|MRMEnsure %%0 %%1 If "|<Bootnet$Missing>" = "" Then Set Bootnet$Missing %%2 %%1 Else Set Bootnet$Missing |<Bootnet$Missing>, %%2 %%1|MRMEnsure %%0 %%1 X RMKill %%0
Set Alias$CheckModule If "%%0" = "True" Then LoadModule %%1 %%2 %%3 Else X RMkill %%1
Set Alias$KillModule If "%%0" = "True" Then X RMKill %%1

| Read in the configuration (if present)
IfThere Choices:Internet.BootNet Then Obey Choices:Internet.BootNet

| Econet
Set Bootnet$Missing ""
If "<Bootnet$Econet>" = "True" Then Run Inet:Utils.CheckEco
CheckModule <Bootnet$Econet> Econet         5.74 Econet
CheckModule <Bootnet$Econet> EconetMessages 5.74 EconetMsgs
If "<Bootnet$Missing>" <> "" Then Do BootError Econet cannot start due to missing modules: <Bootnet$Missing>
If "<Bootnet$Missing>" <> "" Then Set BootNet$Econet "False"

| Net
Set Bootnet$Missing ""
CheckModule <Bootnet$NetI> NetI 6.26 NetI
If "<Bootnet$Missing>" <> "" Then Do BootError NetI cannot start due to missing modules: <Bootnet$Missing>
If "<Bootnet$Missing>" <> "" Then Set BootNet$NetI "False"

| If both Econet and NetI are in use, RMReinit NetI to ensure it has the SWIs
If "<Bootnet$Econet>"= "True" AND "<Bootnet$NetI>" = "True" Then RMReinit NetI

| We can only use NetFS with Econet or NetI
Set Bootnet$AllowNetFS "True"
If "<Bootnet$Econet>" <> "True" AND "<Bootnet$NetI>" <> "True" Then Set BootNet$AllowNetFS "False"
If "<Bootnet$NetFS>" = "True" AND "<Bootnet$AllowNetFS>" <> "True" Then BootError Either Econet or NetI must be configured in order to use NetFS.
If "<Bootnet$NetFS>" = "True" AND "<Bootnet$AllowNetFS>" <> "True" Then Set BootNet$NetFS "False"
Unset BootNet$AllowNetFS

| NetFS and NetPrint
Set Bootnet$Missing ""
CheckModule <Bootnet$NetFS> NetFS    5.90 NetFS
CheckModule <Bootnet$NetFS> NetFiler 0.79 NetFiler
CheckModule <Bootnet$NetFS> NetPrint 5.53 NetPrint
If "<Bootnet$Missing>" <> "" Then Do BootError NetFS/NetPrint cannot start due to missing modules: <Bootnet$Missing>
If "<Bootnet$Missing>" <> "" Then Set BootNet$NetFS "False"
If "<Bootnet$Missing>" <> "" Then X RMKill NetFS
If "<Bootnet$Missing>" <> "" Then X RMKill NetFiler
If "<Bootnet$Missing>" <> "" Then X RMKill NetPrint

| Unset the variables we used
Unset Alias$FindModule
Unset Alias$CheckModule
Unset Alias$LoadModule
Unset Alias$KillModule
Unset Bootnet$Missing

| If we are using NetI, then load the map
If "<BootNet$NetI>" = "True" Then Obey <ChoicesHardware$Dir>.Internet.AUNMap
