diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 5d9141c..224296c 100644 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -103,7 +103,7 @@ function clean() warning "${BUILD_PATH} does not exists" fi # removing old image - if [ -e "${IMAGE}" ]; then + if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then info "Removing ${IMAGE}" /bin/rm -f "${INSTALL_PATH}/${IMAGE}" else @@ -476,18 +476,32 @@ copyingsystem() #echo -e "proc /proc proc defaults 0 0\nUUID=${BOOT_UUID} /mnt/arm_boot vfat defaults 0 0\nUUID=${ROOT_UUID} / ext4 defaults 0 0" > "${BUILD_PATH}/etc/fstab" echo -e "proc\t/proc\tproc\tdefaults\t0\t0\nUUID=${BOOT_UUID}\t/mnt/arm_boot\t${BOOTFS}\tdefaults\t0\t0\nUUID=${ROOT_UUID}\t/\text4\tdefaults\t0\t0" > "${BUILD_PATH}/etc/fstab" - if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then - info "making /boot/extlinux/extlinux.conf" - rm -rf "${BUILD_PATH}/boot/extlinux" - mkdir -p "${BUILD_PATH}/boot/extlinux" - fi - if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then - sed -e s/\/${ROOT_UUID}/g ${CONFIG_PATH}/extlinux.conf >"${BUILD_PATH}/boot/extlinux/extlinux.conf" - KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*) - sed -i -e s/\/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf" + + if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then + if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then + info "making /boot/extlinux/extlinux.conf" + /bin/rm -rf "${BUILD_PATH}/boot/extlinux" + mkdir -p "${BUILD_PATH}/boot/extlinux" + fi + if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then + sed -e s/\/${ROOT_UUID}/g ${CONFIG_PATH}/extlinux.conf >"${BUILD_PATH}/boot/extlinux/extlinux.conf" + KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*) + sed -i -e s/\/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf" + fi fi + /bin/rm -f "${BUILD_PATH}/second_stage_install.sh" + + ARM_BOOT="${BUILD_PATH}/mnt/arm_boot" + if ! [ -d "${ARM_BOOT}" ]; then + mkdir -p "${ARM_BOOT}" + fi + info "copying Mageia image to root partition" + /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/" + copyingCustomSystem if [ ${?} -ne 0 ]; then error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ." @@ -505,6 +519,10 @@ copyingsystem() copyingcommon # Syncing devices before unmounting /usr/bin/sync + +# warning "Inspect files and press a touch to continue." +# read -n1 GARBAGE + /usr/bin/umount "${BOOT}" "${ROOT}" if [ ${?} -eq 0 ]; then /bin/rmdir "${BOOT}" "${ROOT}" @@ -518,6 +536,16 @@ copyingsystem() error "line ${LINENO} warning : error unmounting ${DEVICE} " exit ${ERR_1} fi + + #Add : seems that there is still the looped device attached. + #warning "try to detach looped device" + #Previous device + #info "${DEVICE}" + #Retrieve the new device number : + #DEVICE=$(/sbin/losetup -f --show "${INSTALL_PATH}/${IMAGE}") + #info "device to detach ${DEVICE}" + #/sbin/losetup -d "${DEVICE}" + warning "You can now burn the image ( ${INSTALL_PATH}/${IMAGE} ) on SD card" return 0 } @@ -764,7 +792,7 @@ info "Option: "${OPT} IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}${TARGET_VERSION}.img" BOOT="/mnt/boot" ROOT="/mnt/root" -BUILD_PATH="${INSTALL_PATH}/build" +BUILD_PATH="${INSTALL_PATH}/build-${TARGET}${TARGET_VERSION}" ARM_VERSION="armv7hl" # Assigne a script for creating a particular target image (rpi, odroid, ...) @@ -782,7 +810,7 @@ info "Firmware path : ${FIRMWARE_PATH}" info "Firmware dir : ${FIRMWARE_DIR}" # Defining default image size to 7 go -if [[ "${IMAGE_SIZE}" -lt 7 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then +if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then IMAGE_SIZE=7 fi @@ -816,7 +844,7 @@ case ${OPT} in ;; "all") verify_disk_space - if [ ${?} -eq 1 ]; then + if [ ${?} -ne 0 ]; then echo -e "Not enough space on disk\nDo you want to continue anyway ? [Y,n]" read yn if [ ${yn} = "n" ]; then @@ -845,7 +873,7 @@ case ${OPT} in ;; "createimage") verify_disk_space - if [ ${?} -eq 1 ]; then + if [ ${?} -ne 0 ]; then warning "Not enough space on disk" exit ${ERR_NO_SPACE} fi @@ -857,7 +885,7 @@ case ${OPT} in esac -if ! [ -z ${ERRORN} ]; then +if [ ${ERRORN} -ne 0 ]; then warning "Some errors occurs : ${ERRORN} errors" fi