1
0

Création d'une fonction de démontage, désactive le split-length (DL tout)

This commit is contained in:
Jybz 2019-10-27 17:42:51 +00:00
parent 4057597197
commit 8c2190b598

View File

@ -69,12 +69,11 @@ function help()
echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
} }
function unmounting()
# cleaning build space
function clean()
{ {
title "Unmounting..."
# Unmounting /dev /proc /sys in chroot # 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. 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" info "Unmounting ${BUILD_PATH}/dev"
umount "${BUILD_PATH}/dev" umount "${BUILD_PATH}/dev"
@ -99,6 +98,45 @@ function clean()
#exit ${ERR_1} #exit ${ERR_1}
fi fi
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 # Removing old Build directory
if [ -d "${BUILD_PATH}" ]; then if [ -d "${BUILD_PATH}" ]; then
info "Removing ${BUILD_PATH}" info "Removing ${BUILD_PATH}"
@ -114,31 +152,6 @@ function clean()
warning "${IMAGE} does not exists" warning "${IMAGE} does not exists"
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 -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 # Removing boot and root directory
if [ -d "${BOOT}" ]; then if [ -d "${BOOT}" ]; then
info "Removing ${BOOT}" info "Removing ${BOOT}"
@ -247,17 +260,17 @@ function installbasesystem()
fi fi
title "installing basesystem" 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 if [ ${?} -ne 0 ]; then
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting" error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
exit ${ERR_1} exit ${ERR_1}
fi 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 #if [ ${?} -ne 0 ]; then
# error "line ${LINENO} error installing basesystem-minimal : exiting" # error "line ${LINENO} error installing basesystem-minimal : exiting"
# exit ${ERR_1} # exit ${ERR_1}
#fi #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 if [ ${?} -ne 0 ]; then
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}
@ -915,6 +928,7 @@ case ${OPT} in
preparechroot preparechroot
jumpchroot jumpchroot
createImageWrap createImageWrap
unmounting
;; ;;
"createchroot") "createchroot")
createchroot createchroot