-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: introduce image test-mode within the test environment
- The test mode, introduced at the config/build phase (commit 241f3f2), causes the device to start in test-mode when used in GNS3 (or other environments). This has unintentionally become the default configuration for the image, which is not desirable and is only acceptable for the Infix test system. With this update, the original configuration is preserved, and the test mode is applied only within the test environment. - Align the 'dual' topology to use the same template as 'quad' Fixes #603
- Loading branch information
Showing
6 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
# This script injects a "test-mode" file into a copy of the main disk image. | ||
# It begins by parsing the partition table of the disk image to identify the | ||
# 'aux' partition, which is then extracted. An empty 'test-mode' file is | ||
# injected into the extracted partition, and the modified partition is written | ||
# back to the output image. The output image can subsequently be used as a | ||
# backing image for Copy-on-Write (QCOW) images utilized by Qeneth. | ||
|
||
set -e | ||
|
||
while getopts "b:o:" opt; do | ||
case $opt in | ||
b) base_img="$OPTARG" ;; # Base image (Original image) | ||
o) output_img="$OPTARG" ;; # Output image (Backing image for QCoW images) | ||
*) echo "Usage: $0 -b <BASE-IMAGE> -o <OUTPUT-IMAGE>" ; exit 1 ;; | ||
esac | ||
done | ||
|
||
if [ -z "$base_img" ] || [ -z "$output_img" ]; then | ||
echo "Both -b (base image) and -o (output image) parameters are required." | ||
exit 1 | ||
fi | ||
|
||
rm -f "$output_img" | ||
if ! cp "$base_img" "$output_img"; then | ||
echo "Error: Failed to copy $base_img to $output_img" | ||
exit 1 | ||
fi | ||
|
||
if ! part_table=$(fdisk -l "$output_img" 2>/dev/null); then | ||
echo "Error: Failed to read partition table from $output_img" | ||
exit 1 | ||
fi | ||
|
||
aux_line=$(echo "$part_table" | grep 'aux') | ||
if [ -z "$aux_line" ]; then | ||
echo "Error: 'aux' partition not found in $output_img" | ||
exit 1 | ||
fi | ||
|
||
start=$(echo "$aux_line" | awk '{print $2}') | ||
end=$(echo "$aux_line" | awk '{print $3}') | ||
count=$(($end - $start + 1)) | ||
block_size=$(echo "$part_table" | grep "Logical sector size" | awk '{print $4}') | ||
|
||
dd if="$output_img" of="tmpaux" skip="$start" count="$count" bs="$block_size" status=none | ||
|
||
touch tmp-empty-file | ||
e2cp tmp-empty-file tmpaux:/test-mode | ||
rm tmp-empty-file | ||
|
||
dd of="$output_img" if="tmpaux" seek="$start" count="$count" bs="$block_size" status=none conv=notrunc | ||
rm tmpaux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters