From caddf529360e3a515729084bb735b3b4e88c112a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 16 Apr 2012 15:59:35 -0400 Subject: [PATCH] signer scripts: use make_temp_dir helper The common code takes care of cleaning up temporary files for us if we use the right helpers. These scripts don't though, so the temp files end up not getting cleaned and over time, /tmp/ files up with crap. The common helper takes care of unmounting and removing, so converting these files over should be safe. BUG=None TEST=`./signer/signer_poller.py -s` signs local images and leaves no /tmp/tmp.* junk Change-Id: I87aa122895997a5ec0017665203fdc8d14e0ab2a Reviewed-on: https://gerrit.chromium.org/gerrit/20329 Reviewed-by: Gaurav Shah Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- scripts/image_signing/remove_test_label.sh | 3 +-- scripts/image_signing/set_lsb_release.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/image_signing/remove_test_label.sh b/scripts/image_signing/remove_test_label.sh index 976f5e6d76..6423e39030 100755 --- a/scripts/image_signing/remove_test_label.sh +++ b/scripts/image_signing/remove_test_label.sh @@ -13,7 +13,6 @@ set -e image=$1 -rootfs=$(mktemp -d) +rootfs=$(make_temp_dir) mount_image_partition ${image} 3 ${rootfs} -trap "umount ${rootfs}; rm -rf ${rootfs}" EXIT sed -i 's/test//' "${rootfs}/etc/lsb-release" diff --git a/scripts/image_signing/set_lsb_release.sh b/scripts/image_signing/set_lsb_release.sh index 3299d5bffb..5d859d8132 100755 --- a/scripts/image_signing/set_lsb_release.sh +++ b/scripts/image_signing/set_lsb_release.sh @@ -47,9 +47,8 @@ EOF exit 1 fi - local rootfs=$(mktemp -d) + local rootfs=$(make_temp_dir) mount_image_partition_ro "$image" 3 "$rootfs" - trap "sudo umount $rootfs; rm -rf $rootfs" EXIT if [ -n "$key" ]; then sudo umount "$rootfs" mount_image_partition "$image" 3 "$rootfs"