scripts: Fix latent issues with env.sh

* Ensure shell metacharacters are quoted in RISCV variable assignment.
* Avoid unnecessary expansion of $RISCV and $LD_LIBRARY_PATH at
  generation time.
* Remove undefined usage of $DTCversion.
* Simplify output redirection.
This commit is contained in:
Albert Ou 2019-08-31 02:00:48 -07:00
parent 2c2f5a76e3
commit 9e9e7dd442
1 changed files with 6 additions and 5 deletions

View File

@ -135,13 +135,14 @@ fi
cd "$RDIR" cd "$RDIR"
echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" > env.sh {
echo "export RISCV=$RISCV" >> env.sh echo "export CHIPYARD_TOOLCHAIN_SOURCED=1"
echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh echo "export RISCV=$(printf '%q' "$RISCV")"
echo "export LD_LIBRARY_PATH=$RISCV/lib\${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}" >> env.sh echo "export PATH=\${RISCV}/bin:\${PATH}"
echo "export LD_LIBRARY_PATH=\${RISCV}/lib\${LD_LIBRARY_PATH:+":\${LD_LIBRARY_PATH}"}"
} > env.sh
echo "Toolchain Build Complete!" echo "Toolchain Build Complete!"
if [ "$FASTINSTALL" = "false" ]; then if [ "$FASTINSTALL" = "false" ]; then
# commands that can't run on EC2 (specifically, OpenOCD because of autoconf version_ # commands that can't run on EC2 (specifically, OpenOCD because of autoconf version_
# see if the instance info page exists. if not, we are not on ec2. # see if the instance info page exists. if not, we are not on ec2.