#!/bin/sh ########################################################################### # # Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file usb_mount.sh # # @author (last) Behrouz NematiPour # @date (last) 15-Jan-2025 # @author (original) Behrouz NematiPour # @date (original) 15-Jan-2025 # ############################################################################ # Description # Trys to unmount the given usb device from the usb drive/location. # Parameters # $1: usb device full path # $2: usb drive full path (mount point) # Retruns # No specific response # Considerations # No specific considerations. # sources . ./_errors_ . ./_functions_ # variables PARAM_COUNT=2 USB_DEVICE="$(trim "$1")" USB_FOLDER="$(trim "$2")" # functions # checks check_param_count "$#" "$PARAM_COUNT" check_empty_string "$USB_DEVICE" "$ERR_MTPARAM_USB_DEVICE" check_empty_string "$USB_FOLDER" "$ERR_MTPARAM_USB_FOLDER" sudo umount "$USB_FOLDER" check_result "$?" "$ERR_CMDFAIL_USB_DEVICE_UMOUNT" rmdir "$USB_FOLDER" check_result "$?" "$ERR_CMDFAIL_USB_FOLDER_REMOVE" sleep 0.1 echo "" exit 0