scripts

Scripts for general automations
git clone git://git.laack.co/scripts.git
Log | Files | Refs

vm-manager.sh (1174B)


      1 #!/bin/bash
      2 
      3 OPTIONS=$(find ~/vms -mindepth 1 -maxdepth 1 -type f)
      4 
      5 if [ $# -eq 0 ]; then
      6     SELECTION=$(echo "$OPTIONS" | fzf)
      7 else
      8 
      9     prompt="vm:"
     10 
     11     dmenu_cmd="dmenu -p \"$prompt\""
     12     SELECTION=$(echo "$OPTIONS" | eval "$dmenu_cmd")
     13 fi
     14 
     15 if [[ -n "$SELECTION" ]]; then
     16     if [ -n "$(hostnamectl | grep brgr)" ] ; then
     17 
     18         # brgr has 48gb of ddr4 ram
     19         # bought this before everyone went crazy with RAM prices :)
     20         
     21         qemu-system-x86_64 "$SELECTION" \
     22             -cpu host \
     23             -enable-kvm \
     24             -smp 4 \
     25             -audiodev pa,id=snd0 -device intel-hda -device hda-output,audiodev=snd0 \
     26             -m 24G
     27     else
     28 
     29         # laptop only has 16gb (from like 5 years ago too)
     30         # this seems like a sane default for running most things
     31         # reasonably well.
     32         #
     33         # No, I do not support the apple idea of 8gb being the new
     34         # 16gb, that's just marketing nonsense.
     35 
     36         qemu-system-x86_64 "$SELECTION" \
     37             -cpu host \
     38             -enable-kvm \
     39             -smp 4 \
     40             -audiodev pa,id=snd0 -device intel-hda -device hda-output,audiodev=snd0 \
     41             -m 8G
     42     fi
     43 fi