fwupd: enable fwupd dummy plugin and remote

This is used by tast to test fwupd remote repository implementation
using the dummy plugin.

BUG=b:188440695
TEST=./build_image test

Cq-Depend: chromium:2910260
Change-Id: I12cd30f3a1671c53917002c5218773ee34ac8f4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2928967
Tested-by: Daniel Campello <campello@chromium.org>
Auto-Submit: Daniel Campello <campello@chromium.org>
Commit-Queue: Daniel Campello <campello@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/mod_for_test_scripts/340enableFwupdDummy b/mod_for_test_scripts/340enableFwupdDummy
new file mode 100755
index 0000000..020e453
--- /dev/null
+++ b/mod_for_test_scripts/340enableFwupdDummy
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+if [[ ! -f ${ROOT_FS_DIR}/etc/fwupd/daemon.conf ]]; then
+  exit 0
+fi
+
+echo "Enabling dummy fwupd remote for tests."
+
+sed -e '/^DisabledPlugins=/s/^/#/' -i "${ROOT_FS_DIR}/etc/fwupd/daemon.conf"
+
+cat > "${ROOT_FS_DIR}/usr/share/fwupd/remotes.d/vendor/fwupd-tests.xml" <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Extracted from https://github.com/fwupd/fwupd/blob/HEAD/data/installed-tests/fwupd-tests.xml -->
+<components version="0.9" origin="lvfs">
+  <component type="firmware">
+    <id>fakedevice.firmware</id>
+    <name>FakeDevice Firmware</name>
+    <summary>Firmware for the ACME Corp Integrated Webcam</summary>
+    <developer_name>ACME Corp</developer_name>
+    <project_license>GPL-2.0+</project_license>
+    <description><p>Updating the firmware on your webcam device improves performance and adds new features.</p></description>
+    <url type="homepage">http://www.acme.com/</url>
+    <releases>
+      <release version="1.2.4" timestamp="1497499200" urgency="medium">
+        <size type="installed">17</size>
+        <size type="download">1163</size>
+        <location>https://fwupd.org/downloads/fakedevice124.cab</location>
+        <checksum filename="fakedevice124.cab" target="container" type="sha1">fc0aabcf98bf3546c91270f2941f0acd0395dd79</checksum>
+        <checksum filename="fakedevice124.bin" target="content" type="sha1">2b8546ba805ad10bf8a2e5ad539d53f303812ba5</checksum>
+        <description><p>Fixes another bug with the flux capacitor to prevent time going backwards.</p></description>
+      </release>
+    </releases>
+    <provides>
+      <firmware type="flashed">b585990a-003e-5270-89d5-3705a17f9a43</firmware>
+    </provides>
+  </component>
+</components>
+EOF
+
+cat > "${ROOT_FS_DIR}/etc/fwupd/remotes.d/fwupd-tests.conf" <<EOF
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+[fwupd Remote]
+Enabled=true
+Title=fwupd test
+Type=local
+Keyring=none
+MetadataURI=file:///usr/share/fwupd/remotes.d/vendor/fwupd-tests.xml
+FirmwareBaseURI=https://storage.googleapis.com/chromeos-localmirror/lvfs/test/
+ApprovalRequired=false
+EOF