Skip to content

macOS compatibility #65

@reneleonhardt

Description

@reneleonhardt

The script / Makefile doesn't work on macOS.

For example mktemp tmp/options-XXXXXX.mk doesn't create the subfolder if it doesn't exist, and the pattern isn't templated if there is a suffix after XXXXXX.
In addition, mkimg.sh explicitly allows only NetBSD / smolBSD / Linux, not macOS (Darwin).

If you want to test it, you could add a CI workflow using the macos-latest runner.

diff --git a/docker2svc.sh b/docker2svc.sh
--- a/docker2svc.sh	(revision a6e722daba4d3fb4fb8274a63389584017236fe6)
+++ b/docker2svc.sh	(date 1770030292125)
@@ -12,7 +12,8 @@
 dockerfile=$1
 ECHON="/bin/echo -n"
 
-TMPOPTS=$(mktemp tmp/options-XXXXXX.mk)
+mkdir -p ./tmp
+TMPOPTS="$(mktemp tmp/options.mk.XXXXXX)"
 # Dockerfile compatibility
 sed -n 's/LABEL \(smolbsd\.\)\?\(.*=.*\)/\2/p' $dockerfile | \
 	awk -F= '{ printf "%s=%s\n", toupper($1), $2 }' \
diff --git a/mkimg.sh b/mkimg.sh
--- a/mkimg.sh	(revision a6e722daba4d3fb4fb8274a63389584017236fe6)
+++ b/mkimg.sh	(date 1770030545725)
@@ -89,16 +89,16 @@
 # those 2 will be ported at some point
 OpenBSD)
 	is_openbsd=1
-	echo "${ERROR} unsupported for now"
+	echo "${ERROR} $OS unsupported for now"
 	exit 1
 	;;
 FreeBSD)
 	is_freebsd=1
-	echo "${ERROR} unsupported for now"
+	echo "${ERROR} $OS unsupported for now"
 	exit 1
 	;;
 *)
-	echo "${ERROR} unsupported for now"
+	echo "${ERROR} $OS unsupported for now"
 	exit 1
 esac
 
diff --git a/README.md b/README.md
--- a/README.md	(revision a6e722daba4d3fb4fb8274a63389584017236fe6)
+++ b/README.md	(date 1770030049567)
@@ -49,6 +49,12 @@
 $ sudo apt install curl jq git bmake qemu-system-x86_64 sudo binutils libarchive-tools gdisk
 ```
 
+macOS:
+
+```sh
+$ brew install curl jq git bmake qemu binutils libarchive
+```
+
 ## Quickstart
 
 ### Create a _smolBSD_ image using a _Dockerfile_
@@ -74,11 +80,11 @@
 ```
 ⚙️ Build:
 ```sh
-host$ ./docker2svc.sh dockerfiles/Dockerfile.caddy
+SERVICE=caddy ./docker2svc.sh dockerfiles/Dockerfile.caddy
 ```
 🚀 Run:
 ```sh
-host$ ./startnb.sh -f etc/caddy.conf
+./startnb.sh -f etc/caddy.conf
 ```
 ✅ Test:
 ```sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions