RainbowHackerHorse / vzvol

vzvol is a general use ZFS zvol management tool, that handles creation, destruction, listing, and formatting with various FSes, in an easy to use single program
BSD 2-Clause "Simplified" License
31 stars 5 forks source link

FreeBSD 11.1: tries to su when it doesn't need to #20

Closed adriaandegroot closed 6 years ago

adriaandegroot commented 6 years ago

When running vzvol as root, the su command should probably be left blank / do nothing, since there's no need to su. Something like this, perhaps:

if [ 0 = $( id -u ) ] ; then
    VZVOL_SU_CMD=sudo_do_nothing
    # Execute the command passed in, with no wrapping
    sudo_do_nothing() {
        "$@"
    }
fi
adriaandegroot commented 6 years ago

.. one (only?) case where this happens is in shared/vzvol_permissions.sh where there's a zfs set custom:fs=none .. command not guarded by a check for ZROOT != root. That's why using a shell-function for su might be better, you can lose the guards elsewhere in the scripts and systematically use $VZVOL_SU_CMD everywhere.

RainbowHackerHorse commented 6 years ago

CLosing as this functionality will be removed shortly to rely only on sudo, and will check if already running as root