From 897eeff87092b57e81132ce30b1f6055a513a390 Mon Sep 17 00:00:00 2001 From: Jybz Date: Wed, 2 Oct 2019 15:48:11 +0000 Subject: [PATCH] fonctionnalisation - seconde etape petites modifications --- create_arm_img_urpmi.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 75fff6e..6fe9dff 100644 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -130,7 +130,7 @@ function clean() else warning "${ROOT} does not exists" fi - exit 0 + return 0 } @@ -156,8 +156,7 @@ function createchroot() exit ${ERR_1} fi fi - - + return 0 } @@ -189,6 +188,7 @@ function addmedia() exit ${ERR_1} fi fi + return 0 } @@ -200,6 +200,7 @@ function updatemirror() error "line ${LINENO} can't update mirrors : exiting" exit ${ERR_1} fi + return 0 } @@ -239,6 +240,7 @@ function installbasesystem() error "line ${LINENO} error installing urpmi or locales.fr : exiting" exit ${ERR_1} fi + return 0 } @@ -282,6 +284,7 @@ function preparechroot() error "line ${LINENO} error in postPrepareChroot function." exit ${ERR_1} fi + return 0 } @@ -336,6 +339,7 @@ function jumpchroot() warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway" ERRORN=$((${ERRORN}+1)) fi + return 0 } @@ -368,6 +372,7 @@ function createImageWrap() fi formatpartitions ${BOOTFS} ext4 copyingsystem + return 0 } @@ -390,6 +395,9 @@ createimage() exit ${ERR_1} fi DEVICE=$(/sbin/losetup -f --show "${INSTALL_PATH}/${IMAGE}") + + ### TODO : Functionnalize + if [ ${TARGET} = "odroid" ]; then info "installing blobs" pushd "${CONFIG_PATH}/sd_fuse" @@ -401,6 +409,8 @@ createimage() fi pushd fi + + ### info "making partitions" echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE} @@ -413,6 +423,7 @@ createimage() info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")" BOOTP="${DEVICE}p1" ROOTP="${DEVICE}p2" + return 0 } @@ -437,6 +448,7 @@ formatpartitions() info "Boot UUID: ${BOOT_UUID}" ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}") info "Root UUID: ${ROOT_UUID}" + return 0 } @@ -469,6 +481,7 @@ copyingsystem() fi 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" if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then @@ -480,6 +493,9 @@ copyingsystem() KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*) sed -i -e s/\/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf" fi + + ### TODO : Functionnalize + case ${TARGET} in "rpi") info "copying 10-vchiq-permissions.rules" @@ -570,6 +586,8 @@ copyingsystem() #TODO ;; esac + + ### END TODO # info "copying tools in /usr/local/bin/" # /bin/cp -v --preserve=mode "${SOURCE_PATH}/tools/" "${BUILD_PATH}/usr/local/bin/" @@ -596,6 +614,7 @@ copyingsystem() exit ${ERR_1} fi 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}/tools/"*.sh "${ROOT}/usr/local/bin/" chown root:root "${ROOT}/usr/local/bin/" + return 0 } @@ -621,6 +641,7 @@ function postPrepareChroot() return 1 } +ERRORN=0 ERR_1=1 ERR_DEFAULT_CONFIG=2 ERR_NO_CONFIG_FILE=3