-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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!
STM32Resources/install.sh
Outdated
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 |
There was a problem hiding this comment.
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.
STM32Resources/install.sh
Outdated
@@ -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) |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
STM32Resources/install.sh
Outdated
@@ -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" |
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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.
STM32Resources/install.sh
Outdated
DISTRO = $(. /etc/os-release; echo $NAME) | ||
|
||
# Install files according to Linux distribution that the user has | ||
if [ "$DISTRO" = "Ubuntu" ]; then |
There was a problem hiding this comment.
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.
Improved PR