3 # This script is designed to facilitate in-tree development and testing
4 # by installing symlinks on your system which refer to in-tree helper
5 # utilities. These helper utilities must be installed to in order to
6 # exercise all ZFS functionality. By using symbolic links and keeping
7 # the scripts in-tree during development they can be easily modified
8 # and those changes tracked.
10 # Use the following configuration option to override the installation
11 # paths for these scripts. The correct path is automatically set for
12 # most distributions but you can optionally set it for your environment.
14 # --with-mounthelperdir=DIR install mount.zfs in dir [/sbin]
15 # --with-udevdir=DIR install udev helpers [default=check]
16 # --with-udevruledir=DIR install udev rules [default=UDEVDIR/rules.d]
19 basedir="$(dirname $0)"
21 SCRIPT_COMMON=common.sh
22 if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then
23 . "${basedir}/${SCRIPT_COMMON}"
25 echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
40 Install/remove the ZFS helper utilities.
45 -i Install the helper utilities
46 -r Remove the helper utilities
55 while getopts 'hdirv' OPTION; do
80 if [ "${INSTALL}" -a "${REMOVE}" ]; then
82 die "Specify -i or -r but not both"
85 if [ ! "${INSTALL}" -a ! "${REMOVE}" ]; then
87 die "Either -i or -r must be specified"
90 if [ $(id -u) != 0 ]; then
91 die "Must run as root"
94 if [ "$VERBOSE" ]; then
95 echo "--- Configuration ---"
96 echo "udevdir: $udevdir"
97 echo "udevruledir: $udevruledir"
98 echo "mounthelperdir: $mounthelperdir"
99 echo "DRYRUN: $DRYRUN"
108 echo "Symlink exists: $dst"
109 elif [ -e $dst ]; then
110 echo "File exists: $dst"
111 elif [ ! -e $src ]; then
112 echo "Source missing: $src"
114 msg "ln -s $src $dst"
116 if [ ! "$DRYRUN" ]; then
131 if [ ${INSTALL} ]; then
132 install $CMDDIR/mount_zfs/mount.zfs $mounthelperdir/mount.zfs
133 install $CMDDIR/fsck_zfs/fsck.zfs $mounthelperdir/fsck.zfs
134 install $CMDDIR/zvol_id/zvol_id $udevdir/zvol_id
135 install $CMDDIR/vdev_id/vdev_id $udevdir/vdev_id
136 install $UDEVRULEDIR/60-zvol.rules $udevruledir/60-zvol.rules
137 install $UDEVRULEDIR/69-vdev.rules $udevruledir/69-vdev.rules
138 install $UDEVRULEDIR/90-zfs.rules $udevruledir/90-zfs.rules
140 remove $mounthelperdir/mount.zfs
141 remove $mounthelperdir/fsck.zfs
142 remove $udevdir/zvol_id
143 remove $udevdir/vdev_id
144 remove $udevruledir/60-zvol.rules
145 remove $udevruledir/69-vdev.rules
146 remove $udevruledir/90-zfs.rules