1
1
mirror of https://schlomp.space/tastytea/hashboot synced 2024-11-16 14:37:06 +01:00

fallback cfg when non interactive

This commit is contained in:
xor 2015-10-04 20:20:02 +02:00
parent 46c4c77bbe
commit ec48450ac3

@ -70,17 +70,26 @@ then
[ $? != 0 ] && die 9 "Error reading config file" [ $? != 0 ] && die 9 "Error reading config file"
#If not found, create one and ask for ${MBR_DEVICE} #If not found, create one and ask for ${MBR_DEVICE}
else else
echo -n "Which device contains the MBR? [/dev/sda] " if [ -z "$PS1" ]
read -r MBR_DEVICE then
[ -z "${MBR_DEVICE}" ] && MBR_DEVICE="/dev/sda" echo "#Device with the MBR on it" > ${CONFIG_FILE}
echo "#Device with the MBR on it" > ${CONFIG_FILE} MBR_DEVICE="/dev/sda"
echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE} echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE}
else
echo "#Where the Backup files are stored" >> ${CONFIG_FILE}
echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE}
echo -n "Which device contains the MBR? [/dev/sda] "
read -r MBR_DEVICE
[ -z "${MBR_DEVICE}" ] && MBR_DEVICE="/dev/sda"
echo "#Device with the MBR on it" > ${CONFIG_FILE}
echo "MBR_DEVICE=${MBR_DEVICE}" >> ${CONFIG_FILE}
echo -n "Where should backupfile be stored?" echo -n "Where should backupfile be stored?"
read -r BACKUP_FILE read -r BACKUP_FILE
[ -z "${BACKUP_FILE}" ] && BACKUP_FILE="/var/cache/boot-backup.tar.gz" [ -z "${BACKUP_FILE}" ] && BACKUP_FILE="/var/cache/boot-backup.tar.gz"
echo "#Where the Backup files are stored" >> ${CONFIG_FILE} echo "#Where the Backup files are stored" >> ${CONFIG_FILE}
echo "BACKUP_FILE=${BACKUP_FILE}" >> ${CONFIG_FILE} echo "BACKUP_FILE=${BACKUP_FILE}" >> ${CONFIG_FILE}
fi
fi fi
# Find out where the first partition starts and set ${MBR_SIZE} in KiB # Find out where the first partition starts and set ${MBR_SIZE} in KiB