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