1
0

add choice specific boot partition or not

This commit is contained in:
Jybz 2019-10-08 14:13:45 +00:00
parent e1e23ae057
commit bac0e2e1e2

View File

@ -412,8 +412,12 @@ createimage()
info "New attached device ${DEVICE}" info "New attached device ${DEVICE}"
info "partitions list:" info "partitions list:"
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")" info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
BOOTP="${DEVICE}p1" BOOTP="${DEVICE}p1"
ROOTP="${DEVICE}p2" ROOTP="${DEVICE}p2"
else
ROOTP="${DEVICE}p1"
fi
return 0 return 0
} }
@ -421,6 +425,7 @@ createimage()
formatpartitions() formatpartitions()
{ {
info "Formatting partitions" info "Formatting partitions"
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
info "Boot : ${BOOTP} as ${1}" info "Boot : ${BOOTP} as ${1}"
"/sbin/mkfs.${1}" "${BOOTP}" "/sbin/mkfs.${1}" "${BOOTP}"
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
@ -428,6 +433,10 @@ formatpartitions()
/sbin/losetup -d "${DEVICE}" /sbin/losetup -d "${DEVICE}"
exit ${ERR_1} exit ${ERR_1}
fi fi
BOOT_UUID=$(blkid -s UUID -o value UUID "${BOOTP}")
info "Boot UUID: ${BOOT_UUID}"
fi
info "Root : ${ROOTP} as ${2}" info "Root : ${ROOTP} as ${2}"
"/sbin/mkfs.${2}" "${ROOTP}" "/sbin/mkfs.${2}" "${ROOTP}"
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
@ -435,10 +444,9 @@ formatpartitions()
/sbin/losetup -d "${DEVICE}" /sbin/losetup -d "${DEVICE}"
exit ${ERR_1} exit ${ERR_1}
fi fi
BOOT_UUID=$(blkid -s UUID -o value UUID "${BOOTP}")
info "Boot UUID: ${BOOT_UUID}"
ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}") ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}")
info "Root UUID: ${ROOT_UUID}" info "Root UUID: ${ROOT_UUID}"
return 0 return 0
} }
@ -446,6 +454,8 @@ formatpartitions()
copyingsystem() copyingsystem()
{ {
info "mounting partitions, making mountpoint if necessary" info "mounting partitions, making mountpoint if necessary"
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
if ! [ -d "${BOOT}" ]; then if ! [ -d "${BOOT}" ]; then
/bin/mkdir "${BOOT}" /bin/mkdir "${BOOT}"
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
@ -453,6 +463,13 @@ copyingsystem()
exit ${ERR_1} exit ${ERR_1}
fi fi
fi fi
/bin/mount "${BOOTP}" "${BOOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BOOTP} : exiting"
exit ${ERR_1}
fi
fi
if ! [ -d "${ROOT}" ]; then if ! [ -d "${ROOT}" ]; then
/bin/mkdir "${ROOT}" /bin/mkdir "${ROOT}"
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
@ -460,11 +477,6 @@ copyingsystem()
exit ${ERR_1} exit ${ERR_1}
fi fi
fi fi
/bin/mount "${BOOTP}" "${BOOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BOOTP} : exiting"
exit ${ERR_1}
fi
/bin/mount "${ROOTP}" "${ROOT}" /bin/mount "${ROOTP}" "${ROOT}"
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${ROOTP} : exiting" error "line ${LINENO} error mounting ${ROOTP} : exiting"
@ -474,8 +486,12 @@ copyingsystem()
info "making /etc/fstab" info "making /etc/fstab"
### BUG : /mnt/arm_boot is set to vfat for all plateforms, odroid configuration says ext4. ### BUG : /mnt/arm_boot is set to vfat for all plateforms, odroid configuration says ext4.
#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 /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 [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
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" 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"
else
echo -e "proc\t/proc\tproc\tdefaults\t0\t0\nUUID=${ROOT_UUID}\t/\text4\tdefaults\t0\t0" > "${BUILD_PATH}/etc/fstab"
fi
if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
@ -493,14 +509,20 @@ copyingsystem()
/bin/rm -f "${BUILD_PATH}/second_stage_install.sh" /bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot" ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
if ! [ -d "${ARM_BOOT}" ]; then if ! [ -d "${ARM_BOOT}" ]; then
rm -rf "${ARM_BOOT}"
mkdir -p "${ARM_BOOT}" mkdir -p "${ARM_BOOT}"
fi fi
info "copying Mageia image to root partition" info "copying Mageia image to root partition"
/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/" /bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
else
info "copying Mageia image to root partition"
/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
fi
copyingCustomSystem copyingCustomSystem
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
@ -523,11 +545,20 @@ copyingsystem()
# warning "Inspect files and press a touch to continue." # warning "Inspect files and press a touch to continue."
# read -n1 GARBAGE # read -n1 GARBAGE
/usr/bin/umount "${BOOT}" "${ROOT}" if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
/usr/bin/umount "${BOOT}"
if [ ${?} -eq 0 ]; then if [ ${?} -eq 0 ]; then
/bin/rmdir "${BOOT}" "${ROOT}" /bin/rmdir "${BOOT}"
else else
error "line ${LINENO} error unmounting ${ROOT} or ${BOOT} : exiting" error "line ${LINENO} error unmounting ${BOOT}: exiting"
exit ${ERR_1}
fi
fi
/usr/bin/umount "${ROOT}"
if [ ${?} -eq 0 ]; then
/bin/rmdir "${ROOT}"
else
error "line ${LINENO} error unmounting ${ROOT}: exiting"
exit ${ERR_1} exit ${ERR_1}
fi fi
@ -599,6 +630,7 @@ ERR_7=7
ERR_8=8 ERR_8=8
ERR_9=9 ERR_9=9
SEPARATE_BOOT_PARTITION=1
####################### #######################
# PROGRAMM START HERE # # PROGRAMM START HERE #