aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJybz <j.biernacki@free.fr>2020-08-30 01:43:00 +0200
committerJybz <j.biernacki@free.fr>2020-08-30 01:43:00 +0200
commita507682ec01f690b8e106c7f87f61272dfa2d4d2 (patch)
tree89bed562fe2856c4ea873015803e06a63958f41c
parentf6475aaefaf8439cccbc9f83fe7255454d3c238e (diff)
downloadmageia4arm-a507682ec01f690b8e106c7f87f61272dfa2d4d2.tar
mageia4arm-a507682ec01f690b8e106c7f87f61272dfa2d4d2.tar.gz
mageia4arm-a507682ec01f690b8e106c7f87f61272dfa2d4d2.tar.bz2
mageia4arm-a507682ec01f690b8e106c7f87f61272dfa2d4d2.tar.xz
mageia4arm-a507682ec01f690b8e106c7f87f61272dfa2d4d2.zip
Switch \t by spaces
-rwxr-xr-xcreate_arm_image.sh117
1 files changed, 56 insertions, 61 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh
index 7117387..b79276b 100755
--- a/create_arm_image.sh
+++ b/create_arm_image.sh
@@ -65,7 +65,7 @@ function help() {
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)"
+ echo -e "--config Path to config files (rpi1 rpi2 rpi3 rpi3+ xu4)"
echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
}
@@ -103,8 +103,8 @@ function createchroot()
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
- installpkg "qemu-user-static" "--setopt=install_weak_deps=False"
- if [ ${?} -ne 0 ]; then
+ 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
@@ -137,18 +137,18 @@ function genusemirroroptions()
if [ ! -z "${MIRROR}" ]; then
DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=* --repofrompath=mgarel,${MIRROR}/media/core/release/ --enablerepo=mgarel"
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
- DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgaup"
- fi
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgaup"
+ fi
if [ ${NONFREE} -eq 1 ]; then
DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --enablerepo=mgarel-nonfree "
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
- DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgaup-nonfree"
- fi
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgaup-nonfree"
+ fi
fi
if [ ${TAINTED} -eq 1 ]; then
DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --enablerepo=mgarel-tainted "
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
- DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgaup-tainted"
+ DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgaup-tainted"
fi
fi
fi
@@ -160,20 +160,20 @@ function genusemirroroptions()
# enabling extra Mageia repositories
function enableextrarepos()
{
- extrasect_baseprefix="mageia"
- # if [ "${MAGEIA_VERSION}" = "cauldron" ]; then
- # extrasect_baseprefix="cauldron"
- # extrasect_updatesprefix=""
- # else
- # extrasect_baseprefix="mageia"
- extrasect_updatesprefix="updates"
+ extrasect_baseprefix="mageia"
+# if [ "${MAGEIA_VERSION}" = "cauldron" ]; then
+# extrasect_baseprefix="cauldron"
+# extrasect_updatesprefix=""
+# else
+# extrasect_baseprefix="mageia"
+ extrasect_updatesprefix="updates"
# fi
if [ ${NONFREE} -eq 1 ]; then
title "activating non-free repos"
DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree"
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
- DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
- fi
+ DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
+ fi
/usr/bin/dnf $DNFPARAM
err=${?}
if [ ${err} -ne 0 ]; then
@@ -185,8 +185,8 @@ function enableextrarepos()
title "activating tainted repos"
DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted"
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
- DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
- fi
+ DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
+ fi
/usr/bin/dnf $DNFPARAM
err=${?}
if [ ${err} -ne 0 ]; then
@@ -290,20 +290,20 @@ function installbasesystem()
exit ${ERR_1}
fi
if [ ${INSTALL_METHOD} = "urpmi" ]; then
- installpkg "urpmi locales"
- else
- installpkg "dnf dnf-plugins-core locales"
- fi
+ installpkg "urpmi locales"
+ else
+ installpkg "dnf dnf-plugins-core locales"
+ 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
+ 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()
@@ -322,10 +322,10 @@ function preparechroot()
fi
info "configuring second_stage_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"
+ 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
+ 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
@@ -346,11 +346,6 @@ function preparechroot()
info "No user defined, no user account created."
fi
-
-# 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"
-# /usr/bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
-
postPrepareChroot
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error in postPrepareChroot function."
@@ -387,21 +382,21 @@ function jumpchroot()
fi
info "chrooting to ${BUILD_PATH}"
if [ "$OPT" = "chroot" ]; then
- info "/sbin/chroot ${BUILD_PATH}"
+ 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
+ if [ ${RET} -ne 0 ]; then
+ error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
+ ERRORN=$((${ERRORN}+1))
+ fi
else
- info "/sbin/chroot --userspec root:root ${BUILD_PATH} /usr/bin/bash -v -c 'bash /second_stage_install.sh 2>&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
+ 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"
@@ -875,14 +870,14 @@ while true; do
fi
shift
;;
- --prepare-chroot)
- if [ -z ${OPT} ]; then
+ --prepare-chroot)
+ if [ -z ${OPT} ]; then
OPT="preparechroot"
fi
shift
;;
- --jump-chroot)
- if [ -z ${OPT} ]; then
+ --jump-chroot)
+ if [ -z ${OPT} ]; then
OPT="jumpchroot"
fi
shift
@@ -1068,11 +1063,11 @@ case ${OPT} in
createImageWrap #Create the empty .img
createchroot #Check qemu and activate it
if [ ${INSTALL_METHOD} = "urpmi" ]; then
- addurpmimedia
- else
- genusemirroroptions #Generate mirror options, if needed
- fi
- installbasesystem #Generate the rootfs, rootfiles, ...
+ addurpmimedia
+ else
+ genusemirroroptions #Generate mirror options, if needed
+ fi
+ installbasesystem #Generate the rootfs, rootfiles, ...
mkfstab
preparechroot
jumpchroot
@@ -1085,12 +1080,12 @@ case ${OPT} in
"createchroot")
createchroot
;;
- "preparechroot")
- preparechroot
- ;;
- "jumpchroot")
- jumpchroot
- ;;
+ "preparechroot")
+ preparechroot
+ ;;
+ "jumpchroot")
+ jumpchroot
+ ;;
"chroot")
jumpchroot
;;