name: "Kcrypt"
stages:
  after-upgrade:
    - name: "Update plugins"
      if: "[ $(kairos-agent state get oem.found) == 'true' ]"
      commands:
        - |
            STATEDIR=/tmp/mnt/OEM
            OEM=$(kairos-agent state get oem.name)
            mkdir -p $STATEDIR || true
            mount ${OEM} $STATEDIR
            if [ -d "$STATEDIR/system/discovery" ]; then
              cp -rfv /system/discovery/* $STATEDIR/system/discovery
            fi
            umount $STATEDIR
