install_linux_fw_sd: expand variables when setting bootcmd to avoid redefining them

The setting of 'bootcmd' in the script was done using single quotes, which
doesn't expand variables. As a consequence the following variables must
be defined again (during the execution of the second part of the script):
 - mmcdev
 - INSTALL_LINUX_FILENAME
 - INSTALL_ROOTFS_FILENAME

This patch changes the single quotes with double quotes, so that these
variables are expanded during the setting of 'bootcmd' with the values
assigned at the begining of the installation script (notice these are
not dynamically generated so there is no risk to expand them).

At the same time we need to escape with a backslash:
 - double quotes containing strings
 - variables that we don't want to expand (like the return value $?)

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2016-07-06 13:32:37 +02:00
parent 052775a34c
commit a32cea139b
1 changed files with 35 additions and 38 deletions

View File

@ -106,58 +106,55 @@ fi
# - Update the 'linux' partition # - Update the 'linux' partition
# - Update the 'rootfs' partition # - Update the 'rootfs' partition
# - Reset the system and let it boot # - Reset the system and let it boot
setenv bootcmd ' setenv bootcmd "
env default -a; env default -a;
saveenv; saveenv;
setenv mmcdev 0; echo \"\";
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat; echo \"\";
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4; echo \">> Creating Linux partition table on the eMMC\";
echo ""; echo \"\";
echo ""; echo \"\";
echo ">> Creating Linux partition table on the eMMC";
echo "";
echo "";
run partition_mmc_linux; run partition_mmc_linux;
if test $? -eq 1; then if test \$? -eq 1; then
echo "[ERROR] Failed to create Linux partition table!"; echo \"[ERROR] Failed to create Linux partition table!\";
echo ""; echo \"\";
echo "Aborted."; echo \"Aborted.\";
exit; exit;
fi; fi;
echo ""; echo \"\";
echo ""; echo \"\";
echo ">> Installing Linux kernel and device tree files"; echo \">> Installing Linux kernel and device tree files\";
echo ""; echo \"\";
echo ""; echo \"\";
update linux mmc 1 fat ${INSTALL_LINUX_FILENAME}; update linux mmc 1 fat ${INSTALL_LINUX_FILENAME};
if test $? -eq 1; then if test \$? -eq 1; then
echo "[ERROR] Failed to update linux partition!"; echo \"[ERROR] Failed to update linux partition!\";
echo ""; echo \"\";
echo "Aborted."; echo \"Aborted.\";
exit; exit;
fi; fi;
echo ""; echo \"\";
echo ""; echo \"\";
echo ">> Installing Linux root file system"; echo \">> Installing Linux root file system\";
echo ""; echo \"\";
echo ""; echo \"\";
update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME}; update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME};
if test $? -eq 1; then if test \$? -eq 1; then
echo "[ERROR] Failed to update rootfs partition!"; echo \"[ERROR] Failed to update rootfs partition!\";
echo ""; echo \"\";
echo "Aborted."; echo \"Aborted.\";
exit; exit;
fi; fi;
echo ""; echo \"\";
echo "#######################"; echo \"#######################\";
echo "# Install complete! #"; echo \"# Install complete! #\";
echo "#######################"; echo \"#######################\";
echo ""; echo \"\";
sleep 1; sleep 1;
echo ">> Restarting the system"; echo \">> Restarting the system\";
sleep 1; sleep 1;
reset; reset;
' "
saveenv saveenv
reset reset