diff options
| author | David M. Syzdek <david@syzdek.net> | 2018-01-27 13:39:43 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2018-01-27 13:39:43 -0900 |
| commit | 08634280aa33b1383389daf0b1cb960462aa4e05 (patch) | |
| tree | c706d95ad4f07e7059cf332248a51ba3af4eb805 | |
| parent | 64e570019a7699738c24dd51dfcff98d0787bbd4 (diff) | |
| download | iperd-08634280aa33b1383389daf0b1cb960462aa4e05.tar.gz iperd-08634280aa33b1383389daf0b1cb960462aa4e05.tar.bz2 iperd-08634280aa33b1383389daf0b1cb960462aa4e05.tar.xz iperd-08634280aa33b1383389daf0b1cb960462aa4e05.zip | |
Adding Makefile and configure support for multiple disk types and disk sizes
Adding Makefile for multiple partition table types and data partition sizes
Changing variables names in configure.sh to have distinct variables for image
size and data partition sizes.
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | src/scripts/configure.sh | 75 |
2 files changed, 44 insertions, 35 deletions
| @@ -159,7 +159,7 @@ NETBOOT ?= $(NETBOOT_HTTP) | |||
| 159 | images/iperdboot.img: $(PREREQ_CNF) $(DOWNLOAD_FILES) $(SCRIPTDIR)/diskimage.sh $(SCRIPTDIR)/thumbdrive.sh | 159 | images/iperdboot.img: $(PREREQ_CNF) $(DOWNLOAD_FILES) $(SCRIPTDIR)/diskimage.sh $(SCRIPTDIR)/thumbdrive.sh |
| 160 | @mkdir -p $$(dirname "$(@)") | 160 | @mkdir -p $$(dirname "$(@)") |
| 161 | @rm -f "$(@)" | 161 | @rm -f "$(@)" |
| 162 | bash ./$(SCRIPTDIR)/diskimage.sh "." "$(@)" | 162 | bash ./$(SCRIPTDIR)/diskimage.sh -t "$(DISKTYPE)" -s "$(DISKSIZE)"." "$(@)" |
| 163 | @touch "$(@)" | 163 | @touch "$(@)" |
| 164 | 164 | ||
| 165 | 165 | ||
| @@ -194,7 +194,7 @@ images/iperdboot.iso: $(DOWNLOAD_FILES) syslinux/isolinux.bin.mod | |||
| 194 | 194 | ||
| 195 | 195 | ||
| 196 | thumbdrive: $(PREREQ_CNF) $(DOWNLOAD_FILES) | 196 | thumbdrive: $(PREREQ_CNF) $(DOWNLOAD_FILES) |
| 197 | bash src/scripts/thumbdrive.sh . "$(DISK)" $(PARTSIZE) | 197 | bash src/scripts/thumbdrive.sh -t "$(DISKTYPE)" -s "$(PARTSIZE)" . "$(DISK)" |
| 198 | 198 | ||
| 199 | 199 | ||
| 200 | images: images/iperdboot.img images/iperdboot.iso | 200 | images: images/iperdboot.img images/iperdboot.iso |
diff --git a/src/scripts/configure.sh b/src/scripts/configure.sh index 5e36b28..43a5ccb 100644 --- a/src/scripts/configure.sh +++ b/src/scripts/configure.sh | |||
| @@ -52,9 +52,14 @@ fi | |||
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | # set missing defaults | 54 | # set missing defaults |
| 55 | CONFIG_USB_PART="${CONFIG_USB_PART:-hybrid}" | 55 | DEFAULT_PART_TYPE="hybrid" |
| 56 | CONFIG_USB_SIZE="${CONFIG_USB_SIZE:-1900}" | 56 | DEFAULT_PART_SIZE="0" |
| 57 | CONFIG_ISO_PART="${CONFIG_ISO_PART:-mbr}" | 57 | DEFAULT_IMG_SIZE="1900" |
| 58 | DEFAULT_ISO_TYPE="bios" | ||
| 59 | CONFIG_PART_TYPE="${CONFIG_PART_TYPE:-${DEFAULT_PART_TYPE}}" | ||
| 60 | CONFIG_PART_SIZE="${CONFIG_PART_SIZE:-${DEFAULT_PART_SIZE}}" | ||
| 61 | CONFIG_IMG_SIZE="${CONFIG_IMG_SIZE:-${DEFAULT_IMG_SIZE}}" | ||
| 62 | CONFIG_ISO_TYPE="${CONFIG_ISO_TYPE:-${DEFAULT_ISO_TYPE}}" | ||
| 58 | 63 | ||
| 59 | 64 | ||
| 60 | # set exit codes to trigger specific xargs exit codes | 65 | # set exit codes to trigger specific xargs exit codes |
| @@ -125,9 +130,10 @@ configure() | |||
| 125 | elif test $RC -eq 0 && test "x${RESULT}" == "xall";then | 130 | elif test $RC -eq 0 && test "x${RESULT}" == "xall";then |
| 126 | configure_all | 131 | configure_all |
| 127 | elif test $RC -eq 0 && test "x${RESULT}" == "xdefaults";then | 132 | elif test $RC -eq 0 && test "x${RESULT}" == "xdefaults";then |
| 128 | CONFIG_USB_PART="hybrid" | 133 | CONFIG_PART_TYPE="${DEFAULT_PART_TYPE}" |
| 129 | CONFIG_USB_SIZE="2048" | 134 | CONFIG_PART_SIZE="${DEFAULT_PART_SIZE}" |
| 130 | CONFIG_ISO_PART="mbr" | 135 | CONFIG_IMG_SIZE="${DEFAULT_IMG_SIZE}" |
| 136 | CONFIG_ISO_TYPE="${DEFAULT_ISO_SIZE}" | ||
| 131 | cat /dev/null > ${CONFIG}.new | 137 | cat /dev/null > ${CONFIG}.new |
| 132 | dialog \ | 138 | dialog \ |
| 133 | --backtitle "IP Engineering Rescue Disk Setup" \ | 139 | --backtitle "IP Engineering Rescue Disk Setup" \ |
| @@ -163,9 +169,10 @@ configure_all() | |||
| 163 | done |awk '{print$1}' |sed -e 's/^/#/g' |sort -n > ${CONFIG}.new.tmp | 169 | done |awk '{print$1}' |sed -e 's/^/#/g' |sort -n > ${CONFIG}.new.tmp |
| 164 | 170 | ||
| 165 | # set variables | 171 | # set variables |
| 166 | echo "CONFIG_USB_PART=${CONFIG_USB_PART}" >> ${CONFIG}.new.tmp | 172 | echo "CONFIG_PART_TYPE=${CONFIG_PART_TYPE}" >> ${CONFIG}.new.tmp |
| 167 | echo "CONFIG_USB_SIZE=${CONFIG_USB_SIZE}" >> ${CONFIG}.new.tmp | 173 | echo "CONFIG_PART_SIZE=${CONFIG_PART_SIZE}" >> ${CONFIG}.new.tmp |
| 168 | echo "CONFIG_ISO_PART=${CONFIG_ISO_PART}" >> ${CONFIG}.new.tmp | 174 | echo "CONFIG_IMG_SIZE=${CONFIG_IMG_SIZE}" >> ${CONFIG}.new.tmp |
| 175 | echo "CONFIG_ISO_TYPE=${CONFIG_ISO_TYPE}" >> ${CONFIG}.new.tmp | ||
| 169 | 176 | ||
| 170 | # copy new settings into place | 177 | # copy new settings into place |
| 171 | mv ${CONFIG}.new.tmp ${CONFIG}.new | 178 | mv ${CONFIG}.new.tmp ${CONFIG}.new |
| @@ -193,9 +200,9 @@ configure_disk() | |||
| 193 | --cancel-label "Back" \ | 200 | --cancel-label "Back" \ |
| 194 | --menu "Select option to configure:" \ | 201 | --menu "Select option to configure:" \ |
| 195 | 20 70 13 \ | 202 | 20 70 13 \ |
| 196 | "usb" "USB partition type (${CONFIG_USB_PART})" \ | 203 | "usb" "USB partition type (${CONFIG_PART_TYPE})" \ |
| 197 | "size" "USB disk image size (${CONFIG_USB_SIZE} MB)" \ | 204 | "size" "USB disk image size (${CONFIG_IMG_SIZE} MB)" \ |
| 198 | "iso" "ISO partition type (${CONFIG_ISO_PART})" \ | 205 | "iso" "ISO partition type (${CONFIG_ISO_TYPE})" \ |
| 199 | 2>&1 1>&3)" | 206 | 2>&1 1>&3)" |
| 200 | RC=$? | 207 | RC=$? |
| 201 | exec 3>&- | 208 | exec 3>&- |
| @@ -206,7 +213,7 @@ configure_disk() | |||
| 206 | return 0; | 213 | return 0; |
| 207 | elif test $RC -eq 0 && test "x${RESULT}" == "xusb";then | 214 | elif test $RC -eq 0 && test "x${RESULT}" == "xusb";then |
| 208 | TMP_GPT=off; TMP_MBR=off; TMP_HYB=off; | 215 | TMP_GPT=off; TMP_MBR=off; TMP_HYB=off; |
| 209 | case "x${CONFIG_USB_PART}" in | 216 | case "x${CONFIG_PART_TYPE}" in |
| 210 | xgpt) TMP_GPT=on;; | 217 | xgpt) TMP_GPT=on;; |
| 211 | xhyb) TMP_HYB=on;; | 218 | xhyb) TMP_HYB=on;; |
| 212 | xmbr) TMP_MBR=on;; | 219 | xmbr) TMP_MBR=on;; |
| @@ -224,19 +231,19 @@ configure_disk() | |||
| 224 | 2>&1 1>&3)" | 231 | 2>&1 1>&3)" |
| 225 | RC=$? | 232 | RC=$? |
| 226 | exec 3>&- | 233 | exec 3>&- |
| 227 | CONFIG_USB_PART="${RESULT}" | 234 | CONFIG_PART_TYPE="${RESULT}" |
| 228 | elif test $RC -eq 0 && test "x${RESULT}" == "xsize";then | 235 | elif test $RC -eq 0 && test "x${RESULT}" == "xsize";then |
| 229 | exec 3>&1 | 236 | exec 3>&1 |
| 230 | RESULT="$(echo "" | xargs dialog \ | 237 | RESULT="$(echo "" | xargs dialog \ |
| 231 | --title " USB Disk Image Size " \ | 238 | --title " USB Disk Image Size " \ |
| 232 | --backtitle "IP Engineering Rescue Disk Setup" \ | 239 | --backtitle "IP Engineering Rescue Disk Setup" \ |
| 233 | --inputbox "Enter size of disk image file:" \ | 240 | --inputbox "Enter size of disk image file:" \ |
| 234 | 9 40 ${CONFIG_USB_SIZE} \ | 241 | 9 40 ${CONFIG_IMG_SIZE} \ |
| 235 | 2>&1 1>&3)" | 242 | 2>&1 1>&3)" |
| 236 | RC=$? | 243 | RC=$? |
| 237 | exec 3>&- | 244 | exec 3>&- |
| 238 | if test -z "${RESULT//[0-9]/}";then | 245 | if test -z "${RESULT//[0-9]/}";then |
| 239 | CONFIG_USB_SIZE=$RESULT | 246 | CONFIG_IMG_SIZE=$RESULT |
| 240 | else | 247 | else |
| 241 | dialog \ | 248 | dialog \ |
| 242 | --backtitle "IP Engineering Rescue Disk Setup" \ | 249 | --backtitle "IP Engineering Rescue Disk Setup" \ |
| @@ -244,12 +251,12 @@ configure_disk() | |||
| 244 | 7 40 | 251 | 7 40 |
| 245 | fi | 252 | fi |
| 246 | elif test $RC -eq 0 && test "x${RESULT}" == "xiso";then | 253 | elif test $RC -eq 0 && test "x${RESULT}" == "xiso";then |
| 247 | TMP_GPT=off; TMP_MBR=off; TMP_HYB=off; | 254 | TMP_UEFI=off; TMP_HYBRID=off; TMP_BIOS=off; |
| 248 | case "x${CONFIG_ISO_PART}" in | 255 | case "x${CONFIG_ISO_TYPE}" in |
| 249 | xgpt) TMP_GPT=on;; | 256 | xuefi) TMP_UEFI=on;; |
| 250 | xhyb) TMP_HYB=on;; | 257 | xhybrid) TMP_HYBRID=on;; |
| 251 | xmbr) TMP_MBR=on;; | 258 | xbios) TMP_BIOS=on;; |
| 252 | *) TMP_MBR=on;; | 259 | *) TMP_BIOS=on;; |
| 253 | esac | 260 | esac |
| 254 | exec 3>&1 | 261 | exec 3>&1 |
| 255 | RESULT="$(echo "" | xargs dialog \ | 262 | RESULT="$(echo "" | xargs dialog \ |
| @@ -257,13 +264,13 @@ configure_disk() | |||
| 257 | --backtitle "IP Engineering Rescue Disk Setup" \ | 264 | --backtitle "IP Engineering Rescue Disk Setup" \ |
| 258 | --radiolist "Choose ISO image type:" \ | 265 | --radiolist "Choose ISO image type:" \ |
| 259 | 20 70 13 \ | 266 | 20 70 13 \ |
| 260 | "gpt" "GUID Partition Table (UEFI)" ${TMP_GPT} \ | 267 | "uefi" "GUID Partition Table (UEFI)" ${TMP_UEFI} \ |
| 261 | "hybrid" "Hybrid (GPT and MBR)" ${TMP_HYB} \ | 268 | "hybrid" "Hybrid (GPT and MBR)" ${TMP_HYBRID} \ |
| 262 | "mbr" "Master Boot Record (Legacy BIOS)" ${TMP_MBR} \ | 269 | "bios" "Master Boot Record (Legacy BIOS)" ${TMP_BIOS} \ |
| 263 | 2>&1 1>&3)" | 270 | 2>&1 1>&3)" |
| 264 | RC=$? | 271 | RC=$? |
| 265 | exec 3>&- | 272 | exec 3>&- |
| 266 | CONFIG_ISO_PART="${RESULT}" | 273 | CONFIG_ISO_TYPE="${RESULT}" |
| 267 | fi | 274 | fi |
| 268 | done | 275 | done |
| 269 | } | 276 | } |
| @@ -358,16 +365,17 @@ configure_image() | |||
| 358 | deps() | 365 | deps() |
| 359 | { | 366 | { |
| 360 | # save variables | 367 | # save variables |
| 361 | for STR in "CONFIG_USB_PART" "CONFIG_USB_SIZE" "CONFIG_ISO_PART";do | 368 | for STR in "CONFIG_PART_TYPE" "CONFIG_IMG_SIZE" "CONFIG_ISO_TYPE";do |
| 362 | egrep "^${STR}=" "${CONFIG}.new" > /dev/null | 369 | egrep "^${STR}=" "${CONFIG}.new" > /dev/null |
| 363 | if test $? -ne 0;then | 370 | if test $? -ne 0;then |
| 364 | echo "${STR}=" >> "${CONFIG}.new" | 371 | echo "${STR}=" >> "${CONFIG}.new" |
| 365 | fi | 372 | fi |
| 366 | done | 373 | done |
| 367 | sed \ | 374 | sed \ |
| 368 | -e "s/^CONFIG_ISO_PART=.*$/CONFIG_ISO_PART=${CONFIG_ISO_PART}/g" \ | 375 | -e "s/^CONFIG_ISO_TYPE=.*$/CONFIG_ISO_TYPE=${CONFIG_ISO_TYPE}/g" \ |
| 369 | -e "s/^CONFIG_USB_PART=.*$/CONFIG_USB_PART=${CONFIG_USB_PART}/g" \ | 376 | -e "s/^CONFIG_IMG_SIZE=.*$/CONFIG_IMG_SIZE=${CONFIG_IMG_SIZE}/g" \ |
| 370 | -e "s/^CONFIG_USB_SIZE=.*$/CONFIG_USB_SIZE=${CONFIG_USB_SIZE}/g" \ | 377 | -e "s/^CONFIG_PART_TYPE=.*$/CONFIG_PART_TYPE=${CONFIG_PART_TYPE}/g" \ |
| 378 | -e "s/^CONFIG_PART_SIZE=.*$/CONFIG_PART_SIZE=${CONFIG_PART_SIZE}/g" \ | ||
| 371 | "${CONFIG}.new" \ | 379 | "${CONFIG}.new" \ |
| 372 | > "${CONFIG}.new.tmp" | 380 | > "${CONFIG}.new.tmp" |
| 373 | mv "${CONFIG}.new.tmp" "${CONFIG}.new" | 381 | mv "${CONFIG}.new.tmp" "${CONFIG}.new" |
| @@ -378,9 +386,10 @@ deps() | |||
| 378 | # build Makefile configuration | 386 | # build Makefile configuration |
| 379 | rm -f ${BASEDIR}/Makefile.config | 387 | rm -f ${BASEDIR}/Makefile.config |
| 380 | { | 388 | { |
| 381 | echo "ISOTYPE ?= ${CONFIG_ISO_PART}" | 389 | echo "ISOTYPE ?= ${CONFIG_ISO_TYPE}" |
| 382 | echo "PARTTYPE ?= ${CONFIG_USB_PART}" | 390 | echo "DISKSIZE ?= ${CONFIG_IMG_SIZE}" |
| 383 | echo "PARTSIZE ?= ${CONFIG_USB_SIZE}M" | 391 | echo "DISKTYPE ?= ${CONFIG_PART_TYPE}" |
| 392 | echo "PARTSIZE ?= ${CONFIG_PART_SIZE}" | ||
| 384 | for DISTRO in $(egrep '^#[[:alnum:]]+-' "${CONFIG}" |cut -d- -f1 |cut -d'#' -f2 |sort |uniq);do | 393 | for DISTRO in $(egrep '^#[[:alnum:]]+-' "${CONFIG}" |cut -d- -f1 |cut -d'#' -f2 |sort |uniq);do |
| 385 | if test -f "${DISTRODIR}/${DISTRO}/make.header";then | 394 | if test -f "${DISTRODIR}/${DISTRO}/make.header";then |
| 386 | cat "${DISTRODIR}/${DISTRO}/make.header" | 395 | cat "${DISTRODIR}/${DISTRO}/make.header" |
