3 # WARNING: This script removes the entire zfs subtree and will
4 # repopulate it using the requested OpenSolaris source release.
5 # This script should only be used when rebasing the TopGit tree
6 # against the latest release.
12 REMOTE_SRC=http://dlc.sun.com/osol/on/downloads/${RELEASE}/on-src.tar.bz2
16 echo "${PROG}: $1" >&2
25 if [ `basename $DST` != "scripts" ]; then
26 die "Must be run from scripts directory"
29 SRC=`mktemp -d /tmp/os-${RELEASE}.XXXXXXXXXX`
32 echo "----------------------------------------------------------------------"
33 echo "Remote Source: ${REMOTE_SRC}"
34 echo "Local Source: ${SRC}"
35 echo "Local Dest: ${DST}"
37 echo "------------- Fetching OpenSolaris ${RELEASE} archive ----------------"
38 wget ${REMOTE_SRC} -P ${SRC} ||
39 die "Error 'wget ${REMOTE_SRC}'"
41 echo "------------- Unpacking OperSolaris ${RELEASE} archive ---------------"
42 tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC} ||
43 die "Error 'tar -xjf ${SRC}/on-src.tar.bz2 -C ${SRC}'"
45 SRC_LIB=${SRC}/usr/src/lib
46 SRC_CMD=${SRC}/usr/src/cmd
47 SRC_CM=${SRC}/usr/src/common
48 SRC_UTS=${SRC}/usr/src/uts
49 SRC_UCM=${SRC}/usr/src/uts/common
50 SRC_ZLIB=${SRC}/usr/src/uts/common/fs/zfs
52 DST_LIB=${DST}/zfs/lib
53 DST_CMD=${DST}/zfs/zcmd
58 echo "------------- Updating ZFS from OpenSolaris ${RELEASE} ---------------"
59 echo "* zfs/lib/libavl"
60 mkdir -p ${DST_LIB}/libavl/include/sys/
61 cp ${SRC_CM}/avl/avl.c ${DST_LIB}/libavl/
62 cp ${SRC_UCM}/sys/avl.h ${DST_LIB}/libavl/include/sys/
63 cp ${SRC_UCM}/sys/avl_impl.h ${DST_LIB}/libavl/include/sys/
65 echo "* zfs/lib/libnvpair"
66 mkdir -p ${DST_LIB}/libnvpair/include/sys/
67 cp ${SRC_CM}/nvpair/nvpair.c ${DST_LIB}/libnvpair/
68 cp ${SRC_LIB}/libnvpair/libnvpair.c ${DST_LIB}/libnvpair/
69 cp ${SRC_UCM}/os/nvpair_alloc_system.c ${DST_LIB}/libnvpair/
70 cp ${SRC_CM}/nvpair/nvpair_alloc_fixed.c ${DST_LIB}/libnvpair/
71 cp ${SRC_LIB}/libnvpair/libnvpair.h ${DST_LIB}/libnvpair/include/
72 cp ${SRC_UCM}/sys/nvpair.h ${DST_LIB}/libnvpair/include/sys/
73 cp ${SRC_UCM}/sys/nvpair_impl.h ${DST_LIB}/libnvpair/include/sys/
75 echo "* zfs/lib/libuutil"
76 mkdir -p ${DST_LIB}/libuutil/include/
77 cp ${SRC_LIB}/libuutil/common/*.c ${DST_LIB}/libuutil/
78 cp ${SRC_LIB}/libuutil/common/*.h ${DST_LIB}/libuutil/include/
80 echo "* zfs/lib/libspl"
81 mkdir -p ${DST_LIB}/libspl/include/sys/
82 cp ${SRC_LIB}/libc/port/gen/strlcat.c ${DST_LIB}/libspl/
83 cp ${SRC_LIB}/libc/port/gen/strlcpy.c ${DST_LIB}/libspl/
84 cp ${SRC_LIB}/libc/port/gen/strnlen.c ${DST_LIB}/libspl/
85 cp ${SRC_LIB}/libgen/common/mkdirp.c ${DST_LIB}/libspl/
86 cp ${SRC_CM}/unicode/u8_textprep.c ${DST_LIB}/libspl/
87 cp ${SRC_UCM}/os/list.c ${DST_LIB}/libspl/
88 cp ${SRC_UCM}/sys/list.h ${DST_LIB}/libspl/include/sys/
89 cp ${SRC_UCM}/sys/list_impl.h ${DST_LIB}/libspl/include/sys/
91 echo "* zfs/lib/libzcommon"
92 mkdir -p ${DST_LIB}/libzcommon/include/sys/fs/
93 mkdir -p ${DST_LIB}/libzcommon/include/sys/fm/fs/
94 cp ${SRC_CM}/zfs/*.c ${DST_LIB}/libzcommon/
95 cp ${SRC_CM}/zfs/*.h ${DST_LIB}/libzcommon/include/
96 cp ${SRC_UCM}/sys/fs/zfs.h ${DST_LIB}/libzcommon/include/sys/fs/
97 cp ${SRC_UCM}/sys/fm/fs/zfs.h ${DST_LIB}/libzcommon/include/sys/fm/fs/
99 echo "* zfs/lib/libzpool"
100 mkdir -p ${DST_LIB}/libzpool/include/sys/
101 cp ${SRC_LIB}/libzpool/common/kernel.c ${DST_LIB}/libzpool/
102 cp ${SRC_LIB}/libzpool/common/taskq.c ${DST_LIB}/libzpool/
103 cp ${SRC_LIB}/libzpool/common/util.c ${DST_LIB}/libzpool/
104 #cp ${SRC_LIB}/libzpool/common/sys/zfs_context.h ${DST_LIB}/libzpool/include/sys/
105 cp ${SRC_ZLIB}/*.c ${DST_LIB}/libzpool/
106 cp ${SRC_UTS}/intel/zfs/spa_boot.c ${DST_LIB}/libzpool/
107 cp ${SRC_ZLIB}/sys/*.h ${DST_LIB}/libzpool/include/sys/
108 rm ${DST_LIB}/libzpool/vdev_disk.c
109 rm ${DST_LIB}/libzpool/include/sys/vdev_disk.h
111 echo "* zfs/lib/libzfs"
112 mkdir -p ${DST_LIB}/libzfs/include/
113 cp ${SRC_LIB}/libzfs/common/*.c ${DST_LIB}/libzfs/
114 cp ${SRC_LIB}/libzfs/common/*.h ${DST_LIB}/libzfs/include/
116 echo "* zfs/zcmd/zpool"
117 mkdir -p ${DST_CMD}/zpool
118 cp ${SRC_CMD}/zpool/*.c ${DST_CMD}/zpool/
119 cp ${SRC_CMD}/zpool/*.h ${DST_CMD}/zpool/
121 echo "* zfs/zcmd/zfs"
122 mkdir -p ${DST_CMD}/zfs
123 cp ${SRC_CMD}/zfs/*.c ${DST_CMD}/zfs/
124 cp ${SRC_CMD}/zfs/*.h ${DST_CMD}/zfs/
126 echo "* zfs/zcmd/zdb"
127 mkdir -p ${DST_CMD}/zdb/
128 cp ${SRC_CMD}/zdb/*.c ${DST_CMD}/zdb/
130 echo "* zfs/zcmd/zdump"
131 mkdir -p ${DST_CMD}/zdump
132 cp ${SRC_CMD}/zdump/*.c ${DST_CMD}/zdump/
134 echo "* zfs/zcmd/zinject"
135 mkdir -p ${DST_CMD}/zinject
136 cp ${SRC_CMD}/zinject/*.c ${DST_CMD}/zinject/
137 cp ${SRC_CMD}/zinject/*.h ${DST_CMD}/zinject/
139 echo "* zfs/zcmd/ztest"
140 mkdir -p ${DST_CMD}/ztest
141 cp ${SRC_CMD}/ztest/*.c ${DST_CMD}/ztest/