From 405759719751fe85032b9c3b0c1a4b8c5c010ca2 Mon Sep 17 00:00:00 2001 From: Jybz Date: Sun, 27 Oct 2019 15:08:49 +0000 Subject: [PATCH] Rectification skel, clean, rm ${BOOT}&${ROOT} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skel supprime les fichiers par défaut du paquet rootfiles dont le .bashrc et la variable PATH contenant /usr/sbin. Clean démontait les partitions avec une regex dans la commande ls, qui ne gère pas les regex. Méthode changée. Modification de rmdir -rf /mnt/boot à rm -rf car rmdir ne prends aucun de des arguments r/f et bloque si le dossier n'est pas vide. --- create_arm_img_urpmi.sh | 47 +++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 78a81f1..8e2e17d 100644 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +function WaitToContinue() +{ + read -p "Break... Press [ENTER] to continue." GARBAGE +} function title() { @@ -109,24 +113,42 @@ function clean() else 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 $(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 + 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}" - /bin/rmdir "${BOOT}" + /bin/rm -rf "${BOOT}" else warning "${BOOT} does not exists" fi if [ -d "${ROOT}" ]; then info "Removing ${ROOT}" - /bin/rmdir "${ROOT}" + /bin/rm -rf "${ROOT}" else warning "${ROOT} does not exists" fi @@ -276,8 +298,9 @@ function preparechroot() info "creation of user account" echo -e "/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n /sbin/useradd ${ID_USER}\n /bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh" - info "Copying skel in root directory" - /bin/rsync -rlptH /etc/skel/ "${BUILD_PATH}/root/" +# info "Copying skel in root directory" +# /bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/" +#This line break the default .bashrc file from the package "rootfiles" and the values as PATH (and /usr/sbin programs). postPrepareChroot if [ ${?} -ne 0 ]; then @@ -494,19 +517,21 @@ copyingsystem() fi if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then + info "\tFound extlinux.conf" if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then info "making /boot/extlinux/extlinux.conf" /bin/rm -rf "${BUILD_PATH}/boot/extlinux" mkdir -p "${BUILD_PATH}/boot/extlinux" fi if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then + info "\tTuning extlinux.conf" sed -e s/\/${ROOT_UUID}/g ${CONFIG_PATH}/extlinux.conf >"${BUILD_PATH}/boot/extlinux/extlinux.conf" KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*) sed -i -e s/\/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf" fi fi - + info "Remove second_stage_install.sh" /bin/rm -f "${BUILD_PATH}/second_stage_install.sh" if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then