Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue #238 and #239 #244

Merged
merged 2 commits into from
Apr 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

if [ "`whoami`" = "root" ]
then
echo "Running the script as root. Not permitted"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to say Running the script as root is not permitted.

exit 1
fi

GIT_REPO=https://github.com/timvideos/HDMI2USB-misoc-firmware.git
if [ -z "$GIT_BRANCH" ]; then
GIT_BRANCH=master
Expand All @@ -19,8 +25,8 @@ if ! git help > /dev/null 2>&1; then
fi

if [ -e HDMI2USB-misoc-firmware ]; then
cd HDMI2USB-misoc-firmware
git pull || exit 1
echo "Existing checkout found (see HDMI2USB-misoc-firmware directory), please remove before running."
exit 1
else
git clone --recurse-submodules $GIT_REPO || exit 1
cd HDMI2USB-misoc-firmware
Expand All @@ -30,7 +36,7 @@ fi
yn=y
#read -p "Need to install packages as root. Continue? (y/n) " yn
if [ "$yn" = "y" -o "$yn" = "Y" -o -z "$yn" ]; then
sudo ./scripts/get-env-root.sh || exit 1
sudo -E ./scripts/get-env-root.sh || exit 1
else
echo "Aborting.."
exit 1
Expand Down
6 changes: 6 additions & 0 deletions scripts/flash-hdmi2usb.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

if [ "`whoami`" = "root" ]
then
echo "Running the script as root. Not permitted"
exit 1
fi

set -e

SETUP_SRC=$(realpath ${BASH_SOURCE[@]})
Expand Down
17 changes: 16 additions & 1 deletion scripts/get-env-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ apt-get install -y iverilog gtkwave
# Nothing needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole script is designed to be run as root.

Maybe it should check that it is running as root and suggest using sudo otherwise?


# libfpgalink

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script should not be interactive.

Could this be in bootstrap.sh instead?

Shouldn't http_proxy and https_proxy already be set in your environment? Does the "sudo -E" above fix the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are already set in my environment sudo -E will fix the problem. If we assume that proxy variables are already set then we dont need to prompt for proxy.

while true; do
read -p "Are you working under a proxy server? (yes/no) " yn
case $yn in
[Yy]* ) echo "Enter the proxy site and port number"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indenting here is weird.

read -p "Enter the proxy adress : " siteproxy
read -p "Enter port number : " portnumber
export http_proxy=http://$siteproxy:$portnumber
export https_proxy=https://$siteproxy:$portnumber
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done

sudo apt-get install -y libreadline-dev libusb-1.0-0-dev libftdi-dev python-yaml fxload

# Load custom udev rules
Expand All @@ -40,7 +55,7 @@ sudo apt-get install -y libreadline-dev libusb-1.0-0-dev libftdi-dev python-yaml

# Get the vizzini module needed for the Atlys board
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:timvideos/fpga-support
sudo -E add-apt-repository -y ppa:timvideos/fpga-support
sudo apt-get update
sudo apt-get install -y vizzini-dkms
sudo apt-get install -y ixo-usb-jtag
6 changes: 6 additions & 0 deletions scripts/get-env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

if [ "`whoami`" = "root" ]
then
echo "Running the script as root. Not permitted"
exit 1
fi

CALLED=$_
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 || SOURCED=0

Expand Down
6 changes: 6 additions & 0 deletions scripts/setup-env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

if [ "`whoami`" = "root" ]
then
echo "Running the script as root. Not permitted"
exit 1
fi

CALLED=$_
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 || SOURCED=0

Expand Down
6 changes: 6 additions & 0 deletions scripts/view-hdmi2usb.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/sh

if [ "`whoami`" = "root" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one shouldn't matter running as root.

then
echo "Running the script as root. Not permitted"
exit 1
fi

I=0
while true; do
echo
Expand Down