mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-29 12:29:35 +03:00
copy-builtin: posix conformance
This commits contains changes to allow running `copy-builtin` without bash + some minor improvements. changed shebang to /bin/sh added -f option to `set` to globally disable unneeded globbing replaced all `echo` commands within add_after() with `printf` alternative to avoid possible issues with options (-neE) dropped non-portable superfluous `readlink` command replaced superfluous `true` command with `:` builtin alternative replaced non-portable `--recursive` option of `cp` command with `-R` alternative dropped non-portable `local` keyword Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: illiliti <illiliti@protonmail.com> Closes #12004
This commit is contained in:
parent
2085a5f992
commit
74256266ff
47
copy-builtin
47
copy-builtin
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -ef
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
@ -9,26 +9,25 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ "$#" -eq 1 ] || usage
|
[ "$#" -eq 1 ] || usage
|
||||||
KERNEL_DIR="$(readlink --canonicalize-existing "$1")"
|
KERNEL_DIR="$1"
|
||||||
|
|
||||||
if ! [ -e 'zfs_config.h' ]
|
if ! [ -e 'zfs_config.h' ]
|
||||||
then
|
then
|
||||||
echo >&2
|
echo "$0: you did not run configure, or you're not in the ZFS source directory."
|
||||||
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."
|
||||||
echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2
|
|
||||||
echo >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
make clean || true
|
exit 1
|
||||||
|
fi >&2
|
||||||
|
|
||||||
|
make clean ||:
|
||||||
make gitrev
|
make gitrev
|
||||||
|
|
||||||
rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
|
rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
|
||||||
cp --recursive include "$KERNEL_DIR/include/zfs"
|
cp -R include "$KERNEL_DIR/include/zfs"
|
||||||
cp --recursive module "$KERNEL_DIR/fs/zfs"
|
cp -R module "$KERNEL_DIR/fs/zfs"
|
||||||
cp zfs_config.h "$KERNEL_DIR/include/zfs/"
|
cp zfs_config.h "$KERNEL_DIR/include/zfs/"
|
||||||
|
|
||||||
cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<"EOF"
|
cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<EOF
|
||||||
config ZFS
|
config ZFS
|
||||||
tristate "ZFS filesystem support"
|
tristate "ZFS filesystem support"
|
||||||
depends on EFI_PARTITION
|
depends on EFI_PARTITION
|
||||||
@ -46,22 +45,21 @@ EOF
|
|||||||
|
|
||||||
add_after()
|
add_after()
|
||||||
{
|
{
|
||||||
local FILE="$1"
|
FILE="$1"
|
||||||
local MARKER="$2"
|
MARKER="$2"
|
||||||
local NEW="$3"
|
NEW="$3"
|
||||||
local LINE
|
|
||||||
|
|
||||||
while IFS='' read -r LINE
|
while IFS='' read -r LINE
|
||||||
do
|
do
|
||||||
echo "$LINE"
|
printf "%s\n" "$LINE"
|
||||||
|
|
||||||
if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
|
if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ]
|
||||||
then
|
then
|
||||||
echo "$NEW"
|
printf "%s\n" "$NEW"
|
||||||
MARKER=''
|
MARKER=''
|
||||||
if IFS='' read -r LINE
|
if IFS='' read -r LINE
|
||||||
then
|
then
|
||||||
[ "$LINE" != "$NEW" ] && echo "$LINE"
|
[ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < "$FILE" > "$FILE.new"
|
done < "$FILE" > "$FILE.new"
|
||||||
@ -72,8 +70,5 @@ add_after()
|
|||||||
add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
|
add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
|
||||||
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
|
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
|
||||||
|
|
||||||
echo >&2
|
echo "$0: done. now you can build the kernel with ZFS support." >&2
|
||||||
echo " $0: done." >&2
|
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user