diff --git a/x230/external_install_bottom.sh b/x230/external_install_bottom.sh index 288c39d..f3077c7 100755 --- a/x230/external_install_bottom.sh +++ b/x230/external_install_bottom.sh @@ -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 diff --git a/x230/external_install_top.sh b/x230/external_install_top.sh index e285e01..c58e9c5 100755 --- a/x230/external_install_top.sh +++ b/x230/external_install_top.sh @@ -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