Skip to content

Commit

Permalink
sh: fix nonroot setup script
Browse files Browse the repository at this point in the history
Search nemu.cfg in .config/nemu
  • Loading branch information
0x501D committed Oct 4, 2023
1 parent 3cd88b2 commit c19380a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sh/setup_nemu_nonroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,22 @@ else
echo "Couldn't find user home directory" >&2
exit 1
fi
if [ ! -f ${USER_DIR}/.nemu.cfg ]; then
echo "Couldn't find .nemu.cfg in user home directory" >&2

NEMU_CFG=""
if [ -f "${USER_DIR}/.nemu.cfg" ]; then
NEMU_CFG="${USER_DIR}/.nemu.cfg"
elif [ -f "${USER_DIR}/.config/nemu/nemu.cfg" ]; then
NEMU_CFG="${USER_DIR}/.config/nemu/nemu.cfg"
fi

if [ -z $NEMU_CFG ]; then
echo "Couldn't find nemu.cfg in user home directory" >&2
exit 1
fi

QEMU_BIN_PATH=$(grep '^qemu_bin_path' ${USER_DIR}/.nemu.cfg | awk '{ printf "%s\n", $3 }')
QEMU_BIN_PATH=$(grep '^qemu_bin_path' $NEMU_CFG | awk '{ printf "%s\n", $3 }')
if [ -z "$QEMU_BIN_PATH" ]; then
echo "Couldn't get qemu_bin_path from .nemu.cfg" >&2
echo "Couldn't get qemu_bin_path from ${NEMU_CFG}" >&2
exit 1
fi
fi
Expand Down

0 comments on commit c19380a

Please sign in to comment.