add choice specific boot partition or not
This commit is contained in:
parent
e1e23ae057
commit
bac0e2e1e2
@ -412,8 +412,12 @@ createimage()
|
||||
info "New attached device ${DEVICE}"
|
||||
info "partitions list:"
|
||||
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
|
||||
BOOTP="${DEVICE}p1"
|
||||
ROOTP="${DEVICE}p2"
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
BOOTP="${DEVICE}p1"
|
||||
ROOTP="${DEVICE}p2"
|
||||
else
|
||||
ROOTP="${DEVICE}p1"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -421,13 +425,18 @@ createimage()
|
||||
formatpartitions()
|
||||
{
|
||||
info "Formatting partitions"
|
||||
info "Boot : ${BOOTP} as ${1}"
|
||||
"/sbin/mkfs.${1}" "${BOOTP}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error formating ${BOOTP} : exiting"
|
||||
/sbin/losetup -d "${DEVICE}"
|
||||
exit ${ERR_1}
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
info "Boot : ${BOOTP} as ${1}"
|
||||
"/sbin/mkfs.${1}" "${BOOTP}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error formating ${BOOTP} : exiting"
|
||||
/sbin/losetup -d "${DEVICE}"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
BOOT_UUID=$(blkid -s UUID -o value UUID "${BOOTP}")
|
||||
info "Boot UUID: ${BOOT_UUID}"
|
||||
fi
|
||||
|
||||
info "Root : ${ROOTP} as ${2}"
|
||||
"/sbin/mkfs.${2}" "${ROOTP}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
@ -435,10 +444,9 @@ formatpartitions()
|
||||
/sbin/losetup -d "${DEVICE}"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
BOOT_UUID=$(blkid -s UUID -o value UUID "${BOOTP}")
|
||||
info "Boot UUID: ${BOOT_UUID}"
|
||||
ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}")
|
||||
info "Root UUID: ${ROOT_UUID}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -446,13 +454,22 @@ formatpartitions()
|
||||
copyingsystem()
|
||||
{
|
||||
info "mounting partitions, making mountpoint if necessary"
|
||||
if ! [ -d "${BOOT}" ]; then
|
||||
/bin/mkdir "${BOOT}"
|
||||
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
if ! [ -d "${BOOT}" ]; then
|
||||
/bin/mkdir "${BOOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
/bin/mount "${BOOTP}" "${BOOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
||||
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ -d "${ROOT}" ]; then
|
||||
/bin/mkdir "${ROOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
@ -460,11 +477,6 @@ copyingsystem()
|
||||
exit ${ERR_1}
|
||||
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}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error mounting ${ROOTP} : exiting"
|
||||
@ -474,8 +486,12 @@ copyingsystem()
|
||||
info "making /etc/fstab"
|
||||
### 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\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"
|
||||
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"
|
||||
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 [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
||||
@ -493,14 +509,20 @@ copyingsystem()
|
||||
|
||||
/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}"
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||
if ! [ -d "${ARM_BOOT}" ]; then
|
||||
rm -rf "${ARM_BOOT}"
|
||||
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}/"
|
||||
else
|
||||
info "copying Mageia image to root partition"
|
||||
/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||
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
|
||||
@ -523,11 +545,20 @@ copyingsystem()
|
||||
# warning "Inspect files and press a touch to continue."
|
||||
# read -n1 GARBAGE
|
||||
|
||||
/usr/bin/umount "${BOOT}" "${ROOT}"
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
/usr/bin/umount "${BOOT}"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
/bin/rmdir "${BOOT}"
|
||||
else
|
||||
error "line ${LINENO} error unmounting ${BOOT}: exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
/usr/bin/umount "${ROOT}"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
/bin/rmdir "${BOOT}" "${ROOT}"
|
||||
/bin/rmdir "${ROOT}"
|
||||
else
|
||||
error "line ${LINENO} error unmounting ${ROOT} or ${BOOT} : exiting"
|
||||
error "line ${LINENO} error unmounting ${ROOT}: exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
|
||||
@ -599,6 +630,7 @@ ERR_7=7
|
||||
ERR_8=8
|
||||
ERR_9=9
|
||||
|
||||
SEPARATE_BOOT_PARTITION=1
|
||||
|
||||
#######################
|
||||
# PROGRAMM START HERE #
|
||||
|
Reference in New Issue
Block a user