From 9fecc3a6ee80c9ea2758947e72894b2ece54d894 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 23 Mar 2023 09:10:00 +0530 Subject: fix : livevm: wrong path to create qcow2 img, get rid of die, dont cat to grep --- .local/bin/livevm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.local/bin/livevm b/.local/bin/livevm index 638386b..79f7ed6 100755 --- a/.local/bin/livevm +++ b/.local/bin/livevm @@ -2,16 +2,15 @@ data_dir="${XDG_DATA_HOME:-${HOME}/.local/share}/vm" storage="${data_dir}/livevm.qcow2" - # allocate half of available memory and cores to vm -mem="$(($(cat /proc/meminfo | grep MemAvailable | grep -o '[0-9]*')/2))" +mem="$(($(grep MemAvailable /proc/meminfo | grep -o '[0-9]*')/2))" cores="$(($(nproc)/2))" cmd="qemu-system-x86_64 -boot menu=on -enable-kvm -device intel-hda -device hda-duplex -m ${mem}k -cpu host -smp $cores -drive file=$storage" [ ! -d "${data_dir}" ] && mkdir -p "${data_dir}" [ ! -f "$storage" ] && - qemu-img create -f qcow2 livevm.img 30G + qemu-img create -f qcow2 "$storage" 30G while getopts "wehc:d:" f do @@ -45,10 +44,11 @@ do -c [cdrom] -d [drive] EOF + exit ;; ?) - echo "usage: ${0##*/} [ -weh ] [ -c cdrom ] [ -d drive ]" + printf "%s\n" "usage: ${0##*/} [ -weh ] [ -c cdrom ] [ -d drive ]" 1>&2 exit 1 ;; esac -- cgit v1.2.3