From 7d8770cea64a510a0e609748c46720dd1b062a69 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 10 Aug 2011 09:16:03 +0000 Subject: [PATCH] Made releng/manual_isojigdo ready for FreeBSD ("bash" linked to /bin/sh) --- releng/manual_isojigdo | 53 ++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/releng/manual_isojigdo b/releng/manual_isojigdo index 2162d263..9c56b0d8 100755 --- a/releng/manual_isojigdo +++ b/releng/manual_isojigdo @@ -54,7 +54,7 @@ REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/is REMOTE_IMG="debian-testing-i386-businesscard.iso" # check for required items -if [ "${RELENG_XORRISO}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == "" ]; then +if [ "${RELENG_XORRISO}" = "" -o "${RELENG_DIR}" = "" -o "${RELENG_IMG}" = "" ]; then echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are required\n" exit 2 fi @@ -70,7 +70,7 @@ RES="${RELENG_IMG}.iso ${RELENG_IMG}.new ${RELENG_IMG}.md5 ${RELENG_IMG}.jigdo $ # check whether the binary support JTE set +e -RETSTR_VER_JTE=`"${RELENG_XORRISO}" --version 2>/dev/null | grep -P "(libjte\s+in\s+use)"` +RETSTR_VER_JTE=`"${RELENG_XORRISO}" --version 2>/dev/null | grep "libjte * in use"` RETCODE_VER_JTE="$?" set -e case ${RETCODE_VER_JTE} in @@ -89,9 +89,21 @@ esac # grab remote ISO image, to decompose if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then printf "\n${SELF}: Downloading ${REMOTE_URL}/${REMOTE_IMG}\n" - wget --no-check-certificate -T20 -t3 -O \ - "${TMP_DATA_DIR}"/"${REMOTE_IMG}" "${REMOTE_URL}"/"${REMOTE_IMG}" - WGET_RET="$?" + if wget -V >/dev/null 2>&1 + then + wget --no-check-certificate -T20 -t3 \ + -O "${TMP_DATA_DIR}"/"${REMOTE_IMG}" "${REMOTE_URL}"/"${REMOTE_IMG}" + WGET_RET="$?" + elif fetch -T 20 -o "${TMP_DATA_DIR}"/"${REMOTE_IMG}" \ + "${REMOTE_URL}"/"${REMOTE_IMG}" + then + WGET_RET=0 + else + echo + echo "FAIL: ${SELF} : Neither wget nor fetch are present and willing to work" + cleanup + exit 10 + fi case ${WGET_RET} in 0) echo -e "\n${SELF}: Downloading successfully completed.\n" @@ -137,11 +149,15 @@ APPEND_PART="${GEN_DATA_DIR}/fatpart.fat" MKFS_MSDOS="/sbin/mkfs.msdos" if [ -x "${MKFS_MSDOS}" ]; then "${MKFS_MSDOS}" -n Bla -C "${APPEND_PART}" 8192 + APPEND_PART_CMD="-append_partition 2 0x01 ${APPEND_PART}" else - printf "\n${SELF}: Not found: "${MKFS_MSDOS}". Install dosfstools." - printf "\n${SELF}: http://www.daniel-baumann.ch/software/dosfstools/\n" - cleanup - exit 7 + APPEND_PART_CMD= + +# printf "\nFAIL : ${SELF} : Not found: ${MKFS_MSDOS}" +# printf "\n${SELF}: Not found: "${MKFS_MSDOS}". Install dosfstools." +# printf "\n${SELF}: http://www.daniel-baumann.ch/software/dosfstools/\n" +# cleanup +# exit 7 fi # GENERAL section @@ -156,25 +172,32 @@ CMD="${RELENG_XORRISO} \ " # BOOT section -if [ -f "${IMG_EXTRACT_DIR}"/"${RELENG_ISOLINUX_BIN}" -a -f "${ISOHYBRID_MBR}" -a -f "${APPEND_PART}" ]; then -CMD+="\ +if [ -f "${IMG_EXTRACT_DIR}"/"${RELENG_ISOLINUX_BIN}" -a -f "${ISOHYBRID_MBR}" ] +then +CMD="$CMD \ -b ${RELENG_ISOLINUX_BIN} \ -c ${RELENG_BOOT_CAT} \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -isohybrid-mbr ${ISOHYBRID_MBR} \ -partition_offset 16 \ - -append_partition 2 0x01 ${APPEND_PART} \ " else printf "\n${SELF}: FAIL to compose the boot section.\n" cleanup exit 8 fi +if [ -n "${APPEND_PART_CMD}" -a -f "${APPEND_PART}" ]; then +CMD="$CMD \ + ${APPEND_PART_CMD} +" +fi # JIGDO section JIGDO_JIGDO=${GEN_DATA_DIR}/${RELENG_IMG}.jigdo JIGDO_TEMPLATE=${GEN_DATA_DIR}/${RELENG_IMG}.template -JIGDO_MAP_RHV=`readlink -e ${RELENG_DIR}` + +JIGDO_MAP_RHV=$(cd ${RELENG_DIR} 2>/dev/null && pwd) + JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/" # create jigdo MD5 list in base64 format @@ -190,7 +213,7 @@ else exit 9 fi -CMD+="\ +CMD="$CMD \ -jigdo-template-compress gzip \ -checksum_algorithm_iso md5,sha1,sha256,sha512 \ -checksum_algorithm_template md5,sha1,sha256,sha512 \ @@ -201,7 +224,7 @@ CMD+="\ -jigdo-min-file-size 1024 \ " -CMD+="${RELENG_DIR}" +CMD="$CMD ${RELENG_DIR}" # Run the whole compound command echo -e "${SELF}: Creating ISO and jigdo representations:\n$CMD\n"