Browse Source

x230: improve temporary directory creation

Fixes #31
pull/35/head
Martin Kepplinger 6 years ago
parent
commit
6a36939e20
2 changed files with 13 additions and 10 deletions
  1. +7
    -6
      x230/external_install_bottom.sh
  2. +6
    -4
      x230/external_install_top.sh

+ 7
- 6
x230/external_install_bottom.sh View File

@ -83,6 +83,7 @@ done
command -v flashrom >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install flashrom and run as root${NC}."; exit 1; }
command -v make >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install make and a C compiler${NC}."; exit 1; }
command -v mktemp >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install mktemp (coreutils)${NC}."; exit 1; }
if [ ! "$have_flasher" -gt 0 ] ; then
echo "Skulls for the X230"
@ -123,6 +124,12 @@ else
fi
TEMP_DIR=`mktemp -d`
if [ ! -d "$TEMP_DIR" ]; then
echo -e "${RED}Error:${NC} Could not create temp dir"
rm -rf ${TEMP_DIR}
exit 1
fi
if [ ! "$have_chipname" -gt 0 ] ; then
echo "trying to detect the chip..."
flashrom -p ${programmer} &> ${TEMP_DIR}/chips || true
@ -184,12 +191,6 @@ if [ "$me_clean" -gt 0 ] ; then
fi
echo "Start reading 2 times. Please be patient..."
if [[ ! "$TEMP_DIR" || ! -d "$TEMP_DIR" ]]; then
echo -e "${RED}Error:${NC} Could not create temp dir"
rm -rf ${TEMP_DIR}
exit 1
fi
flashrom -p ${programmer} -c ${CHIPNAME} -r ${TEMP_DIR}/test1.rom
flashrom -p ${programmer} -c ${CHIPNAME} -r ${TEMP_DIR}/test2.rom
cmp --silent ${TEMP_DIR}/test1.rom ${TEMP_DIR}/test2.rom


+ 6
- 4
x230/external_install_top.sh View File

@ -76,6 +76,7 @@ do
done
command -v flashrom >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install flashrom and run as root${NC}."; exit 1; }
command -v mktemp >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install mktemp (coreutils)${NC}."; exit 1; }
if [ ! "$have_input_image" -gt 0 ] ; then
image_available=$(ls -1 | grep x230_coreboot_seabios || true)
@ -141,6 +142,11 @@ else
fi
TEMP_DIR=`mktemp -d`
if [ ! -d "$TEMP_DIR" ]; then
echo "${RED}Error:${NC} Could not create temp dir"
exit 1
fi
if [ ! "$have_chipname" -gt 0 ] ; then
echo "trying to detect the chip..."
flashrom -p ${programmer} &> ${TEMP_DIR}/chips || true
@ -178,10 +184,6 @@ if [ ! "$INPUT_IMAGE_SIZE" -eq "$reference_filesize" ] ; then
fi
echo "verifying SPI connection by reading 2 times. please wait."
if [[ ! "$TEMP_DIR" || ! -d "$TEMP_DIR" ]]; then
echo "Could not create temp dir"
exit 1
fi
flashrom -p ${programmer} -c ${CHIPNAME} -r ${TEMP_DIR}/test1.rom
flashrom -p ${programmer} -c ${CHIPNAME} -r ${TEMP_DIR}/test2.rom
cmp --silent ${TEMP_DIR}/test1.rom ${TEMP_DIR}/test2.rom


Loading…
Cancel
Save