this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement `diskutil eject` as a wrapper around `hdiutil detach`

+68
+2
src/CMakeLists.txt
··· 370 370 371 371 add_subdirectory(clt) 372 372 373 + add_subdirectory(diskutil) 374 + 373 375 # Just a stub 374 376 add_subdirectory(WebKit) 375 377 add_subdirectory(OpenGL)
+8
src/diskutil/CMakeLists.txt
··· 1 + project(diskutil) 2 + 3 + install(FILES diskutil DESTINATION libexec/darling/usr/sbin 4 + PERMISSIONS 5 + OWNER_READ OWNER_WRITE OWNER_EXECUTE 6 + GROUP_READ GROUP_EXECUTE 7 + WORLD_READ WORLD_EXECUTE 8 + )
+58
src/diskutil/diskutil
··· 1 + #!/bin/sh 2 + 3 + # helper functions 4 + 5 + # errcho - a variant of echo that prints to stderr 6 + errcho() { 7 + >&2 echo $@ 8 + } 9 + 10 + # subcommands 11 + 12 + eject() { 13 + if [ "$#" -lt 1 ]; then 14 + errcho "Usage: diskutil eject MountPoint|DiskIdentifier|DeviceNode" 15 + exit 1 16 + fi 17 + 18 + DISK_PATH=$1 19 + shift; 20 + 21 + if [ ! -e "$DISK_PATH" ]; then 22 + errcho "Unable to find disk for $DISK_PATH" 23 + exit 1 24 + fi 25 + 26 + if ! hdiutil detach "$DISK_PATH" > /dev/null 2>&1; then 27 + errcho "Unmount of $DISK_PATH failed: at least one volume could not be unmounted" 28 + exit 1 29 + fi 30 + 31 + echo "Disk $DISK_PATH ejected" 32 + } 33 + 34 + if [ "$#" -lt 1 ]; then 35 + >&2 cat <<- 'EOF' 36 + Disk Utility Tool 37 + Utility to manage local disks and volumes 38 + Most commands require an administrator or root user 39 + 40 + WARNING: Most destructive operations are not prompted 41 + 42 + eject (Eject a disk) 43 + EOF 44 + exit 1 45 + fi 46 + 47 + VERB="$1" 48 + shift; 49 + 50 + case "$VERB" in 51 + eject) 52 + eject $@ 53 + ;; 54 + *) 55 + errcho "diskutil: did not recognize verb \"$VERB\"; type \"diskutil\" for a list" 56 + exit 1 57 + ;; 58 + esac