浏览代码

Execute <script> in current dir if --script-chroot is not specified

Jakub Jirutka 7 年之前
父节点
当前提交
c1a8768fff
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      alpine-make-rootfs

+ 3 - 1
alpine-make-rootfs

@@ -45,6 +45,8 @@
 #
 #   -c --script-chroot (SCRIPT_CHROOT)    Bind <script>'s directory at /mnt inside the rootfs dir
 #                                         and chroot into the rootfs before executing <script>.
+#                                         Otherwise <script> is executed in the current directory
+#                                         and $ROOTFS variable points to the rootfs directory.
 #
 #   -d --temp-dir TEMP_DIR                Path where to create a temporary directory; used for
 #                                         downloading apk-tools when not available on the host
@@ -371,7 +373,7 @@ if [ "$SCRIPT" ]; then
 	if [ "$SCRIPT_CHROOT" = 'no' ]; then
 		einfo "Executing script: $script_name $*"
 
-		( cd "$rootfs" && "$SCRIPT" "$@" >&2 ) || die 'Script failed'
+		ROOTFS="$rootfs" "$SCRIPT" "$@" >&2 || die 'Script failed'
 	else
 		einfo "Executing script in chroot: $script_name $*"