Browse Source

macos x portability patch for cpio

Waldemar Brodkorb 14 years ago
parent
commit
23b4016d58
2 changed files with 14 additions and 4 deletions
  1. 2 2
      mk/image.mk
  2. 12 2
      scripts/cpio

+ 2 - 2
mk/image.mk

@@ -50,13 +50,13 @@ ${BIN_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR}
 
 ${BIN_DIR}/${INITRAMFS}: ${TARGET_DIR}
 	cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | sort | \
-	    cpio -R 0:0 -oC512 -Mdist -Hnewc | ${ADK_COMPRESSION_TOOL} >$@
+	    cpio -oC512 r -Mdist -Hnewc | ${ADK_COMPRESSION_TOOL} >$@
 
 ${BUILD_DIR}/${INITRAMFS_PIGGYBACK}: ${TARGET_DIR}
 	$(SED) 's#^CONFIG_INITRAMFS_SOURCE.*#CONFIG_INITRAMFS_SOURCE="${BUILD_DIR}/${INITRAMFS_PIGGYBACK}"#' \
 		$(LINUX_DIR)/.config
 	cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | sort | \
-	    cpio -R 0:0 -oC512 -Mdist -Hnewc >$@
+	    cpio -oC512 r -Mdist -Hnewc >$@
 
 ${BIN_DIR}/${ROOTFSSQUASHFS}: ${TARGET_DIR}
 	PATH='${TARGET_PATH}' \

+ 12 - 2
scripts/cpio

@@ -1,18 +1,28 @@
 #!/usr/bin/env bash
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
+set -x
 
+opt=
+user="-R 0:0"
 os=$(uname)
 case $os in
 	NetBSD|MirBSD|OpenBSD)
 		quiet=""
 		;;
+	Darwin)
+		user="-R root:wheel"
+		quiet=""
+		;;
 	*)
 		quiet="--quiet"
 		;;
 esac
+if [ "$2" = "r" ];then
+	opt=$user
+fi
 if [ -x /usr/bin/cpio ];then
-	/usr/bin/cpio $quiet "$@"
+	/usr/bin/cpio $quiet $opt "$@"
 else
-	/bin/cpio $quiet "$@"
+	/bin/cpio $quiet $opt "$@"
 fi