Merge pull request #3504 from federico-pellegatta/format-pkg-gpt-support

Add GUID Partition Table (GPT) support to the `format` package
This commit is contained in:
Avi Deitcher 2020-04-23 13:48:25 +03:00 committed by GitHub
commit 966cf121a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 119 additions and 38 deletions

View File

@ -52,9 +52,17 @@ onboot:
command: ["/usr/bin/format", "-force", "-type", "xfs", "-label", "DATA", "-verbose", "/dev/vda"] command: ["/usr/bin/format", "-force", "-type", "xfs", "-label", "DATA", "-verbose", "/dev/vda"]
``` ```
```
onboot:
- name: format
image: linuxkit/format:<hash>
command: ["/usr/bin/format", "-type", "ext4", "-partition", "gpt", "/dev/vda"]
```
- `-force` can be used to force the partition to be cleared and recreated (if applicable), and the recreated partition formatted. This option would be used to re-init the partition on every boot, rather than persisting the partition between boots. - `-force` can be used to force the partition to be cleared and recreated (if applicable), and the recreated partition formatted. This option would be used to re-init the partition on every boot, rather than persisting the partition between boots.
- `-label` can be used to give the disk a label - `-label` can be used to give the disk a label
- `-type` can be used to specify the type. This is `ext4` by default but `btrfs` and `xfs` are also supported - `-type` can be used to specify the type. This is `ext4` by default but `btrfs` and `xfs` are also supported
- `-partition` can be used to specify the partition table type. This is `dos` by default but `gpt` is also supported
- `-verbose` enables verbose logging, which can be used to troubleshoot device auto-detection and (re-)partitioning - `-verbose` enables verbose logging, which can be used to troubleshoot device auto-detection and (re-)partitioning
- The final (optional) argument specifies the device name - The final (optional) argument specifies the device name

View File

@ -15,7 +15,7 @@ onboot:
- name: sysfs - name: sysfs
image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -13,7 +13,7 @@ onboot:
image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "/dev/sda"] command: ["/usr/bin/format", "/dev/sda"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -13,7 +13,7 @@ onboot:
image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "/dev/sda"] command: ["/usr/bin/format", "/dev/sda"]
- name: dm-crypt - name: dm-crypt
image: linuxkit/dm-crypt:0ea63bfd97b719d185b69994b4856d97fbc8a2dd image: linuxkit/dm-crypt:0ea63bfd97b719d185b69994b4856d97fbc8a2dd

View File

@ -20,7 +20,7 @@ onboot:
image: linuxkit/binfmt:94d59bc179c7a9155d8593a974d499352b70bfd5 image: linuxkit/binfmt:94d59bc179c7a9155d8593a974d499352b70bfd5
# Format and mount the disk image in /var/lib/docker # Format and mount the disk image in /var/lib/docker
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib"] command: ["/usr/bin/mountie", "/var/lib"]

View File

@ -12,7 +12,7 @@ onboot:
- name: sysfs - name: sysfs
image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -13,7 +13,7 @@ onboot:
image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/external"] command: ["/usr/bin/mountie", "/var/external"]

View File

@ -20,12 +20,13 @@ const (
) )
var ( var (
labelVar string labelVar string
fsTypeVar string fsTypeVar string
forceVar bool partTypeVar string
verboseVar bool forceVar bool
drives map[string]bool verboseVar bool
driveKeys []string drives map[string]bool
driveKeys []string
) )
func hasPartitions(d string) bool { func hasPartitions(d string) bool {
@ -72,7 +73,7 @@ func isEmptyDevice(d string) (bool, error) {
return isEmpty, nil return isEmpty, nil
} }
func autoformat(label, fsType string) error { func autoformat(label, fsType string, partType string) error {
var first string var first string
for _, d := range driveKeys { for _, d := range driveKeys {
if verboseVar { if verboseVar {
@ -93,7 +94,7 @@ func autoformat(label, fsType string) error {
return fmt.Errorf("No eligible disks found") return fmt.Errorf("No eligible disks found")
} }
return format(first, label, fsType, false) return format(first, label, fsType, partType, false)
} }
func refreshDevicesAndWaitFor(awaitedDevice string) error { func refreshDevicesAndWaitFor(awaitedDevice string) error {
@ -128,7 +129,7 @@ func refreshDevicesAndWaitFor(awaitedDevice string) error {
return nil return nil
} }
func format(d, label, fsType string, forced bool) error { func format(d, label, fsType string, partType string, forced bool) error {
if forced { if forced {
// clear partitions on device if forced format and they exist // clear partitions on device if forced format and they exist
if hasPartitions(d) { if hasPartitions(d) {
@ -154,7 +155,14 @@ func format(d, label, fsType string, forced bool) error {
http://bugs.alpinelinux.org/issues/145 http://bugs.alpinelinux.org/issues/145
*/ */
fdiskCmd := exec.Command("fdisk", d) fdiskCmd := exec.Command("fdisk", d)
fdiskCmd.Stdin = strings.NewReader("w") switch partType {
case "dos":
fdiskCmd.Stdin = strings.NewReader("w")
case "gpt":
fdiskCmd.Stdin = strings.NewReader("g\nw")
default:
return fmt.Errorf("Unsupported partition table type: %s", partType)
}
if out, err := fdiskCmd.CombinedOutput(); err != nil { if out, err := fdiskCmd.CombinedOutput(); err != nil {
return fmt.Errorf("Error running fdisk: %v\n%s", err, out) return fmt.Errorf("Error running fdisk: %v\n%s", err, out)
} }
@ -258,6 +266,7 @@ func init() {
flag.BoolVar(&forceVar, "force", false, "Force format of specified single device (default false)") flag.BoolVar(&forceVar, "force", false, "Force format of specified single device (default false)")
flag.StringVar(&labelVar, "label", "", "Disk label to apply") flag.StringVar(&labelVar, "label", "", "Disk label to apply")
flag.StringVar(&fsTypeVar, "type", "ext4", "Type of filesystem to create") flag.StringVar(&fsTypeVar, "type", "ext4", "Type of filesystem to create")
flag.StringVar(&partTypeVar, "partition", "dos", "Type of partition table to create")
flag.BoolVar(&verboseVar, "verbose", false, "Enable verbose output (default false)") flag.BoolVar(&verboseVar, "verbose", false, "Enable verbose output (default false)")
} }
@ -283,7 +292,7 @@ func main() {
if flag.NArg() == 0 { if flag.NArg() == 0 {
// auto-detect drives if a device to format is not explicitly specified // auto-detect drives if a device to format is not explicitly specified
findDrives() findDrives()
if err := autoformat(labelVar, fsTypeVar); err != nil { if err := autoformat(labelVar, fsTypeVar, partTypeVar); err != nil {
log.Fatalf("%v", err) log.Fatalf("%v", err)
} }
} else { } else {
@ -294,13 +303,13 @@ func main() {
} }
if forceVar == true { if forceVar == true {
if err := format(candidateDevice, labelVar, fsTypeVar, forceVar); err != nil { if err := format(candidateDevice, labelVar, fsTypeVar, partTypeVar, forceVar); err != nil {
log.Fatalf("%v", err) log.Fatalf("%v", err)
} }
} else { } else {
// add the deviceVar to the array of devices to consider autoformatting // add the deviceVar to the array of devices to consider autoformatting
driveKeys = []string{candidateDevice} driveKeys = []string{candidateDevice}
if err := autoformat(labelVar, fsTypeVar); err != nil { if err := autoformat(labelVar, fsTypeVar, partTypeVar); err != nil {
log.Fatalf("%v", err) log.Fatalf("%v", err)
} }
} }

View File

@ -15,7 +15,7 @@ onboot:
image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -15,7 +15,7 @@ onboot:
image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee image: linuxkit/dhcpcd:2f8a9b670aa6e96a09db56ec45c9f07ef2a811ee
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -12,7 +12,7 @@ onboot:
- name: sysfs - name: sysfs
image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a image: linuxkit/sysfs:697f996868d6625a78bbbefb199d7b6b6ae3533a
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -13,7 +13,7 @@ onboot:
- name: sysctl - name: sysctl
image: linuxkit/sysctl:541f60fe3676611328e89e8bac251fc636b1a6aa image: linuxkit/sysctl:541f60fe3676611328e89e8bac251fc636b1a6aa
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib"] command: ["/usr/bin/mountie", "/var/lib"]

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"] command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -9,7 +9,7 @@ onboot:
image: linuxkit/modprobe:944769462b9d10b1b1506498d3eb03dcc5416f7f image: linuxkit/modprobe:944769462b9d10b1b1506498d3eb03dcc5416f7f
command: ["modprobe", "btrfs"] command: ["modprobe", "btrfs"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-type", "btrfs" ] command: ["/usr/bin/format", "-type", "btrfs" ]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-type", "xfs"] command: ["/usr/bin/format", "-type", "xfs"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format"] command: ["/usr/bin/format"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-label", "docker"] command: ["/usr/bin/format", "-label", "docker"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "@DEVICE@"] command: ["/usr/bin/format", "@DEVICE@"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -9,7 +9,7 @@ onboot:
image: linuxkit/modprobe:944769462b9d10b1b1506498d3eb03dcc5416f7f image: linuxkit/modprobe:944769462b9d10b1b1506498d3eb03dcc5416f7f
command: ["modprobe", "btrfs"] command: ["modprobe", "btrfs"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-type", "btrfs" ] command: ["/usr/bin/format", "-type", "btrfs" ]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-type", "xfs" ] command: ["/usr/bin/format", "-type", "xfs" ]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69

View File

@ -6,19 +6,19 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-verbose", "-type", "ext4", "/dev/sda"] command: ["/usr/bin/format", "-verbose", "-type", "ext4", "/dev/sda"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-verbose", "-type", "ext4", "/dev/sdb"] command: ["/usr/bin/format", "-verbose", "-type", "ext4", "/dev/sdb"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-verbose", "-type", "xfs", "/dev/sda"] command: ["/usr/bin/format", "-verbose", "-type", "xfs", "/dev/sda"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-verbose", "-force", "-type", "xfs", "/dev/sdb"] command: ["/usr/bin/format", "-verbose", "-force", "-type", "xfs", "/dev/sdb"]
- name: test - name: test
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
binds: binds:
- /check.sh:/check.sh - /check.sh:/check.sh
command: ["sh", "./check.sh"] command: ["sh", "./check.sh"]

View File

@ -0,0 +1,10 @@
#!/bin/sh
function failed {
printf "format_mount test suite FAILED\n" >&1
exit 1
}
touch /var/lib/docker/foo || failed
printf "format_mount test suite PASSED\n" >&1

View File

@ -0,0 +1,25 @@
#!/bin/sh
# SUMMARY: Check that a GPT partitioned disk can be mounted
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=test-format
DISK=disk.img
clean_up() {
rm -rf ${NAME}-* ${DISK}
}
trap clean_up EXIT
linuxkit build -format kernel+initrd -name ${NAME} test.yml
RESULT="$(linuxkit run -disk file=${DISK},size=512M ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -0,0 +1,29 @@
kernel:
image: linuxkit/kernel:5.4.30
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:f670045ecb6ec31ea37dd10114366e9a1e915013
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot:
- name: format
image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-partition", "gpt"]
- name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.11
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh
command: ["sh", "./check.sh"]
- name: poweroff
image: linuxkit/poweroff:06dd4e46c62fbe79123a028835c921f80e4855d3
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
trust:
org:
- linuxkit
- library

View File

@ -6,10 +6,10 @@ init:
- linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2 - linuxkit/runc:1eef77f5963e44e491abfe392206769037d47ae2
onboot: onboot:
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-label", "docker"] command: ["/usr/bin/format", "-label", "docker"]
- name: format - name: format
image: linuxkit/format:80bd847a90842d3f19460a560d7d95d6fe13bd71 image: linuxkit/format:0b75e494eea0312f3015e6c6f7c5927620d56c96
command: ["/usr/bin/format", "-label", "foo"] command: ["/usr/bin/format", "-label", "foo"]
- name: mount - name: mount
image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69 image: linuxkit/mount:8363f4f1744e1df2557ec260a4cc94227178fd69