startup.go 3.0 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. FileSystemInit() //Start FileSystem
  41. DesktopInit() //Start Desktop
  42. HardwarePowerInit() //Start host power manager
  43. //8 Start AGI and Subservice modules (Must start after module)
  44. AGIInit() //ArOZ Javascript Gateway Interface, must start after fs
  45. SubserviceInit() //Subservice Handler
  46. //9. Initiate System Settings Handlers
  47. SystemSettingInit() //Start System Setting Core
  48. DiskQuotaInit() //Disk Quota Management
  49. DiskServiceInit() //Start Disk Services
  50. DeviceServiceInit() //Client Device Management
  51. SystemInfoInit() //System Information UI
  52. SystemIDInit() //System UUID Manager
  53. AuthSettingsInit() //Authentication Settings Handler, must be start after user Handler
  54. AdvanceSettingInit() //System Advance Settings
  55. StartupFlagsInit() //System BootFlag settibg
  56. RegisterStorageSettings() //Storage Settings
  57. //10. Startup network services and schedule services
  58. NetworkServiceInit() //Initalize network serves (ssdp / mdns etc)
  59. WiFiInit() //Inialize WiFi management module
  60. ArsmInit() //Inialize ArOZ Remote Support & Management Framework
  61. //11. Other stuffs
  62. //system_time_init()
  63. util_init()
  64. system_resetpw_init()
  65. mediaServer_init()
  66. //Start High Level Services that requires full arozos architectures
  67. FTPServerInit() //Start FTP Server Endpoints
  68. WebDAVInit() //Start WebDAV Endpoint
  69. ClusterInit() //Start Cluster Services
  70. IoTHubInit() //Inialize ArozOS IoT Hub module
  71. ModuleInstallerInit() //Start Module Installer
  72. NightlyInit() //Start Nightly Tasks
  73. //Finally
  74. moduleHandler.ModuleSortList() //Sort the system module list
  75. }