#!/bin/bash

find | rename 's/ /_/g'

all=$(grep -rl "on /lib/live/mount/medium type" .)
total=$(grep -rl "on /lib/live/mount/medium type" . | wc -l)
iso9960=$(grep -rl "^/dev/sr. on /lib/live/mount/medium type iso9660" $all | wc -l)
qemu=$(grep -rl "^QEMU$" $all | wc -l)
vbox=$(grep -rl "^VirtualBox$" $all | wc -l)
vmware=$(grep -rl "^VMware Virtual Platform$" $all | wc -l)
dvd=$(($iso9960-$qemu-$vbox-$vmware))
dd=$(grep -rl "^/dev/sd.. on /lib/live/mount/medium type iso9660" $all | wc -l)
usb=$(grep -rl "^/dev/sd.. on /lib/live/mount/medium type vfat" $all | wc -l)
persistence=$(grep -rl "^TAILS_PERSISTENCE_ENABLED=true$" $all | wc -l)
usb=$(($usb-$persistence))
toram=$(grep -rl "^/dev/shm on /lib/live/mount/medium type tmpfs" $all | wc -l)

echo "| dvd | $dvd | $(($dvd*100/$total))% |"
echo "| dd  | $dd | $(($dd*100/$total))% |"
echo "| usb+persist | $persistence | $(($persistence*100/$total))% |"
echo "| usb-persist | $usb | $(($usb*100/$total))% |"
echo "| toram | $toram | $(($toram*100/$total))% |"
echo "| qemu | $qemu | $(($qemu*100/$total))% |"
echo "| vbox | $vbox | $(($vbox*100/$total))% |"
echo "| vmware | $vmware | $(($vmware*100/$total))% |"
echo "| total | $total | |"
