X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=copy-builtin;h=18cc741b58e79dba01aa1f6d4970ab7b8a859b11;hb=f795e90a11c683d64bacc260fb7feab705b220b1;hp=795025b380118ab0ef059c6169f3ab9c80bc6c1b;hpb=c10cdcb55f81ea773486161b31bc91bb7b58b4c8;p=mirror_zfs.git diff --git a/copy-builtin b/copy-builtin index 795025b38..18cc741b5 100755 --- a/copy-builtin +++ b/copy-builtin @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -set -e +set -ef usage() { @@ -9,104 +9,42 @@ usage() } [ "$#" -eq 1 ] || usage -KERNEL_DIR="$(readlink --canonicalize-existing "$1")" - -MODULES=() -for MODULE_DIR in module/* -do - [ -d "$MODULE_DIR" ] || continue - MODULES+=("${MODULE_DIR##*/}") -done +KERNEL_DIR="$1" if ! [ -e 'zfs_config.h' ] then - echo >&2 - echo " $0: you did not run configure, or you're not in the ZFS source directory." >&2 - echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2 - echo >&2 + echo "$0: you did not run configure, or you're not in the ZFS source directory." + echo "$0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." + exit 1 -fi +fi >&2 -make clean || true +make clean ||: +make gitrev rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs" -cp --recursive include "$KERNEL_DIR/include/zfs" -cp --recursive module "$KERNEL_DIR/fs/zfs" -cp zfs_config.h "$KERNEL_DIR/" +cp -R include "$KERNEL_DIR/include/zfs" +cp -R module "$KERNEL_DIR/fs/zfs" +cp zfs_config.h "$KERNEL_DIR/include/zfs/" -for MODULE in "${MODULES[@]}" -do - sed -i.bak '/obj =/d' "$KERNEL_DIR/fs/zfs/$MODULE/Makefile" - sed -i.bak '/src =/d' "$KERNEL_DIR/fs/zfs/$MODULE/Makefile" -done - -cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<"EOF" +cat > "$KERNEL_DIR/fs/zfs/Kconfig" < "$FILE.new" - - mv "$FILE.new" "$FILE" -} - -add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"' -add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/' +sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig" +echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile" -echo >&2 -echo " $0: done." >&2 -echo " $0: now you can build the kernel with ZFS support." >&2 -echo " $0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2 -echo >&2 +echo "$0: done. now you can build the kernel with ZFS support." >&2 +echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2