qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

guest-cleanup.sh (464B)


      1 #!/bin/bash
      2 
      3 function print_usage()
      4 {
      5     if [ -n "$2" ]; then
      6         echo "Error: $2"
      7         echo
      8     fi
      9     echo "Usage: $1 <scratch dir>"
     10 }
     11 
     12 scratch_dir=$1
     13 if [ -z "$scratch_dir" ]; then
     14     print_usage "$0" 'Scratch dir not given' >&2
     15     exit 1
     16 fi
     17 
     18 cd "$scratch_dir/share" || exit 1
     19 
     20 mps=(mnt*)
     21 mp_i=0
     22 for mp in "${mps[@]}"; do
     23     mp_i=$((mp_i + 1))
     24     printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}"
     25 
     26     sudo umount -R "$mp"
     27 done
     28 echo
     29 
     30 echo 'Done.'