summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2023-01-04 01:50:14 +0100
committerPÁLI Gábor János <pali.gabor@gmail.com>2023-01-04 01:55:22 +0100
commit7e29b66df938395637d06486befee66e010db490 (patch)
treef43b6af84dcbe146a31c4bb25a000df92b5b82ba
parentb8bcf86560cfe636983265550dd55e8d13e65696 (diff)
downloadfreebsd-wifibox-alpine-7e29b66df938395637d06486befee66e010db490.zip
Fix symbolic links on preparing the disk image.
During the build process, `apk` is run by the Linuxulator which places certain files (e.g. `/dev/null`) to `/compat/linux`. This is then inherited by the disk image and causes the corresponding symbolic links to be misplaced.
-rw-r--r--Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f4b0b6d..d1b4271 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ ECHO=/bin/echo
ENV=/usr/bin/env
MKDIR=/bin/mkdir
CP=/bin/cp
+SH=/bin/sh
SED=/usr/bin/sed
TAR=$(LOCALBASE)/bin/gtar
FIND=/usr/bin/find
@@ -36,6 +37,7 @@ GZIP=/usr/bin/gzip
INSTALL_DATA=/usr/bin/install -m $(SHAREMODE)
ID=/usr/bin/id
UMOUNT=/sbin/umount
+STAT=/usr/bin/stat
TOUCH=/usr/bin/touch
TRUE=/usr/bin/true
GIT=$(LOCALBASE)/bin/git
@@ -126,6 +128,12 @@ $(GUESTDIR)/.done:
>> $(GUESTDIR)/etc/fstab
.endfor
.endif
+ # fix symbolic links
+ $(FIND) . -type l -exec stat -f "%N___%Y" {} \; \
+ | $(GREP) /compat/linux \
+ | $(SED) -E 's!(.*)___/compat/linux(.*)!rm \1 \&\& ln -s \2 \1!' \
+ | $(SH)
+ # mark the process done
$(TOUCH) $(GUESTDIR)/.done
image-contents: $(GUESTDIR)/.done