2008-11-20 20:01:55 +00:00
|
|
|
#!/bin/bash
|
2008-12-03 20:09:06 +00:00
|
|
|
#
|
|
|
|
# WARNING: This script removes the entire zfs subtree and will
|
|
|
|
# repopulate it using the requested OpenSolaris source release.
|
|
|
|
# This script should only be used when rebasing the TopGit tree
|
|
|
|
# against the latest release.
|
|
|
|
#
|
|
|
|
trap die_int INT
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
RELEASE=$1
|
2008-11-20 20:01:55 +00:00
|
|
|
PROG=update-zfs.sh
|
2009-12-12 00:15:33 +00:00
|
|
|
REMOTE_DOC_FILE=man-sunosman-20090930.tar.bz2
|
|
|
|
REMOTE_DOC=http://dlc.sun.com/osol/man/downloads/current/${REMOTE_DOC_FILE}
|
2008-12-03 20:09:06 +00:00
|
|
|
REMOTE_SRC=http://dlc.sun.com/osol/on/downloads/${RELEASE}/on-src.tar.bz2
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
die() {
|
2008-12-03 20:09:06 +00:00
|
|
|
rm -Rf ${SRC}
|
2008-11-20 20:01:55 +00:00
|
|
|
echo "${PROG}: $1" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
die_int() {
|
|
|
|
die "Ctrl-C abort"
|
|
|
|
}
|
|
|
|
|
|
|
|
DST=`pwd`
|
|
|
|
if [ `basename $DST` != "scripts" ]; then
|
2008-11-20 20:01:55 +00:00
|
|
|
die "Must be run from scripts directory"
|
|
|
|
fi
|
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
if [ ! "$RELEASE" ]; then
|
|
|
|
die "Must specify ZFS release build"
|
|
|
|
fi
|
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
SRC=`mktemp -d /tmp/os-${RELEASE}.XXXXXXXXXX`
|
|
|
|
DST=`dirname $DST`
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
echo "----------------------------------------------------------------"
|
2008-12-03 20:09:06 +00:00
|
|
|
echo "Remote Source: ${REMOTE_SRC}"
|
2009-12-12 00:15:33 +00:00
|
|
|
echo "Remote Docs: ${REMOTE_DOC}"
|
2008-12-03 20:09:06 +00:00
|
|
|
echo "Local Source: ${SRC}"
|
|
|
|
echo "Local Dest: ${DST}"
|
2008-11-20 20:01:55 +00:00
|
|
|
echo
|
2008-12-03 20:09:06 +00:00
|
|
|
echo "------------- Fetching OpenSolaris ${RELEASE} archive ----------------"
|
2009-12-12 00:15:33 +00:00
|
|
|
wget -q ${REMOTE_SRC} -P ${SRC} ||
|
2008-12-03 20:09:06 +00:00
|
|
|
die "Error 'wget ${REMOTE_SRC}'"
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
echo "------------- Fetching OpenSolaris documentation ---------------"
|
|
|
|
wget -q ${REMOTE_DOC} -P ${SRC} ||
|
|
|
|
die "Error 'wget ${REMOTE_DOC}'"
|
|
|
|
|
2008-12-11 19:16:38 +00:00
|
|
|
echo "------------- Unpacking OpenSolaris ${RELEASE} archive ---------------"
|
2008-12-03 20:09:06 +00:00
|
|
|
tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC} ||
|
|
|
|
die "Error 'tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC}'"
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
echo "------------- Unpacking OpenSolaris documentation --------------"
|
|
|
|
tar -xjf ${SRC}/${REMOTE_DOC_FILE} -C ${SRC} ||
|
|
|
|
die "Error 'tar -xjf ${SRC}/${REMOTE_DOC_FILE} -C ${SRC}'"
|
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
SRC_LIB=${SRC}/usr/src/lib
|
|
|
|
SRC_CMD=${SRC}/usr/src/cmd
|
|
|
|
SRC_CM=${SRC}/usr/src/common
|
|
|
|
SRC_UTS=${SRC}/usr/src/uts
|
|
|
|
SRC_UCM=${SRC}/usr/src/uts/common
|
|
|
|
SRC_ZLIB=${SRC}/usr/src/uts/common/fs/zfs
|
2009-12-12 00:15:33 +00:00
|
|
|
SRC_MAN=${SRC}/man
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
DST_MOD=${DST}/module
|
|
|
|
DST_LIB=${DST}/lib
|
|
|
|
DST_CMD=${DST}/cmd
|
2009-12-12 00:15:33 +00:00
|
|
|
DST_MAN=${DST}/man
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
umask 022
|
2008-12-03 20:09:06 +00:00
|
|
|
rm -Rf ${DST}/zfs
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
echo "------------- Updating ZFS from OpenSolaris ${RELEASE} ---------------"
|
2008-12-11 22:21:14 +00:00
|
|
|
echo "* module/avl"
|
2008-12-11 19:08:09 +00:00
|
|
|
mkdir -p ${DST_MOD}/avl/include/sys/
|
|
|
|
cp ${SRC_CM}/avl/avl.c ${DST_MOD}/avl/
|
|
|
|
cp ${SRC_UCM}/sys/avl.h ${DST_MOD}/avl/include/sys/
|
|
|
|
cp ${SRC_UCM}/sys/avl_impl.h ${DST_MOD}/avl/include/sys/
|
|
|
|
|
2008-12-11 22:16:55 +00:00
|
|
|
echo "* module/nvpair"
|
2008-12-11 19:08:09 +00:00
|
|
|
mkdir -p ${DST_MOD}/nvpair/include/sys/
|
|
|
|
cp ${SRC_CM}/nvpair/nvpair.c ${DST_MOD}/nvpair/
|
|
|
|
cp ${SRC_UCM}/sys/nvpair.h ${DST_MOD}/nvpair/include/sys/
|
|
|
|
cp ${SRC_UCM}/sys/nvpair_impl.h ${DST_MOD}/nvpair/include/sys/
|
|
|
|
|
2009-01-05 20:03:23 +00:00
|
|
|
echo "* module/unicode"
|
|
|
|
mkdir -p ${DST_MOD}/unicode/include/sys/
|
|
|
|
cp ${SRC_CM}/unicode/*.c ${DST_MOD}/unicode/
|
|
|
|
cp ${SRC_UCM}/sys/u8_textprep.h ${DST_MOD}/unicode/include/sys/
|
|
|
|
cp ${SRC_UCM}/sys/u8_textprep_data.h ${DST_MOD}/unicode/include/sys/
|
|
|
|
|
2008-12-11 22:21:14 +00:00
|
|
|
echo "* module/zcommon"
|
2008-12-11 19:08:09 +00:00
|
|
|
mkdir -p ${DST_MOD}/zcommon/include/sys/fs/
|
|
|
|
cp ${SRC_CM}/zfs/*.c ${DST_MOD}/zcommon/
|
|
|
|
cp ${SRC_CM}/zfs/*.h ${DST_MOD}/zcommon/include/
|
|
|
|
cp ${SRC_UCM}/sys/fs/zfs.h ${DST_MOD}/zcommon/include/sys/fs/
|
|
|
|
|
|
|
|
echo "* module/zfs"
|
2010-04-29 17:37:15 +00:00
|
|
|
mkdir -p ${DST_MOD}/zfs/include/sys/fm/fs/
|
2008-12-11 19:08:09 +00:00
|
|
|
cp ${SRC_UTS}/intel/zfs/spa_boot.c ${DST_MOD}/zfs/
|
|
|
|
cp ${SRC_ZLIB}/*.c ${DST_MOD}/zfs/
|
|
|
|
cp ${SRC_ZLIB}/sys/*.h ${DST_MOD}/zfs/include/sys/
|
2010-04-29 17:37:15 +00:00
|
|
|
cp ${SRC_UCM}/os/fm.c ${DST_MOD}/zfs/
|
|
|
|
cp ${SRC_UCM}/sys/fm/protocol.h ${DST_MOD}/zfs/include/sys/fm/
|
|
|
|
cp ${SRC_UCM}/sys/fm/util.h ${DST_MOD}/zfs/include/sys/fm/
|
|
|
|
cp ${SRC_UCM}/sys/fm/fs/zfs.h ${DST_MOD}/zfs/include/sys/fm/fs/
|
2008-12-11 19:08:09 +00:00
|
|
|
rm ${DST_MOD}/zfs/vdev_disk.c
|
2009-11-16 00:20:01 +00:00
|
|
|
rm ${DST_MOD}/zfs/zvol.c
|
2008-12-11 19:08:09 +00:00
|
|
|
rm ${DST_MOD}/zfs/include/sys/vdev_disk.h
|
|
|
|
|
2008-12-11 22:21:14 +00:00
|
|
|
echo "* lib/libavl"
|
|
|
|
# Full source available in 'module/avl'
|
|
|
|
|
2008-12-11 22:16:55 +00:00
|
|
|
echo "* lib/libnvpair"
|
|
|
|
mkdir -p ${DST_LIB}/libnvpair/include/
|
|
|
|
cp ${SRC_UCM}/os/nvpair_alloc_system.c ${DST_LIB}/libnvpair/
|
|
|
|
cp ${SRC_LIB}/libnvpair/libnvpair.c ${DST_LIB}/libnvpair/
|
|
|
|
cp ${SRC_LIB}/libnvpair/libnvpair.h ${DST_LIB}/libnvpair/include/
|
|
|
|
|
2009-01-05 20:03:23 +00:00
|
|
|
echo "* lib/libunicode"
|
|
|
|
# Full source available in 'module/unicode'
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* lib/libuutil"
|
|
|
|
mkdir -p ${DST_LIB}/libuutil/include/
|
|
|
|
cp ${SRC_LIB}/libuutil/common/*.c ${DST_LIB}/libuutil/
|
|
|
|
cp ${SRC_LIB}/libuutil/common/*.h ${DST_LIB}/libuutil/include/
|
2008-12-03 20:09:06 +00:00
|
|
|
|
2009-10-09 22:37:29 +00:00
|
|
|
echo "* lib/libefi"
|
|
|
|
mkdir -p ${DST_LIB}/libefi/include/sys/
|
|
|
|
cp ${SRC_LIB}/libefi/common/rdwr_efi.c ${DST_LIB}/libefi/
|
|
|
|
cp ${SRC_UCM}/sys/efi_partition.h ${DST_LIB}/libefi/include/sys/
|
|
|
|
cp ${SRC_UCM}/sys/uuid.h ${DST_LIB}/libefi/include/sys/
|
|
|
|
|
2008-12-11 19:14:49 +00:00
|
|
|
echo "* lib/libzpool"
|
|
|
|
mkdir -p ${DST_LIB}/libzpool/include/sys/
|
|
|
|
cp ${SRC_LIB}/libzpool/common/kernel.c ${DST_LIB}/libzpool/
|
|
|
|
cp ${SRC_LIB}/libzpool/common/taskq.c ${DST_LIB}/libzpool/
|
|
|
|
cp ${SRC_LIB}/libzpool/common/util.c ${DST_LIB}/libzpool/
|
|
|
|
cp ${SRC_LIB}/libzpool/common/sys/zfs_context.h ${DST_LIB}/libzpool/include/sys/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* lib/libzfs"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_LIB}/libzfs/include/
|
|
|
|
cp ${SRC_LIB}/libzfs/common/*.c ${DST_LIB}/libzfs/
|
|
|
|
cp ${SRC_LIB}/libzfs/common/*.h ${DST_LIB}/libzfs/include/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* cmd/zpool"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_CMD}/zpool
|
|
|
|
cp ${SRC_CMD}/zpool/*.c ${DST_CMD}/zpool/
|
|
|
|
cp ${SRC_CMD}/zpool/*.h ${DST_CMD}/zpool/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* cmd/zfs"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_CMD}/zfs
|
|
|
|
cp ${SRC_CMD}/zfs/*.c ${DST_CMD}/zfs/
|
|
|
|
cp ${SRC_CMD}/zfs/*.h ${DST_CMD}/zfs/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* cmd/zdb"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_CMD}/zdb/
|
|
|
|
cp ${SRC_CMD}/zdb/*.c ${DST_CMD}/zdb/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* cmd/zinject"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_CMD}/zinject
|
|
|
|
cp ${SRC_CMD}/zinject/*.c ${DST_CMD}/zinject/
|
|
|
|
cp ${SRC_CMD}/zinject/*.h ${DST_CMD}/zinject/
|
|
|
|
|
2008-12-11 19:08:09 +00:00
|
|
|
echo "* cmd/ztest"
|
2008-12-03 20:09:06 +00:00
|
|
|
mkdir -p ${DST_CMD}/ztest
|
|
|
|
cp ${SRC_CMD}/ztest/*.c ${DST_CMD}/ztest/
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-12-12 00:15:33 +00:00
|
|
|
echo "* man/"
|
|
|
|
mkdir -p ${DST_MAN}/man8
|
|
|
|
cp ${SRC_MAN}/man1m/zfs.1m ${DST_MAN}/man8/zfs.8
|
|
|
|
cp ${SRC_MAN}/man1m/zpool.1m ${DST_MAN}/man8/zpool.8
|
|
|
|
cp ${SRC_MAN}/man1m/zdb.1m ${DST_MAN}/man8/zdb.8
|
|
|
|
chmod -R 644 ${DST_MAN}/man8/*
|
|
|
|
|
2008-12-11 19:14:49 +00:00
|
|
|
echo "${REMOTE_SRC}" >${DST}/ZFS.RELEASE
|
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
rm -Rf ${SRC}
|