From 8c2190b598863265b1a4b27f19959c5db7756295 Mon Sep 17 00:00:00 2001 From: Jybz Date: Sun, 27 Oct 2019 17:42:51 +0000 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'une=20fonction=20de=20d=C3=A9?= =?UTF-8?q?montage,=20d=C3=A9sactive=20le=20split-length=20(DL=20tout)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_arm_img_urpmi.sh | 78 ++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 8e2e17d..891489c 100644 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -69,12 +69,11 @@ function help() echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" } - -# cleaning build space -function clean() +function unmounting() { + title "Unmounting..." + # Unmounting /dev /proc /sys in chroot - title "Cleaning" if ! [ -z "$(mountpoint -qd "${BUILD_PATH}/dev")" ]; then # mountpoint - see if a directory or file is a mountpoint ; -d Show the major/minor numbers of the device that is mounted on the given directory. info "Unmounting ${BUILD_PATH}/dev" umount "${BUILD_PATH}/dev" @@ -99,6 +98,45 @@ function clean() #exit ${ERR_1} fi fi + + # [root@jabztop mageia4arm (master)]# losetup -l -O NAME,BACK-FILE -n +# /dev/loop0 /home/jibz/workspaces/mageia4arm/build/Mageia-7-bananaPro1.img (deleted) + +# # removing loop devices +# for LOOP in $(ls /dev/loop*[0-9]p1); do +# X=${LOOP:0:10} +# if [ -e "${X}" ]; then +# info "removing ${X}" +# partx -d "${X}" # Tell the kernel about the presence and numbering of partitions. +# fi +# done + +# info "Supposed image name : ${IMAGE}" +# info "Looped devices : $(losetup -l -O NAME,BACK-FILE -n)" +# info "Looped devices with this image : $(losetup -l -O NAME,BACK-FILE -n | grep "${IMAGE}" )" + info "Looped devices to unmount : $(losetup -l -O NAME,BACK-FILE -n | grep "${IMAGE}" | cut -d ' ' -f 1 )" + + # removing loop devices +# for LOOP in $(losetup -l -O NAME -n); do +# info "removing ${LOOP}" +# losetup -d "${LOOP}" # Tell the kernel about the presence and numbering of partitions. +# done + + for LOOP in $(losetup -l -O NAME,BACK-FILE -n | grep "${IMAGE}" | cut -d ' ' -f 1 ); do + info "removing ${LOOP}" + losetup -d "${LOOP}" + done + + return 0 +} + +# cleaning build space +function clean() +{ + title "Cleaning" + + unmounting + # Removing old Build directory if [ -d "${BUILD_PATH}" ]; then info "Removing ${BUILD_PATH}" @@ -114,31 +152,6 @@ function clean() warning "${IMAGE} does not exists" fi - -# [root@jabztop mageia4arm (master)]# losetup -l -O NAME,BACK-FILE -n -# /dev/loop0 /home/jibz/workspaces/mageia4arm/build/Mageia-7-bananaPro1.img (deleted) - -# # removing loop devices -# for LOOP in $(ls /dev/loop*[0-9]p1); do -# X=${LOOP:0:10} -# if [ -e "${X}" ]; then -# info "removing ${X}" -# partx -d "${X}" # Tell the kernel about the presence and numbering of partitions. -# fi -# done - - info "Supposed image name : ${IMAGE}" - info "Looped devices : $(losetup -l -O NAME -n)" - info "Looped devices with this image : $(losetup -l -O NAME -n | grep ${IMAGE})" - - # removing loop devices - for LOOP in $(losetup -l -O NAME -n); do - info "removing ${LOOP}" - losetup -d "${LOOP}" # Tell the kernel about the presence and numbering of partitions. - done - - - # Removing boot and root directory if [ -d "${BOOT}" ]; then info "Removing ${BOOT}" @@ -247,17 +260,17 @@ function installbasesystem() fi title "installing basesystem" - /sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 shadow-utils basesystem-minimal + /sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 shadow-utils basesystem-minimal if [ ${?} -ne 0 ]; then error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting" exit ${ERR_1} fi - #/sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 basesystem-minimal + #/sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 basesystem-minimal #if [ ${?} -ne 0 ]; then # error "line ${LINENO} error installing basesystem-minimal : exiting" # exit ${ERR_1} #fi - /sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 urpmi locales-fr systemd u-boot + /sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 urpmi locales-fr systemd u-boot if [ ${?} -ne 0 ]; then error "line ${LINENO} error installing urpmi or locales.fr : exiting" exit ${ERR_1} @@ -915,6 +928,7 @@ case ${OPT} in preparechroot jumpchroot createImageWrap + unmounting ;; "createchroot") createchroot