diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-09 11:44:52 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-09 11:51:49 +0800 |
commit | 81a13cd6e9c3cbe5806549df8747b12d0f7def49 (patch) | |
tree | c7ad3e21dd883082ef4d2e989236564f2f1039ba /dfly-update | |
parent | 6c54c80c53c817332773ac0f6f99e991b8f3419b (diff) | |
download | dfly-update-81a13cd6e9c3cbe5806549df8747b12d0f7def49.tar.bz2 |
Fold get_vn_devname() into umount_image()
Improve the method to get the device name of the mounted image.
Diffstat (limited to 'dfly-update')
-rwxr-xr-x | dfly-update | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/dfly-update b/dfly-update index c6cfc2d..74bd11e 100755 --- a/dfly-update +++ b/dfly-update @@ -134,23 +134,18 @@ mount_image() { mount -r /dev/${vn}s2a ${mntpnt} || exit ${EC_MOUNT} } -# Get the vn device name of the mounted image -get_vn_devname() { - local mntpnt="$1" - local dev=$(mount | fgrep "${mntpnt}" | cut -d' ' -f 1 | cut -d'/' -f 3) - echo ${dev%s??} -} - -# Umount the image +# Umount the image and unconfigure the underlying VN device # # umount_image(mntpnt) # umount_image() { local mntpnt="$1" - local vn=$(get_vn_devname ${mntpnt}) + local dev vn + dev=$(df | awk '$NF == "'${mntpnt}'" { print $1 }') + vn=${dev#/dev/} umount ${mntpnt} || exit ${EC_UMOUNT} - echo "Disable and unconfigure VN device ${vn} ..." - vnconfig -u ${vn} || exit ${EC_VN} + echo "Unconfigure ${vn} ..." + vnconfig -u "${vn%s??}" || exit ${EC_VN} } # Backup the old kernel |