1
0

fonctionnalisation - seconde etape

petites modifications
This commit is contained in:
Jybz 2019-10-02 15:48:11 +00:00
parent ad4968f29d
commit 897eeff870

View File

@ -130,7 +130,7 @@ function clean()
else else
warning "${ROOT} does not exists" warning "${ROOT} does not exists"
fi fi
exit 0 return 0
} }
@ -156,8 +156,7 @@ function createchroot()
exit ${ERR_1} exit ${ERR_1}
fi fi
fi fi
return 0
} }
@ -189,6 +188,7 @@ function addmedia()
exit ${ERR_1} exit ${ERR_1}
fi fi
fi fi
return 0
} }
@ -200,6 +200,7 @@ function updatemirror()
error "line ${LINENO} can't update mirrors : exiting" error "line ${LINENO} can't update mirrors : exiting"
exit ${ERR_1} exit ${ERR_1}
fi fi
return 0
} }
@ -239,6 +240,7 @@ function installbasesystem()
error "line ${LINENO} error installing urpmi or locales.fr : exiting" error "line ${LINENO} error installing urpmi or locales.fr : exiting"
exit ${ERR_1} exit ${ERR_1}
fi fi
return 0
} }
@ -282,6 +284,7 @@ function preparechroot()
error "line ${LINENO} error in postPrepareChroot function." error "line ${LINENO} error in postPrepareChroot function."
exit ${ERR_1} exit ${ERR_1}
fi fi
return 0
} }
@ -336,6 +339,7 @@ function jumpchroot()
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway" warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
ERRORN=$((${ERRORN}+1)) ERRORN=$((${ERRORN}+1))
fi fi
return 0
} }
@ -368,6 +372,7 @@ function createImageWrap()
fi fi
formatpartitions ${BOOTFS} ext4 formatpartitions ${BOOTFS} ext4
copyingsystem copyingsystem
return 0
} }
@ -390,6 +395,9 @@ createimage()
exit ${ERR_1} exit ${ERR_1}
fi fi
DEVICE=$(/sbin/losetup -f --show "${INSTALL_PATH}/${IMAGE}") DEVICE=$(/sbin/losetup -f --show "${INSTALL_PATH}/${IMAGE}")
### TODO : Functionnalize
if [ ${TARGET} = "odroid" ]; then if [ ${TARGET} = "odroid" ]; then
info "installing blobs" info "installing blobs"
pushd "${CONFIG_PATH}/sd_fuse" pushd "${CONFIG_PATH}/sd_fuse"
@ -401,6 +409,8 @@ createimage()
fi fi
pushd pushd
fi fi
###
info "making partitions" info "making partitions"
echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE} echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE}
@ -413,6 +423,7 @@ createimage()
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")" info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
BOOTP="${DEVICE}p1" BOOTP="${DEVICE}p1"
ROOTP="${DEVICE}p2" ROOTP="${DEVICE}p2"
return 0
} }
@ -437,6 +448,7 @@ formatpartitions()
info "Boot UUID: ${BOOT_UUID}" 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
} }
@ -469,6 +481,7 @@ copyingsystem()
fi fi
info "making /etc/fstab" 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 /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"
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
@ -480,6 +493,9 @@ copyingsystem()
KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*) KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*)
sed -i -e s/\<FDTDIR\>/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf" sed -i -e s/\<FDTDIR\>/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf"
fi fi
### TODO : Functionnalize
case ${TARGET} in case ${TARGET} in
"rpi") "rpi")
info "copying 10-vchiq-permissions.rules" info "copying 10-vchiq-permissions.rules"
@ -570,6 +586,8 @@ copyingsystem()
#TODO #TODO
;; ;;
esac esac
### END TODO
# info "copying tools in /usr/local/bin/" # info "copying tools in /usr/local/bin/"
# /bin/cp -v --preserve=mode "${SOURCE_PATH}/tools/" "${BUILD_PATH}/usr/local/bin/" # /bin/cp -v --preserve=mode "${SOURCE_PATH}/tools/" "${BUILD_PATH}/usr/local/bin/"
@ -596,6 +614,7 @@ copyingsystem()
exit ${ERR_1} exit ${ERR_1}
fi fi
warning "You can now burn the image ( ${INSTALL_PATH}/${IMAGE} ) on SD card" warning "You can now burn the image ( ${INSTALL_PATH}/${IMAGE} ) on SD card"
return 0
} }
@ -606,6 +625,7 @@ copyingcommon()
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/" rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/" rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
chown root:root "${ROOT}/usr/local/bin/" chown root:root "${ROOT}/usr/local/bin/"
return 0
} }
@ -621,6 +641,7 @@ function postPrepareChroot()
return 1 return 1
} }
ERRORN=0
ERR_1=1 ERR_1=1
ERR_DEFAULT_CONFIG=2 ERR_DEFAULT_CONFIG=2
ERR_NO_CONFIG_FILE=3 ERR_NO_CONFIG_FILE=3