|
@@ -55,9 +55,8 @@ function help() {
|
|
|
|
|
|
echo -e "\nBuild levels:"
|
|
|
echo -e "--create-chroot Create the chroot directory"
|
|
|
- echo -e "--addmedia add mirrors"
|
|
|
- echo -e "--update-mirror update urpmi database"
|
|
|
echo -e "--install-basesystem install base system"
|
|
|
+ echo -e "--add-urpmimedia add mirrors for urpmi"
|
|
|
echo -e "--chroot chroot to arm directory and launch packages installation"
|
|
|
echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}"
|
|
|
echo "--config Path to config files (rpi1 rpi2 rpi3 rpi3+ xu4)"
|
|
@@ -87,7 +86,7 @@ function createchroot()
|
|
|
title "Making chroot"
|
|
|
if ! [ -f /bin/qemu-arm-static ]; then
|
|
|
title "Qemu package not present : installing qemu packages"
|
|
|
- /sbin/urpmi --auto --no-recommends qemu-user-static
|
|
|
+ /usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
|
|
|
if [ ${?} -ne 0 ]; then
|
|
|
error "line ${LINENO} can't install qemu-user-static : exiting"
|
|
|
exit ${ERR_1}
|
|
@@ -106,9 +105,56 @@ function createchroot()
|
|
|
return 0
|
|
|
}
|
|
|
|
|
|
+# enabling extra Mageia repositories
|
|
|
+function genusemirroroptions()
|
|
|
+{
|
|
|
+ DNF_MIRROROPTS="--nogpgcheck --releasever=${MAGEIA_VERSION}"
|
|
|
+ if [ ! -z "${MIRROR}" ]; then
|
|
|
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=\* --repofrompath=mgarel,${MIRROR}/media/core/release/ --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgarel --enablerepo=mgaup"
|
|
|
+ if [ ${NONFREE} -eq 1 ]; then
|
|
|
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgarel-nonfree --enablerepo=mgaup-nonfree"
|
|
|
+ fi
|
|
|
+ if [ ${TAINTED} -eq 1 ]; then
|
|
|
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgarel-tainted --enablerepo=mgaup-tainted"
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ export DNF_MIRROROPTS
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+# enabling extra Mageia repositories
|
|
|
+function enableextrarepos()
|
|
|
+{
|
|
|
+ if [ "${MAGEIA_VERSION}" = "cauldron" ]; then
|
|
|
+ extrasect_baseprefix="cauldron"
|
|
|
+ extrasect_updatesprefix="cauldron-updates"
|
|
|
+ else
|
|
|
+ extrasect_baseprefix="mageia"
|
|
|
+ extrasect_updatesprefix="updates"
|
|
|
+ fi
|
|
|
+ if [ ${NONFREE} -eq 1 ]; then
|
|
|
+ title "activating non-free repos"
|
|
|
+ /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
|
|
|
+ err=${?}
|
|
|
+ if [ ${err} -ne 0 ]; then
|
|
|
+ error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
|
|
|
+ exit ${ERR_1}
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ if [ ${TAINTED} -eq 1 ]; then
|
|
|
+ title "activating tainted repos"
|
|
|
+ /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
|
|
|
+ err=${?}
|
|
|
+ if [ ${err} -ne 0 ]; then
|
|
|
+ error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
|
|
|
+ exit ${ERR_1}
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ return 0
|
|
|
+}
|
|
|
|
|
|
-# adding Mageia repositories
|
|
|
-function addmedia()
|
|
|
+# adding Mageia urpmi repositories
|
|
|
+function addurpmimedia()
|
|
|
{
|
|
|
title "Creating media ${MIRROR}"
|
|
|
|
|
@@ -150,18 +196,6 @@ function addmedia()
|
|
|
}
|
|
|
|
|
|
|
|
|
-function updatemirror()
|
|
|
-{
|
|
|
- title "updating mirror"
|
|
|
- /sbin/urpmi.update -a --urpmi-root "${BUILD_PATH}"
|
|
|
- if [ ${?} -ne 0 ]; then
|
|
|
- error "line ${LINENO} can't update mirrors : exiting"
|
|
|
- exit ${ERR_1}
|
|
|
- fi
|
|
|
- return 0
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
function installbasesystem()
|
|
|
{
|
|
|
# Create Build path
|
|
@@ -183,19 +217,24 @@ function installbasesystem()
|
|
|
fi
|
|
|
|
|
|
title "installing basesystem"
|
|
|
- /sbin/urpmi --urpmi-root "${BUILD_PATH}" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 shadow-utils basesystem-minimal
|
|
|
+ /usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install 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 0 basesystem-minimal
|
|
|
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install 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 0 urpmi locales u-boot
|
|
|
+ /usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales u-boot
|
|
|
if [ ${?} -ne 0 ]; then
|
|
|
- error "line ${LINENO} error installing urpmi or locales.fr : exiting"
|
|
|
+ error "line ${LINENO} error installing dnf or locales : exiting"
|
|
|
+ exit ${ERR_1}
|
|
|
+ fi
|
|
|
+ /usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install urpmi
|
|
|
+ if [ ${?} -ne 0 ]; then
|
|
|
+ error "line ${LINENO} error installing urpmi : exiting"
|
|
|
exit ${ERR_1}
|
|
|
fi
|
|
|
return 0
|
|
@@ -705,7 +744,7 @@ fi
|
|
|
|
|
|
|
|
|
# parsing commandline
|
|
|
-TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,addmedia,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,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}"
|
|
|
|
|
@@ -745,9 +784,9 @@ while true; do
|
|
|
fi
|
|
|
shift
|
|
|
;;
|
|
|
- --addmedia)
|
|
|
+ --add-urpmimedia)
|
|
|
if [ -z ${OPT} ]; then
|
|
|
- OPT="addmedia"
|
|
|
+ OPT="addurpmimedia"
|
|
|
fi
|
|
|
shift
|
|
|
;;
|
|
@@ -926,16 +965,19 @@ case ${OPT} in
|
|
|
fi
|
|
|
createImageWrap #Create the empty .img
|
|
|
createchroot #Check qemu and activate it
|
|
|
- addmedia
|
|
|
- updatemirror
|
|
|
+ genusemirroroptions #Generate mirror options, if needed
|
|
|
installbasesystem #Generate the rootfs, rootfiles, ...
|
|
|
+ enableextrarepos
|
|
|
+ addurpmimedia
|
|
|
mkfstab
|
|
|
preparechroot
|
|
|
jumpchroot
|
|
|
#Check before is useless (with $MIRROR
|
|
|
info "Use mirrorlist to light one server."
|
|
|
MIRROR=
|
|
|
- addmedia
|
|
|
+ genusemirroroptions
|
|
|
+ enableextrarepos
|
|
|
+ addurpmimedia
|
|
|
mountPartitions
|
|
|
copyingsystem
|
|
|
unmountingPartitions
|
|
@@ -947,11 +989,8 @@ case ${OPT} in
|
|
|
"chroot")
|
|
|
jumpchroot
|
|
|
;;
|
|
|
- "addmedia")
|
|
|
- addmedia
|
|
|
- ;;
|
|
|
- "updatemirror")
|
|
|
- updatemirror
|
|
|
+ "addurpmimedia")
|
|
|
+ addurpmimedia
|
|
|
;;
|
|
|
"createimage")
|
|
|
verify_disk_space
|