From b9deb82cc2c2ba1197f7009af6ba69969b5d814b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Furkan=20T=C3=BCrkal?= <furkan.turkal@chainguard.dev>
Date: Mon, 11 Mar 2024 17:11:50 +0300
Subject: [PATCH] create missing dirs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Furkan Türkal <furkan.turkal@chainguard.dev>
---
 confluent-kafka.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/confluent-kafka.yaml b/confluent-kafka.yaml
index c4e447c4219..ebef0ca5b9d 100644
--- a/confluent-kafka.yaml
+++ b/confluent-kafka.yaml
@@ -50,11 +50,20 @@ pipeline:
       tar -xzvf core/build/distributions/kafka_*-${{vars.mangled-package-version}}.tgz
 
       mkdir -p ${{targets.destdir}}/usr/lib/kafka/logs
+      mkdir -p ${{targets.destdir}}/etc/kafka
+      mkdir -p ${{targets.destdir}}/var/lib/kafka/data
 
       mv kafka_*-${{vars.mangled-package-version}}/bin ${{targets.destdir}}/usr/lib/kafka
       mv kafka_*-${{vars.mangled-package-version}}/libs ${{targets.destdir}}/usr/lib/kafka
       mv kafka_*-${{vars.mangled-package-version}}/config ${{targets.destdir}}/usr/lib/kafka
 
+      # Install required runtime scripts
+      mkdir -p ${{targets.destdir}}/usr/bin
+      for file in $(find ./bin -type f -exec grep -lE '^#!(/usr/bin/env |/bin/)' {} \;); do
+        filename=$(basename "$f")
+        install -D -m755 "$file" ${{targets.destdir}}/usr/bin/"$filename"
+      done
+
       # Clean up windows
       rm -rf ${{targets.destdir}}/usr/lib/kafka/bin/*.bat