include/ui/console.h: Delete is_surface_bgr()
[qemu/ar7.git] / tests / acceptance / virtiofs_submounts.py.data / cleanup.sh
blob2a6579a0fea6cf7333252aa72f82a20f558853d1
1 #!/bin/bash
3 function print_usage()
5 if [ -n "$2" ]; then
6 echo "Error: $2"
7 echo
8 fi
9 echo "Usage: $1 <scratch dir>"
12 scratch_dir=$1
13 if [ -z "$scratch_dir" ]; then
14 print_usage "$0" 'Scratch dir not given' >&2
15 exit 1
18 cd "$scratch_dir/share" || exit 1
19 mps=(mnt*)
20 mp_i=0
21 for mp in "${mps[@]}"; do
22 mp_i=$((mp_i + 1))
23 printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}"
25 sudo umount -R "$mp"
26 rm -rf "$mp"
27 done
28 echo
30 rm some-file
31 cd ..
32 rmdir share
34 imgs=(fs*.img)
35 img_i=0
36 for img in "${imgs[@]}"; do
37 img_i=$((img_i + 1))
38 printf "Detaching and deleting %i/%i...\r" "$img_i" "${#imgs[@]}"
40 dev=$(losetup -j "$img" | sed -e 's/:.*//')
41 sudo losetup -d "$dev"
42 rm -f "$img"
43 done
44 echo
46 echo 'Done.'