startup.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. //9. Initiate System Settings Handlers
  50. SystemSettingInit() //Start System Setting Core
  51. DiskQuotaInit() //Disk Quota Management
  52. DiskServiceInit() //Start Disk Services
  53. DeviceServiceInit() //Client Device Management
  54. SystemInfoInit() //System Information UI
  55. SystemIDInit() //System UUID Manager
  56. AuthSettingsInit() //Authentication Settings Handler, must be start after user Handler
  57. AdvanceSettingInit() //System Advance Settings
  58. StartupFlagsInit() //System BootFlag settibg
  59. HardwarePowerInit() //Start host power manager
  60. RegisterStorageSettings() //Storage Settings
  61. //10. Startup network services and schedule services
  62. NetworkServiceInit() //Initalize network serves (ssdp / mdns etc)
  63. WiFiInit() //Inialize WiFi management module
  64. //ARSM Moved to scheduler, remote support is rewrite pending
  65. //ArsmInit() //Inialize ArOZ Remote Support & Management Framework
  66. //11. Other stuffs
  67. util_init()
  68. system_resetpw_init()
  69. mediaServer_init()
  70. security_init()
  71. backup_init()
  72. //Start High Level Services that requires full arozos architectures
  73. FTPServerInit() //Start FTP Server Endpoints
  74. WebDAVInit() //Start WebDAV Endpoint
  75. ClusterInit() //Start Cluster Services
  76. IoTHubInit() //Inialize ArozOS IoT Hub module
  77. ModuleInstallerInit() //Start Module Installer
  78. //Finally
  79. moduleHandler.ModuleSortList() //Sort the system module list
  80. }