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
243
243
ROOTFS_DIR ?= $(ROOTFS_PARENT_DIR ) /alpine-$(ARCH )
244
244
CPIO_FILE ?= $(ROOTFS_PARENT_DIR ) /$$(basename $(ROOTFS_DIR ) ) .cpio.gz
245
245
EXT4_SIZE ?= 1G
246
+ ifeq ($(SUDO ) ,1)
247
+ SUDO := sudo
248
+ endif
246
249
247
250
# The user might set a relative path for `CPIO_FILE`, so we need to get the
248
251
# absolute path, as we need to reference it after we've changed directories
@@ -271,13 +274,13 @@ ext4: | $(ROOTFS_DIR)
271
274
272
275
.PHONY : cpio initramfs
273
276
initramfs 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) \
276
279
| gzip --best > $(CPIO_FILE )
277
280
278
281
.PHONY : uncpio
279
282
uncpio : | $(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
281
284
282
285
.PHONY : rootfs
283
286
rootfs : ext4 cpio
You can’t perform that action at this time.
0 commit comments