From ed1511441ccf7fc3da35c94597106bd8b8f8d50a Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 4 Oct 2015 20:44:47 +0200 Subject: [PATCH 1/2] interactive test test --- hashboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hashboot b/hashboot index c5d5358..18c3f8b 100755 --- a/hashboot +++ b/hashboot @@ -71,7 +71,7 @@ then #If not found, create one and ask for ${MBR_DEVICE} else #Create ${CONFIG_FILE} with defaults if noninterctive - if [ -z "$PS1" ] + if [ -t "0" ] then echo "#Device with the MBR on it" > ${CONFIG_FILE} echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE} From 709d478fe0d3bf358685665c21e030b134f41fe8 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 4 Oct 2015 20:47:15 +0200 Subject: [PATCH 2/2] interactive test fix --- hashboot | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hashboot b/hashboot index 18c3f8b..6a45a01 100755 --- a/hashboot +++ b/hashboot @@ -73,11 +73,6 @@ else #Create ${CONFIG_FILE} with defaults if noninterctive if [ -t "0" ] then - echo "#Device with the MBR on it" > ${CONFIG_FILE} - echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE} - echo "#Where the Backup files are stored" >> ${CONFIG_FILE} - echo "BACKUP_FILE=${BACKUP_FILE}" >> ${CONFIG_FILE} - else echo -n "Which device contains the MBR? [/dev/sda] " read -r MBR_DEVICE [ -z "${MBR_DEVICE}" ] && MBR_DEVICE="/dev/sda" @@ -89,6 +84,11 @@ else [ -z "${BACKUP_FILE}" ] && BACKUP_FILE="/var/cache/boot-backup.tar.gz" echo "#Where the Backup files are stored" >> ${CONFIG_FILE} echo "BACKUP_FILE=${BACKUP_FILE}" >> ${CONFIG_FILE} + else + echo "#Device with the MBR on it" > ${CONFIG_FILE} + echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE} + echo "#Where the Backup files are stored" >> ${CONFIG_FILE} + echo "BACKUP_FILE=${BACKUP_FILE}" >> ${CONFIG_FILE} fi fi