aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Tartavel <contact@librepc.com>2020-08-06 15:26:15 +0200
committerDaniel Tartavel <contact@librepc.com>2020-08-06 15:42:24 +0200
commit5b4c77e8530d623105c431137f03f66e9e23d32e (patch)
tree8d9ff34c279549a5b88f2fdb4044a862b8c95c6b
parenta27de93bfead360c409acae50a1e265dd0269e19 (diff)
downloadmageia4arm-5b4c77e8530d623105c431137f03f66e9e23d32e.tar
mageia4arm-5b4c77e8530d623105c431137f03f66e9e23d32e.tar.gz
mageia4arm-5b4c77e8530d623105c431137f03f66e9e23d32e.tar.bz2
mageia4arm-5b4c77e8530d623105c431137f03f66e9e23d32e.tar.xz
mageia4arm-5b4c77e8530d623105c431137f03f66e9e23d32e.zip
can choose between urpmi or dnf
-rwxr-xr-xcreate_arm_image.sh214
1 files changed, 132 insertions, 82 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh
index 28ef4fe..2468f40 100755
--- a/create_arm_image.sh
+++ b/create_arm_image.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/bash
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
# Jean-Baptiste Biernacki <j.biernacki@free.fr>
@@ -6,7 +6,7 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 2 of the License,dnf or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -87,33 +87,35 @@ function createchroot()
title "Making chroot"
if ! [ -f /usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia ]; then
title "distribution-gpg-keys package not present : installing distribution-gpg-keys"
- /usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install distribution-gpg-keys
+ #/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install distribution-gpg-keys
+ installpkg "distribution-gpg-keys" "--setopt=install_weak_deps=False"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't install distribution-gpg-keys : exiting"
exit ${ERR_1}
fi
fi
- if ! [ -f /bin/qemu-arm-static ]; then
+ if ! [ -f /usr/bin/qemu-arm-static ]; then
title "Qemu package not present : installing qemu packages"
- /usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
- if [ ${?} -ne 0 ]; then
+ #/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
+ installpkg "qemu-user-static" "--setopt=install_weak_deps=False"
+ if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't install qemu-user-static : exiting"
exit ${ERR_1}
fi
fi
# Starting qemu service if not started
- /bin/systemctl is-active systemd-binfmt.service
+ /usr/bin/systemctl is-active systemd-binfmt.service
if [ ${?} -ne 0 ]; then
title "Starting systemd-binfmt.service"
- /bin/systemctl start systemd-binfmt.service
+ /usr/bin/systemctl start systemd-binfmt.service
if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't start qemu-user-static : exiting"
exit ${ERR_1}
fi
else
title "Restarting systemd-binfmt.service"
- /bin/systemctl restart systemd-binfmt.service
+ /usr/bin/systemctl restart systemd-binfmt.service
if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't start qemu-user-static : exiting"
exit ${ERR_1}
@@ -166,7 +168,7 @@ function enableextrarepos()
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
fi
- /usr/bin/dnf $DNFPARAM;
+ /usr/bin/dnf $DNFPARAM
err=${?}
if [ ${err} -ne 0 ]; then
error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
@@ -179,7 +181,7 @@ function enableextrarepos()
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
fi
- /usr/bin/dnf $DNFPARAM²
+ /usr/bin/dnf $DNFPARAM
err=${?}
if [ ${err} -ne 0 ]; then
error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
@@ -240,7 +242,7 @@ function installbasesystem()
read yn
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
title "Creating ${BUILD_PATH}"
- /bin/mkdir -p "${BUILD_PATH}/usr/bin" "${BUILD_PATH}/usr/lib/binfmt.d"
+ /usr/bin/mkdir -p "${BUILD_PATH}/usr/bin" "${BUILD_PATH}/usr/lib/binfmt.d"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't create ${BUILD_PATH} : exiting"
exit ${ERR_1}
@@ -266,7 +268,8 @@ function installbasesystem()
fi
title "installing basesystem"
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
+ installpkg "shadow-utils basesystem-minimal"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
exit ${ERR_1}
@@ -276,27 +279,43 @@ function installbasesystem()
# error "line ${LINENO} error installing basesystem-minimal : exiting"
# exit ${ERR_1}
#fi
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
- if [ ${?} -ne 0 ]; then
- error "line ${LINENO} error installing dnf or locales : exiting"
- exit ${ERR_1}
- fi
- if [ "${ARM_VERSION}" = "armv7hl" ]; then
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
- if [ ${?} -ne 0 ]; then
- error "line ${LINENO} error installing u-boot : exiting"
- exit ${ERR_1}
- fi
- fi
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
- if [ ${?} -ne 0 ]; then
- error "line ${LINENO} error installing urpmi : exiting"
- exit ${ERR_1}
- fi
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
+ installpkg "urpmi locales"
+ else
+ installpkg "dnf dnf-plugins-core locales"
+ fi
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
+
+ #if [ ${?} -ne 0 ]; then
+ # error "line ${LINENO} error installing dnf or locales : exiting"
+ # exit ${ERR_1}
+ #fi
+ #if [ "${ARM_VERSION}" = "aarch64" ]; then
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
+ # installpkg "/u-boot*"
+ # if [ ${?} -ne 0 ]; then
+ # error "line ${LINENO} error installing u-boot : exiting"
+ # exit ${ERR_1}
+ # fi
+ #fi
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
+ #installpkg "urpmi"
+ #if [ ${?} -ne 0 ]; then
+ # error "line ${LINENO} error installing urpmi : exiting"
+ # exit ${ERR_1}
+ #fi
return 0
}
+function installpkg()
+{
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
+ /usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 $3 $1;
+ else
+ /usr/bin/dnf $2 --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install $1;
+ fi
+}
function preparechroot()
{
title "Preparing chrooting in ${BUILD_PATH}"
@@ -305,27 +324,33 @@ function preparechroot()
echo "${HOSTNAME}" > "${BUILD_PATH}/etc/hostname"
info "copying second stage script in ${BUILD_PATH}"
- #echo "/bin/cp ${CONFIG_PATH}/second_stage_install.sh ${BUILD_PATH}/"
+ #echo "/usr/bin/cp ${CONFIG_PATH}/second_stage_install.sh ${BUILD_PATH}/"
cp --preserve=mode "${CONFIG_PATH}/second_stage_install.sh" "${BUILD_PATH}/second_stage_install.sh"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error copying ${CONFIG_PATH}/second_stage_install.sh : exiting"
exit ${ERR_1}
fi
+ info "configuring second_install_install.sh for ${INSTALL_METHOD}"
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
+ sed -i -e "s/<INSTALL_EXEC>/sbin\/urpmi --no-verify-rpm --auto/g" "${BUILD_PATH}/second_stage_install.sh"
+ else
+ sed -i -e "s/<INSTALL_EXEC>/bin\/dnf --nogpgcheck --assumeyes install/g" "${BUILD_PATH}/second_stage_install.sh"
+ fi
info "Preparation for setting root and user account"
if [ -n "${ROOT_PWD}" ]; then #If root password defined, it will be setted at the end of the chroot of the second_stage_install.sh script
- echo -e "/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
+ echo -e "/usr/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
else
info "No root password... One password will be set at the first login."
- echo -e "/bin/passwd -d root\n/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
+ echo -e "/usr/bin/passwd -d root\n/usr/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
fi
if [ -n "${ID_USER}" ]; then #If user ID defined, it will be setted at the end of the chroot of the second_stage_install.sh script
echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
if [ -n "${PASSWORD}" ]; then
- echo -e "/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
+ echo -e "/usr/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
else
- echo -e "/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
+ echo -e "/usr/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
fi
else
info "No user defined, no user account created."
@@ -334,7 +359,7 @@ function preparechroot()
# BUG: This line break the default .bashrc file from the package "rootfiles" and the values as PATH (and /usr/sbin programs).
# info "Copying skel in root directory"
-# /bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
+# /usr/bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
postPrepareChroot
if [ ${?} -ne 0 ]; then
@@ -349,49 +374,58 @@ function jumpchroot()
{
title "chrooting to ${BUILD_PATH}"
info "mounting dev, sys, proc directories in chroot"
- /bin/mount -B /dev "${BUILD_PATH}/dev"
+ /usr/bin/mount -B /dev "${BUILD_PATH}/dev"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BUILD_PATH}/dev : exiting"
exit ${ERR_1}
fi
- /bin/mount -B /sys "${BUILD_PATH}/sys"
+ /usr/bin/mount -B /sys "${BUILD_PATH}/sys"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BUILD_PATH}/sys : exiting"
exit ${ERR_1}
fi
- /bin/mount -B /proc "${BUILD_PATH}/proc"
+ /usr/bin/mount -B /proc "${BUILD_PATH}/proc"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BUILD_PATH}/proc : exiting"
exit ${ERR_1}
fi
info "Copying resolv.conf"
- /bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
+ /usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error copying ${BUILD_PATH}/etc/resolv.conf : exiting"
exit ${ERR_1}
fi
+ info "chrooting to ${BUILD_PATH}"
if [ "$OPT" = "chroot" ]; then
+ info "/sbin/chroot ${BUILD_PATH}"
/sbin/chroot "${BUILD_PATH}"
+ RET=${?}
+ if [ ${RET} -ne 0 ]; then
+ error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
+ ERRORN=$((${ERRORN}+1))
+ fi
else
- /sbin/chroot --userspec root:root "${BUILD_PATH}" /bin/bash -v -c 'bash /second_stage_install.sh 2>&1'
- fi
- RET=${?}
- if [ ${RET} -ne 0 ]; then
- error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
- ERRORN=$((${ERRORN}+1))
+ info "/sbin/chroot --userspec root:root ${BUILD_PATH} /usr/bin/bash -v -c 'bash /second_stage_install.sh 2>&1'"
+ /sbin/chroot --userspec root:root "${BUILD_PATH}" /usr/bin/bash -v -c 'bash /second_stage_install.sh 2>&1'
+ RET=${?}
+ if [ ${RET} -ne 0 ]; then
+ error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
+ ERRORN=$((${ERRORN}+1))
+ fi
fi
+
info "unmounting dev, sys, proc"
- /bin/umount -lf "${BUILD_PATH}/dev"
+ /usr/bin/umount -lf "${BUILD_PATH}/dev"
if [ ${?} -ne 0 ]; then
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/dev, continuing anyway"
ERRORN=$((${ERRORN}+1))
fi
- /bin/umount -lf "${BUILD_PATH}/sys"
+ /usr/bin/umount -lf "${BUILD_PATH}/sys"
if [ ${?} -ne 0 ]; then
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/sys, continuing anyway"
ERRORN=$((${ERRORN}+1))
fi
- /bin/umount -lf "${BUILD_PATH}/proc"
+ /usr/bin/umount -lf "${BUILD_PATH}/proc"
if [ ${?} -ne 0 ]; then
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
ERRORN=$((${ERRORN}+1))
@@ -423,7 +457,7 @@ function createimage()
title " in ${IMAGE}"
if [ -f "${INSTALL_PATH}/${IMAGE}" ]; then
warning "Deleting previous image"
- /bin/rm -f "${INSTALL_PATH}/${IMAGE}"
+ /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error can't remove previous image at ${INSTALL_PATH}/${IMAGE} : exiting"
exit ${ERR_1}
@@ -431,7 +465,7 @@ function createimage()
fi
warning "please wait until end of image creation"
- /bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 ))
+ /usr/bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 )) status=progress
if [ ${?} -ne 0 ]; then
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
exit ${ERR_1}
@@ -511,7 +545,7 @@ function generateExtlinux()
info "\tFound extlinux.conf"
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
info "making /boot/extlinux/extlinux.conf"
- /bin/rm -rf "${BUILD_PATH}/boot/extlinux"
+ /usr/bin/rm -rf "${BUILD_PATH}/boot/extlinux"
mkdir -p "${BUILD_PATH}/boot/extlinux"
fi
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
@@ -531,7 +565,7 @@ function copyingsystem()
generateExtlinux
info "Remove second_stage_install.sh"
- /bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
+ /usr/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
@@ -540,12 +574,12 @@ function copyingsystem()
mkdir -p "${ARM_BOOT}"
fi
info "copying Mageia image to root partition"
- /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
- /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
- /bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
+ /usr/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
+ /usr/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
+ #/usr/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
else
info "copying Mageia image to root partition"
- /bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
+ /usr/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
fi
copyingCustomSystem
@@ -567,13 +601,13 @@ function mountPartitions(){
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
if ! [ -d "${BOOT}" ]; then
- /bin/mkdir "${BOOT}"
+ /usr/bin/mkdir "${BOOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error making directory ${BOOT} : exiting"
exit ${ERR_1}
fi
fi
- /bin/mount "${BOOTP}" "${BOOT}"
+ /usr/bin/mount "${BOOTP}" "${BOOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${BOOTP} : exiting"
exit ${ERR_1}
@@ -581,13 +615,13 @@ function mountPartitions(){
fi
if ! [ -d "${ROOT}" ]; then
- /bin/mkdir "${ROOT}"
+ /usr/bin/mkdir "${ROOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error making directory ${ROOT} : exiting"
exit ${ERR_1}
fi
fi
- /bin/mount "${ROOTP}" "${ROOT}"
+ /usr/bin/mount "${ROOTP}" "${ROOT}"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error mounting ${ROOTP} : exiting"
exit ${ERR_1}
@@ -613,7 +647,7 @@ function unmountingPartitions()
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
/usr/bin/umount "${PARTITION}"
if [ ${?} -eq 0 ]; then
- /bin/rmdir "${MOUNTPOINT}"
+ /usr/bin/rmdir "${MOUNTPOINT}"
else
error "line ${LINENO} error unmounting ${BOOT}..."
fi
@@ -624,14 +658,14 @@ function unmountingPartitions()
if [ ! -z "${BOOTP}" ]; then
/usr/bin/umount "${BOOTP}"
if [ ${?} -eq 0 ]; then
- /bin/rmdir "${BOOT}"
+ /usr/bin/rmdir "${BOOT}"
else
error "line ${LINENO} error unmounting ${BOOT}..."
fi
fi
/usr/bin/umount "${ROOTP}"
if [ ${?} -eq 0 ]; then
- /bin/rmdir "${ROOT}"
+ /usr/bin/rmdir "${ROOT}"
else
error "line ${LINENO} error unmounting ${ROOT}..."
fi
@@ -667,8 +701,8 @@ function copyingcommon()
{
title "Copying common files and configuration"
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
- rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
- chown root:root "${ROOT}/usr/local/bin/"
+ rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/usr/bin/"
+ chown root:root "${ROOT}/usr/local/usr/bin/"
return 0
}
@@ -699,14 +733,14 @@ function clean()
# Removing old Build directory
if [ -d "${BUILD_PATH}" ]; then
info "Removing ${BUILD_PATH}"
- /bin/rm -Rf "${BUILD_PATH}"
+ /usr/bin/rm -Rf "${BUILD_PATH}"
else
warning "${BUILD_PATH} does not exists"
fi
# removing old image
if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then
info "Removing ${IMAGE}"
- /bin/rm -f "${INSTALL_PATH}/${IMAGE}"
+ /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
else
warning "${IMAGE} does not exists"
fi
@@ -771,12 +805,12 @@ if [ 0 -ne $(id -u) ]; then
exit ${ERR_NOT_ROOT}
fi
-SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
+SOURCE_PATH="$(/usr/bin/dirname "$(readlink -f "${0}")")"
INSTALL_PATH="$(pwd)/build"
# FILES_PATH="${SOURCE_PATH}/files"
PLATFORMS_PATH="${SOURCE_PATH}/platforms"
-CMDNAME=$(/bin/basename "${0}")
+CMDNAME=$(/usr/bin/basename "${0}")
if [ ${#} == 0 ]; then
@@ -786,7 +820,7 @@ fi
# parsing commandline
-TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,add-urpmimedia,create-image,,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,nonfree,tainted -n ${CMDNAME} -- "${@}")
+TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,prepare-chroot,jump-chroot,add-urpmimedia,create-image,,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,nonfree,tainted -n ${CMDNAME} -- "${@}")
if [ ${?} -ne 0 ] ; then error "line ${LINENO} Failed parsing options." >&2 ; exit ${ERR_1} ; fi
eval set -- "${TEMP}"
@@ -826,6 +860,18 @@ while true; do
fi
shift
;;
+ --prepare-chroot)
+ if [ -z ${OPT} ]; then
+ OPT="preparechroot"
+ fi
+ shift
+ ;;
+ --jump-chroot)
+ if [ -z ${OPT} ]; then
+ OPT="jumpchroot"
+ fi
+ shift
+ ;;
--add-urpmimedia)
if [ -z ${OPT} ]; then
OPT="addurpmimedia"
@@ -962,6 +1008,7 @@ info "Build path: ${BUILD_PATH}"
info "Commande : ${CMDNAME}"
info "Firmware path : ${FIRMWARE_PATH}"
info "Firmware dir : ${FIRMWARE_DIR}"
+info "Installation method : ${INSTALL_METHOD}"
# Defining default image size to 7 go
if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then
@@ -972,7 +1019,7 @@ fi
if [ "${OPT}" != "clean" ]; then
info "cd ${INSTALL_PATH}"
if ! [ -e "${INSTALL_PATH}" ]; then
- /bin/mkdir -p "${INSTALL_PATH}"
+ /usr/bin/mkdir -p "${INSTALL_PATH}"
if [ -z ${?} ]; then
error "line ${LINENO} can't make directory ${INSTALL_PATH} , exiting"
exit ${ERR_1}
@@ -1007,19 +1054,16 @@ case ${OPT} in
fi
createImageWrap #Create the empty .img
createchroot #Check qemu and activate it
- genusemirroroptions #Generate mirror options, if needed
- installbasesystem #Generate the rootfs, rootfiles, ...
- enableextrarepos
-# addurpmimedia
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
+ addurpmimedia
+ else
+ genusemirroroptions #Generate mirror options, if needed
+ enableextrarepos
+ fi
+ installbasesystem #Generate the rootfs, rootfiles, ...
mkfstab
preparechroot
jumpchroot
- #Check before is useless (with $MIRROR
- info "Use mirrorlist to light one server."
- MIRROR=
- genusemirroroptions
- enableextrarepos
-# addurpmimedia
mountPartitions
copyingsystem
unmountingPartitions
@@ -1028,6 +1072,12 @@ case ${OPT} in
"createchroot")
createchroot
;;
+ "preparechroot")
+ preparechroot
+ ;;
+ "jumpchroot")
+ jumpchroot
+ ;;
"chroot")
jumpchroot
;;