startup.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package main
  2. /*
  3. System Startup Script for ArOZ Online System
  4. author: tobychui
  5. */
  6. import (
  7. "fmt"
  8. db "imuslab.com/arozos/mod/database"
  9. )
  10. func RunStartup() {
  11. //1. Initiate the main system database
  12. if !fileExists("system/") {
  13. fmt.Println("▒▒ ERROR: SYSTEM FOLDER NOT FOUND ▒▒")
  14. panic("This error occurs because the system folder is missing. Please follow the installation guide and don't just download a binary and run it.")
  15. }
  16. if !fileExists("web/") {
  17. fmt.Println("▒▒ ERROR: WEB FOLDER NOT FOUND ▒▒")
  18. panic("This error occurs because the web folder is missing. Please follow the installation guide and don't just download a binary and run it.")
  19. }
  20. dbconn, err := db.NewDatabase("system/ao.db", false)
  21. if err != nil {
  22. panic(err)
  23. }
  24. sysdb = dbconn
  25. //2. Initiate the auth Agent
  26. AuthInit() //See auth.go
  27. //3. Start Permission Management Module
  28. permissionNewHandler() //See permission.go
  29. //4. Mount and create the storage system base
  30. StorageInit() //See storage.go
  31. //5. Startup user and permission sytem
  32. UserSystemInit() //See user.go
  33. permissionInit() //Register permission interface after user
  34. RegisterSystemInit() //See register.go
  35. GroupStoragePoolInit() //Register permission groups's storage pool, require permissionInit()
  36. //6. Start Modules and Package Manager
  37. ModuleServiceInit() //Module Handler
  38. PackagManagerInit() //Start APT service agent
  39. //7. Kickstart the File System and Desktop
  40. SchedulerInit() //Start System Scheudler
  41. FileSystemInit() //Start FileSystem
  42. DesktopInit() //Start Desktop
  43. HardwarePowerInit() //Start host power manager
  44. //8 Start AGI and Subservice modules (Must start after module)
  45. AGIInit() //ArOZ Javascript Gateway Interface, must start after fs
  46. SubserviceInit() //Subservice Handler
  47. //9. Initiate System Settings Handlers
  48. SystemSettingInit() //Start System Setting Core
  49. DiskQuotaInit() //Disk Quota Management
  50. DiskServiceInit() //Start Disk Services
  51. DeviceServiceInit() //Client Device Management
  52. SystemInfoInit() //System Information UI
  53. SystemIDInit() //System UUID Manager
  54. AuthSettingsInit() //Authentication Settings Handler, must be start after user Handler
  55. AdvanceSettingInit() //System Advance Settings
  56. StartupFlagsInit() //System BootFlag settibg
  57. RegisterStorageSettings() //Storage Settings
  58. //10. Startup network services and schedule services
  59. NetworkServiceInit() //Initalize network serves (ssdp / mdns etc)
  60. WiFiInit() //Inialize WiFi management module
  61. //ARSM Moved to scheduler, remote support is rewrite pending
  62. //ArsmInit() //Inialize ArOZ Remote Support & Management Framework
  63. //11. Other stuffs
  64. util_init()
  65. system_resetpw_init()
  66. mediaServer_init()
  67. security_init()
  68. //Start High Level Services that requires full arozos architectures
  69. FTPServerInit() //Start FTP Server Endpoints
  70. WebDAVInit() //Start WebDAV Endpoint
  71. ClusterInit() //Start Cluster Services
  72. IoTHubInit() //Inialize ArozOS IoT Hub module
  73. ModuleInstallerInit() //Start Module Installer
  74. //Finally
  75. moduleHandler.ModuleSortList() //Sort the system module list
  76. }