From c1260aac1547c97f31c590bfa384d1418228c49a Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Wed, 15 Jan 2020 14:14:54 -0800 Subject: remove tmp files when finished Currently there are tmp files left after the script is run. This keeps track of the files and deletes them when exiting. Signed-of-by: Brian Woods Reviewed-by: Stefano Stabellini --- scripts/uboot-script-gen | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 2232f7a..bb9ee36 100644 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -3,6 +3,15 @@ offset=$((2*1024*1024)) filesize=0 prog_req=(mkimage file) +tmp_files=() + +function remove_tmp_files() +{ + for i in "${tmp_files[@]}" + do + rm -f "$i" + done +} function add_device_tree_kernel() { @@ -125,6 +134,7 @@ function check_compressed_file_type() if test $? == 0 then local tmp=`mktemp` + tmp_files+=($tmp) cat $filename | gunzip > $tmp filename=$tmp fi @@ -275,6 +285,8 @@ echo "setenv fdt_high 0xffffffffffffffff" >> $UBOOT_SOURCE echo "booti $xen_addr - $device_tree_addr" >> $UBOOT_SOURCE mkimage -A arm64 -T script -C none -a $uboot_addr -e $uboot_addr -d $UBOOT_SOURCE "$UBOOT_SCRIPT" &> /dev/null +remove_tmp_files + memaddr=$(( $MEMORY_END - $memaddr - $offset )) if test $memaddr -lt 0 then -- cgit v1.2.3