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

Rzayevan/stm32f11e installationguide #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rzayevan
Copy link

Improved PR

Copy link
Contributor

@enochtsang enochtsang left a comment

Choose a reason for hiding this comment

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

Just that change then I think we can merge it!

echo "export PATH=\$PATH:/opt/stlink/build" >> ~/.profile
export PATH=$PATH:/opt/stlink/build
if [ "$(. /etc/os-release; echo $NAME)" = "Ubuntu" ]; then
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/stlink/build" >> ~/.profile
Copy link
Contributor

Choose a reason for hiding this comment

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

For all these if else statements, it could be simplified by just setting a variable for the bash_profile file.

if Ubuntu, then
    BASH_PROFILE="~/.profile
elseif Fedora, then
    BASH_PROFILE=~/.bash_rc
fi

Something like that. Then just reference that variable for all your other calls.

@enochtsang enochtsang self-assigned this Feb 22, 2018
@@ -6,7 +6,27 @@ if [[ $UID != 0 ]]; then
exit 1
fi

apt-get -y install build-essential git libsane:i386 ia32-libs-multiarch autoconf libusb-1.0-0-dev lib32ncurses5 libncurses5:i386 software-properties-common pkg-config cmake
# Determine what distribution of Linux the user has
DISTRO = $(. /etc/os-release; echo $NAME)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work? I think bash script variables can't have spaces around the equal sign. Regardless, that's the norm so it should be written that way :)

Copy link
Author

Choose a reason for hiding this comment

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

Whoops, I pushed the wrong file haha. I'll update the if statements and push again.

@@ -34,7 +60,12 @@ if ! type "CubeMX2Makefile" > /dev/null; then
echo "ABS_PATH=\"\$(readlink -f \$1)\"" >> /usr/local/bin/CubeMX2Makefile
echo "(cd /opt/CubeMX2Makefile && python CubeMX2Makefile.py \$ABS_PATH)" >> /usr/local/bin/CubeMX2Makefile
chmod +x /usr/local/bin/CubeMX2Makefile
echo "export PATH=\$PATH:/opt/CubeMX2Makefile" >> ~/.profile
if [ "$DISTRO" = "Ubuntu" ]; then
BASH_PROFILE = "~./profile"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just set this once at the top of the file and keep reusing it. No need for the same if statements.

export PATH=$PATH:/opt/stlink/build
cp ~/.bashrc /root/
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to use the $BASH_PROFILE var.

DISTRO = $(. /etc/os-release; echo $NAME)

# Install files according to Linux distribution that the user has
if [ "$DISTRO" = "Ubuntu" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

These if statements are a good place to set the BASH_PROFILE var.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants