diff --git a/dracut/29kcrypt/generator.sh b/dracut/29kcrypt/generator.sh index f0451a8..a449e82 100755 --- a/dracut/29kcrypt/generator.sh +++ b/dracut/29kcrypt/generator.sh @@ -8,18 +8,19 @@ GENERATOR_DIR="$2" [ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" oem_label=$(getarg rd.cos.oemlabel=) -neednet="rd.neednet" # See https://github.com/kairos-io/packages/blob/d12b12b043a71d8471454f7b4fc84c3181d2bf60/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-generator.sh#L29 { echo "[Unit]" echo "DefaultDependencies=no" - echo "Description=kcrypt online mount" echo "Before=cos-immutable-rootfs.service" echo "Conflicts=initrd-switch-root.target" - if getargbool 0 $neednet; then + if getargbool 0 rd.neednet; then echo "Wants=network-online.target" echo "After=network-online.target" + echo "Description=kcrypt online mount" + else + echo "Description=kcrypt mount" fi # OEM is special as kcrypt plugins might need that in order to unlock other partitions and plugins can reside in /oem as well and kcrypt needs to find them if [ -n "${oem_label}" ]; then @@ -37,4 +38,4 @@ if [ ! -e "$GENERATOR_DIR/initrd-fs.target.requires/kcrypt.service" ]; then mkdir -p "$GENERATOR_DIR"/initrd-fs.target.requires ln -s "$GENERATOR_DIR"/kcrypt.service \ "$GENERATOR_DIR"/initrd-fs.target.requires/kcrypt.service -fi \ No newline at end of file +fi diff --git a/main.go b/main.go index 522465e..1bb9e7a 100644 --- a/main.go +++ b/main.go @@ -283,7 +283,7 @@ func unlockAll() error { partitionInfo, _, err := pi.NewPartitionInfoFromFile(pi.DefaultPartitionInfoFile) if err != nil { - return err + fmt.Printf("Partition file not found '%s' \n", pi.DefaultPartitionInfoFile) } block, err := ghw.Block() @@ -291,7 +291,9 @@ func unlockAll() error { for _, disk := range block.Disks { for _, p := range disk.Partitions { if p.Type == "crypto_LUKS" { - p.Label = partitionInfo.LookupLabelForUUID(p.UUID) + if partitionInfo != nil { + p.Label = partitionInfo.LookupLabelForUUID(p.UUID) + } fmt.Printf("Unmounted Luks found at '%s' LABEL '%s' \n", p.Name, p.Label) err = multierror.Append(err, unlockDisk(p)) if err != nil { @@ -302,7 +304,7 @@ func unlockAll() error { } } } - return err + return nil } func main() {