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 "New attached device ${DEVICE}"
|
||||||
info "partitions list:"
|
info "partitions list:"
|
||||||
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
|
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
|
||||||
BOOTP="${DEVICE}p1"
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
ROOTP="${DEVICE}p2"
|
BOOTP="${DEVICE}p1"
|
||||||
|
ROOTP="${DEVICE}p2"
|
||||||
|
else
|
||||||
|
ROOTP="${DEVICE}p1"
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,13 +425,18 @@ createimage()
|
|||||||
formatpartitions()
|
formatpartitions()
|
||||||
{
|
{
|
||||||
info "Formatting partitions"
|
info "Formatting partitions"
|
||||||
info "Boot : ${BOOTP} as ${1}"
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
"/sbin/mkfs.${1}" "${BOOTP}"
|
info "Boot : ${BOOTP} as ${1}"
|
||||||
if [ ${?} -ne 0 ]; then
|
"/sbin/mkfs.${1}" "${BOOTP}"
|
||||||
error "line ${LINENO} error formating ${BOOTP} : exiting"
|
if [ ${?} -ne 0 ]; then
|
||||||
/sbin/losetup -d "${DEVICE}"
|
error "line ${LINENO} error formating ${BOOTP} : exiting"
|
||||||
exit ${ERR_1}
|
/sbin/losetup -d "${DEVICE}"
|
||||||
|
exit ${ERR_1}
|
||||||
|
fi
|
||||||
|
BOOT_UUID=$(blkid -s UUID -o value UUID "${BOOTP}")
|
||||||
|
info "Boot UUID: ${BOOT_UUID}"
|
||||||
fi
|
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,13 +454,22 @@ formatpartitions()
|
|||||||
copyingsystem()
|
copyingsystem()
|
||||||
{
|
{
|
||||||
info "mounting partitions, making mountpoint if necessary"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
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"
|
#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 [ -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"
|
||||||
|
|
||||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
if ! [ -d "${ARM_BOOT}" ]; then
|
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||||
mkdir -p "${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
|
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
|
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
|
||||||
|
/bin/rmdir "${BOOT}"
|
||||||
|
else
|
||||||
|
error "line ${LINENO} error unmounting ${BOOT}: exiting"
|
||||||
|
exit ${ERR_1}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
/usr/bin/umount "${ROOT}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/bin/rmdir "${BOOT}" "${ROOT}"
|
/bin/rmdir "${ROOT}"
|
||||||
else
|
else
|
||||||
error "line ${LINENO} error unmounting ${ROOT} or ${BOOT} : exiting"
|
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 #
|
||||||
|
Reference in New Issue
Block a user