startup.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. OAuthInit() //Oauth system init
  36. GroupStoragePoolInit() //Register permission groups's storage pool, require permissionInit()
  37. BridgeStoragePoolInit() //Register the bridged storage pool based on mounted storage pools
  38. //6. Start Modules and Package Manager
  39. ModuleServiceInit() //Module Handler
  40. PackagManagerInit() //Start APT service agent
  41. //7. Kickstart the File System and Desktop
  42. SchedulerInit() //Start System Scheudler
  43. FileSystemInit() //Start FileSystem
  44. DesktopInit() //Start Desktop
  45. //StorageDaemonInit() //Start File System handler daemon (for backup and other sync process)
  46. //8 Start AGI and Subservice modules (Must start after module)
  47. AGIInit() //ArOZ Javascript Gateway Interface, must start after fs
  48. SubserviceInit() //Subservice Handler
  49. ReverseProxtInit() //Start Dynamic Reverse Proxy
  50. //9. Initiate System Settings Handlers
  51. SystemSettingInit() //Start System Setting Core
  52. DiskQuotaInit() //Disk Quota Management
  53. DiskServiceInit() //Start Disk Services
  54. DeviceServiceInit() //Client Device Management
  55. SystemInfoInit() //System Information UI
  56. SystemIDInit() //System UUID Manager
  57. AuthSettingsInit() //Authentication Settings Handler, must be start after user Handler
  58. AdvanceSettingInit() //System Advance Settings
  59. StartupFlagsInit() //System BootFlag settibg
  60. HardwarePowerInit() //Start host power manager
  61. RegisterStorageSettings() //Storage Settings
  62. //10. Startup network services and schedule services
  63. NetworkServiceInit() //Initalize network serves (ssdp / mdns etc)
  64. WiFiInit() //Inialize WiFi management module
  65. //ARSM Moved to scheduler, remote support is rewrite pending
  66. //ArsmInit() //Inialize ArOZ Remote Support & Management Framework
  67. //11. Other stuffs
  68. util_init()
  69. system_resetpw_init()
  70. mediaServer_init()
  71. security_init()
  72. backup_init()
  73. //Start High Level Services that requires full arozos architectures
  74. FTPServerInit() //Start FTP Server Endpoints
  75. WebDAVInit() //Start WebDAV Endpoint
  76. ClusterInit() //Start Cluster Services
  77. IoTHubInit() //Inialize ArozOS IoT Hub module
  78. ModuleInstallerInit() //Start Module Installer
  79. //Finally
  80. moduleHandler.ModuleSortList() //Sort the system module list
  81. }