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.
@@ -135,13 +135,14 @@ fi
cd "$RDIR"
-echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" > env.sh
-echo "export RISCV=$RISCV" >> env.sh
-echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh
-echo "export LD_LIBRARY_PATH=$RISCV/lib\${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}" >> env.sh
+{
+ echo "export CHIPYARD_TOOLCHAIN_SOURCED=1"
+ echo "export RISCV=$(printf '%q' "$RISCV")"
+ 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!"
-
if [ "$FASTINSTALL" = "false" ]; then
# 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.
