Compare commits
No commits in common. "5e7efc71ae253ba1565ce1860713b5dd4717c384" and "a27de93bfead360c409acae50a1e265dd0269e19" have entirely different histories.
5e7efc71ae
...
a27de93bfe
@ -1,9 +1,3 @@
|
||||
|
||||
## **ATTENTION: Le projet a migré sur le git de Mageia.**
|
||||
## **WARNING: project has migrated on Mageia's git.**
|
||||
## [http://gitweb.mageia.org/software/mageia4arm/](http://)
|
||||
|
||||
|
||||
mageia4arm
|
||||
==========
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
#!/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,dnf or
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@ -87,35 +87,33 @@ 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
|
||||
installpkg "distribution-gpg-keys" "--setopt=install_weak_deps=False"
|
||||
/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install distribution-gpg-keys
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} can't install distribution-gpg-keys : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ -f /usr/bin/qemu-arm-static ]; then
|
||||
if ! [ -f /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"
|
||||
/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}
|
||||
fi
|
||||
fi
|
||||
# Starting qemu service if not started
|
||||
/usr/bin/systemctl is-active systemd-binfmt.service
|
||||
/bin/systemctl is-active systemd-binfmt.service
|
||||
if [ ${?} -ne 0 ]; then
|
||||
title "Starting systemd-binfmt.service"
|
||||
/usr/bin/systemctl start systemd-binfmt.service
|
||||
/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"
|
||||
/usr/bin/systemctl restart systemd-binfmt.service
|
||||
/bin/systemctl restart systemd-binfmt.service
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} can't start qemu-user-static : exiting"
|
||||
exit ${ERR_1}
|
||||
@ -168,7 +166,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"
|
||||
@ -181,7 +179,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"
|
||||
@ -242,7 +240,7 @@ function installbasesystem()
|
||||
read yn
|
||||
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
|
||||
title "Creating ${BUILD_PATH}"
|
||||
/usr/bin/mkdir -p "${BUILD_PATH}/usr/bin" "${BUILD_PATH}/usr/lib/binfmt.d"
|
||||
/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}
|
||||
@ -268,8 +266,7 @@ function installbasesystem()
|
||||
fi
|
||||
|
||||
title "installing basesystem"
|
||||
#/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
|
||||
installpkg "shadow-utils basesystem-minimal"
|
||||
/usr/bin/dnf --installroot="${BUILD_PATH}" ${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}
|
||||
@ -279,43 +276,27 @@ function installbasesystem()
|
||||
# error "line ${LINENO} error installing basesystem-minimal : exiting"
|
||||
# exit ${ERR_1}
|
||||
#fi
|
||||
if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
||||
installpkg "urpmi locales"
|
||||
else
|
||||
installpkg "dnf dnf-plugins-core locales"
|
||||
/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
|
||||
#/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}"
|
||||
@ -324,33 +305,27 @@ function preparechroot()
|
||||
echo "${HOSTNAME}" > "${BUILD_PATH}/etc/hostname"
|
||||
|
||||
info "copying second stage script in ${BUILD_PATH}"
|
||||
#echo "/usr/bin/cp ${CONFIG_PATH}/second_stage_install.sh ${BUILD_PATH}/"
|
||||
#echo "/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 "/usr/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
echo -e "/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 "/usr/bin/passwd -d root\n/usr/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
echo -e "/bin/passwd -d root\n/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 "/usr/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
echo -e "/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
else
|
||||
echo -e "/usr/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
echo -e "/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||
fi
|
||||
else
|
||||
info "No user defined, no user account created."
|
||||
@ -359,7 +334,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"
|
||||
# /usr/bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
|
||||
# /bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
|
||||
|
||||
postPrepareChroot
|
||||
if [ ${?} -ne 0 ]; then
|
||||
@ -374,58 +349,49 @@ function jumpchroot()
|
||||
{
|
||||
title "chrooting to ${BUILD_PATH}"
|
||||
info "mounting dev, sys, proc directories in chroot"
|
||||
/usr/bin/mount -B /dev "${BUILD_PATH}/dev"
|
||||
/bin/mount -B /dev "${BUILD_PATH}/dev"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error mounting ${BUILD_PATH}/dev : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
/usr/bin/mount -B /sys "${BUILD_PATH}/sys"
|
||||
/bin/mount -B /sys "${BUILD_PATH}/sys"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error mounting ${BUILD_PATH}/sys : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
/usr/bin/mount -B /proc "${BUILD_PATH}/proc"
|
||||
/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"
|
||||
/usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
|
||||
/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
|
||||
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'
|
||||
/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))
|
||||
fi
|
||||
fi
|
||||
|
||||
info "unmounting dev, sys, proc"
|
||||
/usr/bin/umount -lf "${BUILD_PATH}/dev"
|
||||
/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
|
||||
/usr/bin/umount -lf "${BUILD_PATH}/sys"
|
||||
/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
|
||||
/usr/bin/umount -lf "${BUILD_PATH}/proc"
|
||||
/bin/umount -lf "${BUILD_PATH}/proc"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
|
||||
ERRORN=$((${ERRORN}+1))
|
||||
@ -457,7 +423,7 @@ function createimage()
|
||||
title " in ${IMAGE}"
|
||||
if [ -f "${INSTALL_PATH}/${IMAGE}" ]; then
|
||||
warning "Deleting previous image"
|
||||
/usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
||||
/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}
|
||||
@ -465,7 +431,7 @@ function createimage()
|
||||
fi
|
||||
|
||||
warning "please wait until end of image creation"
|
||||
/usr/bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 )) status=progress
|
||||
/bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 ))
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
||||
exit ${ERR_1}
|
||||
@ -545,7 +511,7 @@ function generateExtlinux()
|
||||
info "\tFound extlinux.conf"
|
||||
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
||||
info "making /boot/extlinux/extlinux.conf"
|
||||
/usr/bin/rm -rf "${BUILD_PATH}/boot/extlinux"
|
||||
/bin/rm -rf "${BUILD_PATH}/boot/extlinux"
|
||||
mkdir -p "${BUILD_PATH}/boot/extlinux"
|
||||
fi
|
||||
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
|
||||
@ -565,7 +531,7 @@ function copyingsystem()
|
||||
generateExtlinux
|
||||
|
||||
info "Remove second_stage_install.sh"
|
||||
/usr/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
||||
/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
||||
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||
@ -574,12 +540,12 @@ function copyingsystem()
|
||||
mkdir -p "${ARM_BOOT}"
|
||||
fi
|
||||
info "copying Mageia image to root partition"
|
||||
/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}/"
|
||||
/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}/"
|
||||
else
|
||||
info "copying Mageia image to root partition"
|
||||
/usr/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||
/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||
fi
|
||||
|
||||
copyingCustomSystem
|
||||
@ -601,13 +567,13 @@ function mountPartitions(){
|
||||
|
||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||
if ! [ -d "${BOOT}" ]; then
|
||||
/usr/bin/mkdir "${BOOT}"
|
||||
/bin/mkdir "${BOOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
/usr/bin/mount "${BOOTP}" "${BOOT}"
|
||||
/bin/mount "${BOOTP}" "${BOOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
||||
exit ${ERR_1}
|
||||
@ -615,13 +581,13 @@ function mountPartitions(){
|
||||
fi
|
||||
|
||||
if ! [ -d "${ROOT}" ]; then
|
||||
/usr/bin/mkdir "${ROOT}"
|
||||
/bin/mkdir "${ROOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error making directory ${ROOT} : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
/usr/bin/mount "${ROOTP}" "${ROOT}"
|
||||
/bin/mount "${ROOTP}" "${ROOT}"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error mounting ${ROOTP} : exiting"
|
||||
exit ${ERR_1}
|
||||
@ -647,7 +613,7 @@ function unmountingPartitions()
|
||||
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
||||
/usr/bin/umount "${PARTITION}"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
/usr/bin/rmdir "${MOUNTPOINT}"
|
||||
/bin/rmdir "${MOUNTPOINT}"
|
||||
else
|
||||
error "line ${LINENO} error unmounting ${BOOT}..."
|
||||
fi
|
||||
@ -658,14 +624,14 @@ function unmountingPartitions()
|
||||
if [ ! -z "${BOOTP}" ]; then
|
||||
/usr/bin/umount "${BOOTP}"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
/usr/bin/rmdir "${BOOT}"
|
||||
/bin/rmdir "${BOOT}"
|
||||
else
|
||||
error "line ${LINENO} error unmounting ${BOOT}..."
|
||||
fi
|
||||
fi
|
||||
/usr/bin/umount "${ROOTP}"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
/usr/bin/rmdir "${ROOT}"
|
||||
/bin/rmdir "${ROOT}"
|
||||
else
|
||||
error "line ${LINENO} error unmounting ${ROOT}..."
|
||||
fi
|
||||
@ -701,8 +667,8 @@ function copyingcommon()
|
||||
{
|
||||
title "Copying common files and configuration"
|
||||
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
|
||||
rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/usr/bin/"
|
||||
chown root:root "${ROOT}/usr/local/usr/bin/"
|
||||
rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
|
||||
chown root:root "${ROOT}/usr/local/bin/"
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -733,14 +699,14 @@ function clean()
|
||||
# Removing old Build directory
|
||||
if [ -d "${BUILD_PATH}" ]; then
|
||||
info "Removing ${BUILD_PATH}"
|
||||
/usr/bin/rm -Rf "${BUILD_PATH}"
|
||||
/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}"
|
||||
/usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
||||
/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
||||
else
|
||||
warning "${IMAGE} does not exists"
|
||||
fi
|
||||
@ -805,12 +771,12 @@ if [ 0 -ne $(id -u) ]; then
|
||||
exit ${ERR_NOT_ROOT}
|
||||
fi
|
||||
|
||||
SOURCE_PATH="$(/usr/bin/dirname "$(readlink -f "${0}")")"
|
||||
SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
|
||||
INSTALL_PATH="$(pwd)/build"
|
||||
# FILES_PATH="${SOURCE_PATH}/files"
|
||||
PLATFORMS_PATH="${SOURCE_PATH}/platforms"
|
||||
|
||||
CMDNAME=$(/usr/bin/basename "${0}")
|
||||
CMDNAME=$(/bin/basename "${0}")
|
||||
|
||||
|
||||
if [ ${#} == 0 ]; then
|
||||
@ -820,7 +786,7 @@ fi
|
||||
|
||||
|
||||
# parsing commandline
|
||||
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} -- "${@}")
|
||||
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}"
|
||||
|
||||
@ -860,18 +826,6 @@ 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"
|
||||
@ -1008,7 +962,6 @@ 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
|
||||
@ -1019,7 +972,7 @@ fi
|
||||
if [ "${OPT}" != "clean" ]; then
|
||||
info "cd ${INSTALL_PATH}"
|
||||
if ! [ -e "${INSTALL_PATH}" ]; then
|
||||
/usr/bin/mkdir -p "${INSTALL_PATH}"
|
||||
/bin/mkdir -p "${INSTALL_PATH}"
|
||||
if [ -z ${?} ]; then
|
||||
error "line ${LINENO} can't make directory ${INSTALL_PATH} , exiting"
|
||||
exit ${ERR_1}
|
||||
@ -1054,16 +1007,19 @@ case ${OPT} in
|
||||
fi
|
||||
createImageWrap #Create the empty .img
|
||||
createchroot #Check qemu and activate it
|
||||
if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
||||
addurpmimedia
|
||||
else
|
||||
genusemirroroptions #Generate mirror options, if needed
|
||||
enableextrarepos
|
||||
fi
|
||||
installbasesystem #Generate the rootfs, rootfiles, ...
|
||||
enableextrarepos
|
||||
# addurpmimedia
|
||||
mkfstab
|
||||
preparechroot
|
||||
jumpchroot
|
||||
#Check before is useless (with $MIRROR
|
||||
info "Use mirrorlist to light one server."
|
||||
MIRROR=
|
||||
genusemirroroptions
|
||||
enableextrarepos
|
||||
# addurpmimedia
|
||||
mountPartitions
|
||||
copyingsystem
|
||||
unmountingPartitions
|
||||
@ -1072,12 +1028,6 @@ case ${OPT} in
|
||||
"createchroot")
|
||||
createchroot
|
||||
;;
|
||||
"preparechroot")
|
||||
preparechroot
|
||||
;;
|
||||
"jumpchroot")
|
||||
jumpchroot
|
||||
;;
|
||||
"chroot")
|
||||
jumpchroot
|
||||
;;
|
||||
|
Reference in New Issue
Block a user