startup.go 3.2 KB

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