File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,9 @@ ROOTFS_FORMAT ?= qcow2
243243ROOTFS_DIR ?= $(ROOTFS_PARENT_DIR ) /alpine-$(ARCH )
244244CPIO_FILE ?= $(ROOTFS_PARENT_DIR ) /$$(basename $(ROOTFS_DIR ) ) .cpio.gz
245245EXT4_SIZE ?= 1G
246+ ifeq ($(SUDO ) ,1)
247+ SUDO := sudo
248+ endif
246249
247250# The user might set a relative path for `CPIO_FILE`, so we need to get the
248251# absolute path, as we need to reference it after we've changed directories
@@ -271,13 +274,13 @@ ext4: | $(ROOTFS_DIR)
271274
272275.PHONY : cpio initramfs
273276initramfs cpio : | $(ROOTFS_DIR )
274- (cd $( ROOTFS_DIR) && find . -print0 \
275- | cpio --null --create --verbose --format=newc) \
277+ (cd $( ROOTFS_DIR) && $( SUDO ) find . -print0 \
278+ | $( SUDO ) cpio --null --create --verbose --format=newc) \
276279 | gzip --best > $(CPIO_FILE )
277280
278281.PHONY : uncpio
279282uncpio : | $(ROOTFS_DIR )
280- cd $(ROOTFS_DIR ) && zcat $(CPIO_FILE ) | cpio --extract --make-directories --format=newc --no-absolute-filenames
283+ cd $(ROOTFS_DIR ) && zcat $(CPIO_FILE ) | $( SUDO ) cpio --extract --make-directories --format=newc --no-absolute-filenames
281284
282285.PHONY : rootfs
283286rootfs : ext4 cpio
You can’t perform that action at this time.
0 commit comments