version: "11.0"
description: "Script upload, install, manifest, and rollback behavior."
directives:
  - id: E-1110.12
    dos:
      - Sort script paths before upload.
      - Check live scripts against config.boot.deployment.tsv.
      - Compare live script paths with local bundle paths.
      - Report bundle paths that match live files.
      - Report router-only paths that remain unchanged.
      - Tell the operator to run `vyops backup` to save a router copy.
      - Stage scripts and backups under unique paths in the vyos home folder.
      - Create a remote install manifest before script changes.
      - Record prior file and directory state before an install.
      - Record if each destination file or directory existed before release.
      - Record previous mode, hash, and file type for each existing file.
      - Save each existing file before the CLI replaces it.
      - Set new unmanaged files to root ownership.
      - Preserve the owner of a previously managed file.
      - Set local script mode from the source mode and script type.
      - Set mode 0755 for shebang files, executable script types, and post-commit script paths.
      - Preserve the source mode for other files.
      - Require each uploaded path to resolve to its exact remote path.
      - Require executable scripts to pass a remote execute check.
      - Require text scripts to contain no carriage-return bytes on the router.
      - Create parent folders before VyOps uploads nested scripts.
      - Validate each staged file before one atomic move to its final path.
      - Record installed file mode, hash, and type in the remote manifest.
      - Read file and directory records from config.boot.deployment.tsv.
      - Use only file records as managed script paths.
      - Restore prior managed and unmanaged files when an install fails.
      - Keep the remote backup folder when script rollback fails.
      - Keep the remote script backup when script cleanup fails.
      - Remove files and empty folders that did not exist before an install when it fails.
      - Keep installed scripts after config confirmation.
      - Restore prior scripts if the release does not confirm.
      - Remove temporary script and backup folders after finalization.
    donts:
      - Do not follow script links during discovery or install.
      - Do not overwrite a remote symbolic link.
      - Do not install a file that fails path, mode, or newline checks.
      - Do not remove an unmanaged script during rollback.
      - Do not remove the script backup when rollback fails.
      - Do not run script cleanup after the CLI completes script setup.
      - Do not run synchronized scripts when --no-hooks is set.
