#!/bin/bash
if [ "$EUID" -ne 0 ]
- then echo "Please run as root"
+ then echo "Please run as root using 'sudo bash'"
exit
fi
+# this is a bit of a cheat, by relying on debian to pull in all the
+# build dependencies. saves time researching how to get and list them
+# by hand.
apt-get update -y
apt-get build-dep yosys -y
apt-get remove yosys -y
-cd $SUDO_USER/home
-mkdir hdl_tools
+mkdir -p /home/$SUDO_USER/src
+cd /home/$SUDO_USER/src
+mkdir -p hdl_tools
cd hdl_tools
git clone https://github.com/cliffordwolf/yosys.git
make -j$(nproc)
make install
-cd $SUDO_USER/home/hdl_tools
-chown -R $SUDO_USER hdl_tools
-chgrp -R $SUDO_USER hdl_tools
+cd /home/$SUDO_USER/src/hdl_tools
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .