# List of manual pre-installation steps for Tier1 image creation

* Use local Apple Silicon Mac (preferred), or Opennebula Tart Host
  - If the latter, set host as DISABLED in Opennebula and open KVM connection to the host

* Download IPSW restore image
  - Find IPSW download URL from https://appledb.dev/device/identifier/VirtualMac2,1
  - Download IPSW file from Apple's CDN

* Create virtual machine from IPSW file and start it
  - /Users/oneadmin/tart.app/Contents/MacOS/tart create --from-ipsw=<downloaded ipsw file> <macos-version> --disk-size 200
  - /Users/oneadmin/tart.app/Contents/MacOS/tart run <macos-version>

* Do following things in the virtual machine
  - Install updates
  - Enable autologin for qt user
  - Enable remote login and remote management
  - Add qt user to sudoers
    - Edit sudoers file: sudo visudo
    - Add a line for qt user: qt ALL=(ALL) NOPASSWD: ALL
  - Download and run coin setup binaries from http://coin/coin/setup
    - DO NOT use sudo when running coin-setup
    - Check /Users/qt folder for the bootstrap agent binary file
  - Add terminal and ssh keygen wrapper to full disk access
  - Enable VNC remote access
  - Shutdown the virtual machine

* Enable backtraces (https://bugreports.qt.io/browse/QTQAINFRA-5933)
  - Start VM in recovery mode
    - /Users/oneadmin/tart.app/Contents/MacOS/tart run --recovery <macos-version>
  - Start terminal and run command: csrutil enable --without fs
  - Shutdown the virtual machine

* Push virtual machine to Tart registry with tags latest and CI
  - /Users/oneadmin/tart.app/Contents/MacOS/tart push --insecure "<macos-version>" "tart-registry.ci.qt.io:5000/<macos-version>:latest" "tart-registry.ci.qt.io:5000/<macos-version>:CI"

* Add Tier1 image to Opennebula by logging into Opennebula container
  - Create a dummy file to correct datastore in NFS
  - Register virtual machine to Opennebula by running register_images.sh

* Re-enable Tart host in Opennebula if not using local Apple Silicon Mac
