]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - scripts/zfs-helpers.sh
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]
17 # --sysconfdir=DIR install zfs configuration files [PREFIX/etc]
20 basedir
="$(dirname $0)"
22 SCRIPT_COMMON
=common.sh
23 if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then
24 .
"${basedir}/${SCRIPT_COMMON}"
26 echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
41 Install/remove the ZFS helper utilities.
46 -i Install the helper utilities
47 -r Remove the helper utilities
56 while getopts 'hdirv' OPTION
; do
81 if [ "${INSTALL}" -a "${REMOVE}" ]; then
83 die
"Specify -i or -r but not both"
86 if [ ! "${INSTALL}" -a ! "${REMOVE}" ]; then
88 die
"Either -i or -r must be specified"
91 if [ $
(id
-u) != 0 ]; then
92 die
"Must run as root"
95 if [ "$VERBOSE" ]; then
96 echo "--- Configuration ---"
97 echo "udevdir: $udevdir"
98 echo "udevruledir: $udevruledir"
99 echo "mounthelperdir: $mounthelperdir"
100 echo "sysconfdir: $sysconfdir"
101 echo "DRYRUN: $DRYRUN"
110 echo "Symlink exists: $dst"
111 elif [ -e $dst ]; then
112 echo "File exists: $dst"
113 elif [ ! -e $src ]; then
114 echo "Source missing: $src"
116 msg
"ln -s $src $dst"
118 if [ ! "$DRYRUN" ]; then
119 mkdir
-p $
(dirname $dst) &>/dev
/null
131 rmdir $
(dirname $dst) &>/dev
/null
135 if [ ${INSTALL} ]; then
136 install $CMDDIR/mount_zfs
/mount.zfs
$mounthelperdir/mount.zfs
137 install $CMDDIR/fsck_zfs
/fsck.zfs
$mounthelperdir/fsck.zfs
138 install $CMDDIR/zvol_id
/zvol_id
$udevdir/zvol_id
139 install $CMDDIR/vdev_id
/vdev_id
$udevdir/vdev_id
140 install $UDEVRULEDIR/60-zvol.rules
$udevruledir/60-zvol.rules
141 install $UDEVRULEDIR/69-vdev.rules
$udevruledir/69-vdev.rules
142 install $UDEVRULEDIR/90-zfs.rules
$udevruledir/90-zfs.rules
143 install $CMDDIR/zpool
/zpool.d
$sysconfdir/zfs
/zpool.d
145 remove
$mounthelperdir/mount.zfs
146 remove
$mounthelperdir/fsck.zfs
147 remove
$udevdir/zvol_id
148 remove
$udevdir/vdev_id
149 remove
$udevruledir/60-zvol.rules
150 remove
$udevruledir/69-vdev.rules
151 remove
$udevruledir/90-zfs.rules
152 remove
$sysconfdir/zfs
/zpool.d