Compare commits
No commits in common. "5e7efc71ae253ba1565ce1860713b5dd4717c384" and "a27de93bfead360c409acae50a1e265dd0269e19" have entirely different histories.
5e7efc71ae
...
a27de93bfe
104
README.md
104
README.md
@ -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
|
mageia4arm
|
||||||
==========
|
==========
|
||||||
|
|
||||||
@ -48,31 +42,31 @@ Avoir une copie de ce dépot :
|
|||||||
```
|
```
|
||||||
git clone https://git.labolyon.fr/DTux/mageia4arm
|
git clone https://git.labolyon.fr/DTux/mageia4arm
|
||||||
```
|
```
|
||||||
Choisissez le dossier de configuration adapté à votre besoin (rpi ou xu4), sinon créez un nouveau dossier de configuration, copiez le fichier "mageia4arm.cfg.template" à l'interieur et modifiez le selon vos besoins.
|
Choisissez le dossier de configuration adapté à votre besoin (rpi ou xu4), sinon créez un nouveau dossier de configuration, copiez le fichier "mageia4arm.cfg.template" à l'interieur et modifiez le selon vos besoins.
|
||||||
Par défaut l'utilisateur est "pi" avec le mot de passe "raspberry", et l'administrateur "root" avec le mot de passe "piroot".
|
Par défaut l'utilisateur est "pi" avec le mot de passe "raspberry", et l'administrateur "root" avec le mot de passe "piroot".
|
||||||
|
|
||||||
<a id="fr_creatimg"/>
|
<a id="fr_creatimg"/>
|
||||||
### Créer l'image :
|
### Créer l'image :
|
||||||
create_arm_image.sh --all --config \<dossier de configuration\>
|
create_arm_image.sh --all --config \<dossier de configuration\>
|
||||||
Par exemple :
|
Par exemple :
|
||||||
```
|
```
|
||||||
su -
|
su -
|
||||||
<mot de passe root>
|
<mot de passe root>
|
||||||
cd /home/user/workspace/mageia4arm/
|
cd /home/user/workspace/mageia4arm/
|
||||||
./create_arm_image.sh --all --target bananaPro --size 4 --tainted --nonfree --build-path ./build --config bananaPro 2>&1 | tee -a ./build.log
|
./create_arm_image.sh --all --target bananaPro --size 4 --tainted --nonfree --build-path ./build --config bananaPro 2>&1 | tee -a ./build.log
|
||||||
```
|
```
|
||||||
Avec cette commande, toutes les étapes (--all) du processus de création pour (--target) la bananaPro sont exécuter. L'image final tiendra sur une carte de (--size) 4Go. Les dépots tainted et nonfree seront activé. Le chemin de construction (--build-path) sera ./build. Finalement, la configuration (--config) sera bananaPro. La suite de la commande, 2>&1 redirige la sortie d'erreur dans la sortie standart et le tout est dupliqué (| tee -a) dans le fichier build.log pour le déboguage.
|
Avec cette commande, toutes les étapes (--all) du processus de création pour (--target) la bananaPro sont exécuter. L'image final tiendra sur une carte de (--size) 4Go. Les dépots tainted et nonfree seront activé. Le chemin de construction (--build-path) sera ./build. Finalement, la configuration (--config) sera bananaPro. La suite de la commande, 2>&1 redirige la sortie d'erreur dans la sortie standart et le tout est dupliqué (| tee -a) dans le fichier build.log pour le déboguage.
|
||||||
|
|
||||||
<a id="fr_help"/>
|
<a id="fr_help"/>
|
||||||
### Aide :
|
### Aide :
|
||||||
create_arm_image.sh -h|--help
|
create_arm_image.sh -h|--help
|
||||||
|
|
||||||
Vous pouvez adapter le script "second_stage_install.sh" afin de compléter l'installation.
|
Vous pouvez adapter le script "second_stage_install.sh" afin de compléter l'installation.
|
||||||
Des scripts sont disponibles dans le dossier "tools", ils sont copié dans /usr/local/bin/ dans l'image.
|
Des scripts sont disponibles dans le dossier "tools", ils sont copié dans /usr/local/bin/ dans l'image.
|
||||||
|
|
||||||
<a id="fr_1stStart"/>
|
<a id="fr_1stStart"/>
|
||||||
### Premier lancement de l'image sur le raspberry pi :
|
### Premier lancement de l'image sur le raspberry pi :
|
||||||
- lancer drakkeyboard afin de configurer le clavier
|
- lancer drakkeyboard afin de configurer le clavier
|
||||||
- si vous avez besoin d'un gestionnaire graphique, lancer le script :<br/>install_graphical.sh \<gestionnaire-graphique\>( xfce, lxqt, plasma, ...) voir les métapaquetages disponibles dans "Environnement graphique" dans le gestionnaire de logiciels.
|
- si vous avez besoin d'un gestionnaire graphique, lancer le script :<br/>install_graphical.sh \<gestionnaire-graphique\>( xfce, lxqt, plasma, ...) voir les métapaquetages disponibles dans "Environnement graphique" dans le gestionnaire de logiciels.
|
||||||
|
|
||||||
|
|
||||||
@ -90,31 +84,31 @@ Ce script est lancé avec chroot, ainsi nous pouvons exécuter des opérations p
|
|||||||
|
|
||||||
<a id="fr_file-spe"/>
|
<a id="fr_file-spe"/>
|
||||||
#### specialFunctions.sh
|
#### specialFunctions.sh
|
||||||
Ce script complémente le processus d'installation pour des éléments spécifiques à la plateformes, comme le partitionnement, la manière de mettre en place le chargeur de démarrage, le téléchargements de fichiers externe, etc.
|
Ce script complémente le processus d'installation pour des éléments spécifiques à la plateformes, comme le partitionnement, la manière de mettre en place le chargeur de démarrage, le téléchargements de fichiers externe, etc.
|
||||||
Le script doit implémenter ces quatres fonctions :
|
Le script doit implémenter ces quatres fonctions :
|
||||||
```
|
```
|
||||||
function preImgCreation() {
|
function preImgCreation() {
|
||||||
#Possibilité de télécharger des éléments supplémentaires ici.
|
#Possibilité de télécharger des éléments supplémentaires ici.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
function postPrepareChroot() {
|
function postPrepareChroot() {
|
||||||
#Possibilité de copier des fichiers spécifique à la plateforme avant de lancer le script second_stage_install.sh.
|
#Possibilité de copier des fichiers spécifique à la plateforme avant de lancer le script second_stage_install.sh.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
function burningBootloader() {
|
function burningBootloader() {
|
||||||
#Plusieurs méthodes sont possibles pour flasher le chargeur de démarrage, et dépendent de la plateforme.
|
#Plusieurs méthodes sont possibles pour flasher le chargeur de démarrage, et dépendent de la plateforme.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
function copyingCustomSystem() {
|
function copyingCustomSystem() {
|
||||||
#Possibilité de copier des fichiers dans le système monté.
|
#Possibilité de copier des fichiers dans le système monté.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Si l'une de ces fonctions ne retourne pas 0, la création de l'image échoue.
|
Si l'une de ces fonctions ne retourne pas 0, la création de l'image échoue.
|
||||||
|
|
||||||
<a id="fr_file-extlinux"/>
|
<a id="fr_file-extlinux"/>
|
||||||
#### extlinux.conf
|
#### extlinux.conf
|
||||||
Extlinux.conf est un script utilisé par le chargeur de démarrage (s'il est capable de le gérer, uboot le peut), pour spécifier la version du noyau à démarrer. Le script est normalement généré automatiquement par les outils de Mageia à chaque installation/mise à jour d'un noyau. Malheureusement, lors de la création d'une image de Mageia en chroot, l'outil refuse de générer ce fichier, de plus si le fichier est manquant, lors de la mise à jour du noyau, l'outil de Mageia génère un fichier erroné avec des entrées vides que u-boot refuse.
|
Extlinux.conf est un script utilisé par le chargeur de démarrage (s'il est capable de le gérer, uboot le peut), pour spécifier la version du noyau à démarrer. Le script est normalement généré automatiquement par les outils de Mageia à chaque installation/mise à jour d'un noyau. Malheureusement, lors de la création d'une image de Mageia en chroot, l'outil refuse de générer ce fichier, de plus si le fichier est manquant, lors de la mise à jour du noyau, l'outil de Mageia génère un fichier erroné avec des entrées vides que u-boot refuse.
|
||||||
Il vaut mieux créer ce fichier, même s'il n'est pas primordiale. D'autant plus que lors de la mise à jour d'un noyau, l'outil de Mageia reprends les arguments de la commande de démarrage pour les nouvelles versions.
|
Il vaut mieux créer ce fichier, même s'il n'est pas primordiale. D'autant plus que lors de la mise à jour d'un noyau, l'outil de Mageia reprends les arguments de la commande de démarrage pour les nouvelles versions.
|
||||||
|
|
||||||
La structure basique du fichier est :
|
La structure basique du fichier est :
|
||||||
@ -147,30 +141,30 @@ Diverses informations complémentaires.
|
|||||||
|
|
||||||
<a id="fr_burn"/>
|
<a id="fr_burn"/>
|
||||||
#### Graver une image
|
#### Graver une image
|
||||||
Il est possible de graver l'image avec dd, souvent les cartes SD sont disponibles sous le nom mmcblkX avec X leurs numéros.
|
Il est possible de graver l'image avec dd, souvent les cartes SD sont disponibles sous le nom mmcblkX avec X leurs numéros.
|
||||||
```
|
```
|
||||||
dd if=./build/Mageia-7-bananaPro1.img of=/dev/mmcblkX
|
dd if=./build/Mageia-7-bananaPro1.img of=/dev/mmcblkX
|
||||||
```
|
```
|
||||||
On peut ajouter une barre de progression :
|
On peut ajouter une barre de progression :
|
||||||
```
|
```
|
||||||
pv ./build/Mageia-7-bananaPro1.img | dd of=/dev/mmcblkX
|
pv ./build/Mageia-7-bananaPro1.img | dd of=/dev/mmcblkX
|
||||||
```
|
```
|
||||||
|
|
||||||
<a id="fr_compress"/>
|
<a id="fr_compress"/>
|
||||||
#### Compresser une image
|
#### Compresser une image
|
||||||
Pour compresser l'image, de plusieurs Go en quelques centaines de Mo pour la mettre en ligne par exemple, il est possible d'exécuter la commande suivante :
|
Pour compresser l'image, de plusieurs Go en quelques centaines de Mo pour la mettre en ligne par exemple, il est possible d'exécuter la commande suivante :
|
||||||
```
|
```
|
||||||
dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
|
dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
|
||||||
```
|
```
|
||||||
Avec une barre d'avancement :
|
Avec une barre d'avancement :
|
||||||
```
|
```
|
||||||
pv ./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
|
pv ./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
|
||||||
```
|
```
|
||||||
Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.
|
Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.
|
||||||
|
|
||||||
<a id="fr_gen_chksum"/>
|
<a id="fr_gen_chksum"/>
|
||||||
#### Calculer les sommes de contrôles
|
#### Calculer les sommes de contrôles
|
||||||
Pour s'assurer qu'un fichier a été bien téléchargé, pour vérifier son intégrité, il est d'usage de comparer la somme de contrôle. On peut la calculer avec l'algorithme MD5, SHA1, SHA256, SHA512. Par exemple :
|
Pour s'assurer qu'un fichier a été bien téléchargé, pour vérifier son intégrité, il est d'usage de comparer la somme de contrôle. On peut la calculer avec l'algorithme MD5, SHA1, SHA256, SHA512. Par exemple :
|
||||||
```
|
```
|
||||||
cd /home/user/workspace/mageia4arm/build
|
cd /home/user/workspace/mageia4arm/build
|
||||||
md5sum Mageia-7-bananaPro1.img > Mageia-7-bananaPro1.img.md5
|
md5sum Mageia-7-bananaPro1.img > Mageia-7-bananaPro1.img.md5
|
||||||
@ -239,16 +233,16 @@ English
|
|||||||
|
|
||||||
<a id="en_desc"/>
|
<a id="en_desc"/>
|
||||||
### Description:
|
### Description:
|
||||||
This repository contains script to make image for arm based systems from Mageia repositories.
|
This repository contains script to make image for arm based systems from Mageia repositories.
|
||||||
|
|
||||||
<a id="en_quick"/>
|
<a id="en_quick"/>
|
||||||
<a id="en_creatimg"/>
|
<a id="en_creatimg"/>
|
||||||
### Quick start:
|
### Quick start:
|
||||||
|
|
||||||
Choose the config dir you need (rpi or xu4), else create a new config directory with "mageia4arm.cfg.template" in and modify it as you need.
|
Choose the config dir you need (rpi or xu4), else create a new config directory with "mageia4arm.cfg.template" in and modify it as you need.
|
||||||
By default username is "pi" with password "raspberry" and root password is "piroot".
|
By default username is "pi" with password "raspberry" and root password is "piroot".
|
||||||
|
|
||||||
create_arm_image.sh --all --config <your config dir\>
|
create_arm_image.sh --all --config <your config dir\>
|
||||||
Example given :
|
Example given :
|
||||||
```
|
```
|
||||||
su -
|
su -
|
||||||
@ -260,14 +254,14 @@ With such command, all steps of the build process for the bananaPro will be exec
|
|||||||
|
|
||||||
<a id="en_help"/>
|
<a id="en_help"/>
|
||||||
### Help:
|
### Help:
|
||||||
create_arm_image.sh -h|--help
|
create_arm_image.sh -h|--help
|
||||||
|
|
||||||
you can adapt the script "second_stage_install.sh" to complete the installation.
|
you can adapt the script "second_stage_install.sh" to complete the installation.
|
||||||
Some scripts are available in directory "tools". they are copied in /usr/local/bin/ in the image.
|
Some scripts are available in directory "tools". they are copied in /usr/local/bin/ in the image.
|
||||||
|
|
||||||
<a id="en_1stStart"/>
|
<a id="en_1stStart"/>
|
||||||
### First launch of the image on raspberry pi:
|
### First launch of the image on raspberry pi:
|
||||||
- launch drakkeyboard to configure keyboard layout.
|
- launch drakkeyboard to configure keyboard layout.
|
||||||
- if you need a graphical environment, launch the script :<br/>install_graphical.sh \<graphical environment\> ( xfce, lxqt, plasma, ...), see "Graphical environment" in the Mageia application manager meta packages.
|
- if you need a graphical environment, launch the script :<br/>install_graphical.sh \<graphical environment\> ( xfce, lxqt, plasma, ...), see "Graphical environment" in the Mageia application manager meta packages.
|
||||||
|
|
||||||
|
|
||||||
@ -285,8 +279,8 @@ This script is launched with chroot, then we can execute custom operation as ins
|
|||||||
|
|
||||||
<a id="en_file-spe"/>
|
<a id="en_file-spe"/>
|
||||||
#### specialFunctions.sh
|
#### specialFunctions.sh
|
||||||
This script add into the installation process some elements specific to the platform, as the partitionning, the fashon to set the bootloader, downloading external files, etc.
|
This script add into the installation process some elements specific to the platform, as the partitionning, the fashon to set the bootloader, downloading external files, etc.
|
||||||
It must implement the four next functons :
|
It must implement the four next functons :
|
||||||
```
|
```
|
||||||
function preImgCreation() {
|
function preImgCreation() {
|
||||||
#Here it is possible to download external file.
|
#Here it is possible to download external file.
|
||||||
@ -309,7 +303,7 @@ If one of this functions does not return 0, the process is stoped.
|
|||||||
|
|
||||||
<a id="en_file-extlinux"/>
|
<a id="en_file-extlinux"/>
|
||||||
#### extlinux.conf
|
#### extlinux.conf
|
||||||
extlinux.conf is a script used by the bootloader (if it is able to manage it, uboot does) in order to select specific kernel version to start with boot arguments. This script is normaly automatically generated by Mageia's tools at each kernel installation/update. Unfortunately, when creating the image of Mageia in chroot, the tool refuses to generate the file, moreover, if the file is missing, at the first kernel update, the tool will create it with empty entries which makes uboot failing to parse it.
|
extlinux.conf is a script used by the bootloader (if it is able to manage it, uboot does) in order to select specific kernel version to start with boot arguments. This script is normaly automatically generated by Mageia's tools at each kernel installation/update. Unfortunately, when creating the image of Mageia in chroot, the tool refuses to generate the file, moreover, if the file is missing, at the first kernel update, the tool will create it with empty entries which makes uboot failing to parse it.
|
||||||
It is better to generate this file, even if it isn't mandatory. It is even better as the tool take into account the boot arguments of previous kernel and add it for the new one and regenerate automatically the file.
|
It is better to generate this file, even if it isn't mandatory. It is even better as the tool take into account the boot arguments of previous kernel and add it for the new one and regenerate automatically the file.
|
||||||
|
|
||||||
The basic file is:
|
The basic file is:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
|
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
|
||||||
# Jean-Baptiste Biernacki <j.biernacki@free.fr>
|
# Jean-Baptiste Biernacki <j.biernacki@free.fr>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@ -87,35 +87,33 @@ function createchroot()
|
|||||||
title "Making chroot"
|
title "Making chroot"
|
||||||
if ! [ -f /usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia ]; then
|
if ! [ -f /usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia ]; then
|
||||||
title "distribution-gpg-keys package not present : installing distribution-gpg-keys"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} can't install distribution-gpg-keys : exiting"
|
error "line ${LINENO} can't install distribution-gpg-keys : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
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"
|
title "Qemu package not present : installing qemu packages"
|
||||||
#/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
|
/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
|
||||||
if [ ${?} -ne 0 ]; then
|
|
||||||
error "line ${LINENO} can't install qemu-user-static : exiting"
|
error "line ${LINENO} can't install qemu-user-static : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Starting qemu service if not started
|
# 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
|
if [ ${?} -ne 0 ]; then
|
||||||
title "Starting systemd-binfmt.service"
|
title "Starting systemd-binfmt.service"
|
||||||
/usr/bin/systemctl start systemd-binfmt.service
|
/bin/systemctl start systemd-binfmt.service
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} can't start qemu-user-static : exiting"
|
error "line ${LINENO} can't start qemu-user-static : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
title "Restarting systemd-binfmt.service"
|
title "Restarting systemd-binfmt.service"
|
||||||
/usr/bin/systemctl restart systemd-binfmt.service
|
/bin/systemctl restart systemd-binfmt.service
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} can't start qemu-user-static : exiting"
|
error "line ${LINENO} can't start qemu-user-static : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -168,7 +166,7 @@ function enableextrarepos()
|
|||||||
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
||||||
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
|
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
|
||||||
fi
|
fi
|
||||||
/usr/bin/dnf $DNFPARAM
|
/usr/bin/dnf $DNFPARAM;
|
||||||
err=${?}
|
err=${?}
|
||||||
if [ ${err} -ne 0 ]; then
|
if [ ${err} -ne 0 ]; then
|
||||||
error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
|
error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
|
||||||
@ -181,7 +179,7 @@ function enableextrarepos()
|
|||||||
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
||||||
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
|
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
|
||||||
fi
|
fi
|
||||||
/usr/bin/dnf $DNFPARAM
|
/usr/bin/dnf $DNFPARAM²
|
||||||
err=${?}
|
err=${?}
|
||||||
if [ ${err} -ne 0 ]; then
|
if [ ${err} -ne 0 ]; then
|
||||||
error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
|
error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
|
||||||
@ -242,7 +240,7 @@ function installbasesystem()
|
|||||||
read yn
|
read yn
|
||||||
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
|
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
|
||||||
title "Creating ${BUILD_PATH}"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} can't create ${BUILD_PATH} : exiting"
|
error "line ${LINENO} can't create ${BUILD_PATH} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -268,8 +266,7 @@ function installbasesystem()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
title "installing basesystem"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
|
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -279,43 +276,27 @@ function installbasesystem()
|
|||||||
# error "line ${LINENO} error installing basesystem-minimal : exiting"
|
# error "line ${LINENO} error installing basesystem-minimal : exiting"
|
||||||
# exit ${ERR_1}
|
# exit ${ERR_1}
|
||||||
#fi
|
#fi
|
||||||
if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
|
||||||
installpkg "urpmi locales"
|
if [ ${?} -ne 0 ]; then
|
||||||
else
|
error "line ${LINENO} error installing dnf or locales : exiting"
|
||||||
installpkg "dnf dnf-plugins-core locales"
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
#/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
|
if [ "${ARM_VERSION}" = "armv7hl" ]; then
|
||||||
|
/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
|
||||||
#if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
# error "line ${LINENO} error installing dnf or locales : exiting"
|
error "line ${LINENO} error installing u-boot : exiting"
|
||||||
# exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
#fi
|
fi
|
||||||
#if [ "${ARM_VERSION}" = "aarch64" ]; then
|
fi
|
||||||
#/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
|
/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
|
||||||
# installpkg "/u-boot*"
|
if [ ${?} -ne 0 ]; then
|
||||||
# if [ ${?} -ne 0 ]; then
|
error "line ${LINENO} error installing urpmi : exiting"
|
||||||
# error "line ${LINENO} error installing u-boot : exiting"
|
exit ${ERR_1}
|
||||||
# exit ${ERR_1}
|
fi
|
||||||
# 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
|
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()
|
function preparechroot()
|
||||||
{
|
{
|
||||||
title "Preparing chrooting in ${BUILD_PATH}"
|
title "Preparing chrooting in ${BUILD_PATH}"
|
||||||
@ -324,33 +305,27 @@ function preparechroot()
|
|||||||
echo "${HOSTNAME}" > "${BUILD_PATH}/etc/hostname"
|
echo "${HOSTNAME}" > "${BUILD_PATH}/etc/hostname"
|
||||||
|
|
||||||
info "copying second stage script in ${BUILD_PATH}"
|
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"
|
cp --preserve=mode "${CONFIG_PATH}/second_stage_install.sh" "${BUILD_PATH}/second_stage_install.sh"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error copying ${CONFIG_PATH}/second_stage_install.sh : exiting"
|
error "line ${LINENO} error copying ${CONFIG_PATH}/second_stage_install.sh : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
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"
|
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
|
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
|
else
|
||||||
info "No root password... One password will be set at the first login."
|
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
|
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
|
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"
|
echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||||
if [ -n "${PASSWORD}" ]; then
|
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
|
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
|
fi
|
||||||
else
|
else
|
||||||
info "No user defined, no user account created."
|
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).
|
# 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"
|
# 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
|
postPrepareChroot
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
@ -374,58 +349,49 @@ function jumpchroot()
|
|||||||
{
|
{
|
||||||
title "chrooting to ${BUILD_PATH}"
|
title "chrooting to ${BUILD_PATH}"
|
||||||
info "mounting dev, sys, proc directories in chroot"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error mounting ${BUILD_PATH}/dev : exiting"
|
error "line ${LINENO} error mounting ${BUILD_PATH}/dev : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
/usr/bin/mount -B /sys "${BUILD_PATH}/sys"
|
/bin/mount -B /sys "${BUILD_PATH}/sys"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error mounting ${BUILD_PATH}/sys : exiting"
|
error "line ${LINENO} error mounting ${BUILD_PATH}/sys : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
/usr/bin/mount -B /proc "${BUILD_PATH}/proc"
|
/bin/mount -B /proc "${BUILD_PATH}/proc"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error mounting ${BUILD_PATH}/proc : exiting"
|
error "line ${LINENO} error mounting ${BUILD_PATH}/proc : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
info "Copying resolv.conf"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error copying ${BUILD_PATH}/etc/resolv.conf : exiting"
|
error "line ${LINENO} error copying ${BUILD_PATH}/etc/resolv.conf : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
info "chrooting to ${BUILD_PATH}"
|
|
||||||
if [ "$OPT" = "chroot" ]; then
|
if [ "$OPT" = "chroot" ]; then
|
||||||
info "/sbin/chroot ${BUILD_PATH}"
|
|
||||||
/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
|
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}" /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'
|
fi
|
||||||
RET=${?}
|
RET=${?}
|
||||||
if [ ${RET} -ne 0 ]; then
|
if [ ${RET} -ne 0 ]; then
|
||||||
error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
|
error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
|
||||||
ERRORN=$((${ERRORN}+1))
|
ERRORN=$((${ERRORN}+1))
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "unmounting dev, sys, proc"
|
info "unmounting dev, sys, proc"
|
||||||
/usr/bin/umount -lf "${BUILD_PATH}/dev"
|
/bin/umount -lf "${BUILD_PATH}/dev"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/dev, continuing anyway"
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/dev, continuing anyway"
|
||||||
ERRORN=$((${ERRORN}+1))
|
ERRORN=$((${ERRORN}+1))
|
||||||
fi
|
fi
|
||||||
/usr/bin/umount -lf "${BUILD_PATH}/sys"
|
/bin/umount -lf "${BUILD_PATH}/sys"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/sys, continuing anyway"
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/sys, continuing anyway"
|
||||||
ERRORN=$((${ERRORN}+1))
|
ERRORN=$((${ERRORN}+1))
|
||||||
fi
|
fi
|
||||||
/usr/bin/umount -lf "${BUILD_PATH}/proc"
|
/bin/umount -lf "${BUILD_PATH}/proc"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
|
||||||
ERRORN=$((${ERRORN}+1))
|
ERRORN=$((${ERRORN}+1))
|
||||||
@ -457,7 +423,7 @@ function createimage()
|
|||||||
title " in ${IMAGE}"
|
title " in ${IMAGE}"
|
||||||
if [ -f "${INSTALL_PATH}/${IMAGE}" ]; then
|
if [ -f "${INSTALL_PATH}/${IMAGE}" ]; then
|
||||||
warning "Deleting previous image"
|
warning "Deleting previous image"
|
||||||
/usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error can't remove previous image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
error "line ${LINENO} error can't remove previous image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -465,7 +431,7 @@ function createimage()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
warning "please wait until end of image creation"
|
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
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -545,7 +511,7 @@ function generateExtlinux()
|
|||||||
info "\tFound extlinux.conf"
|
info "\tFound extlinux.conf"
|
||||||
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
||||||
info "making /boot/extlinux/extlinux.conf"
|
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"
|
mkdir -p "${BUILD_PATH}/boot/extlinux"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
|
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
|
||||||
@ -565,7 +531,7 @@ function copyingsystem()
|
|||||||
generateExtlinux
|
generateExtlinux
|
||||||
|
|
||||||
info "Remove second_stage_install.sh"
|
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
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||||
@ -574,12 +540,12 @@ function copyingsystem()
|
|||||||
mkdir -p "${ARM_BOOT}"
|
mkdir -p "${ARM_BOOT}"
|
||||||
fi
|
fi
|
||||||
info "copying Mageia image to root partition"
|
info "copying Mageia image to root partition"
|
||||||
/usr/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||||
/usr/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
|
/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
|
||||||
#/usr/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
|
/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
|
||||||
else
|
else
|
||||||
info "copying Mageia image to root partition"
|
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
|
fi
|
||||||
|
|
||||||
copyingCustomSystem
|
copyingCustomSystem
|
||||||
@ -601,13 +567,13 @@ function mountPartitions(){
|
|||||||
|
|
||||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
if ! [ -d "${BOOT}" ]; then
|
if ! [ -d "${BOOT}" ]; then
|
||||||
/usr/bin/mkdir "${BOOT}"
|
/bin/mkdir "${BOOT}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
/usr/bin/mount "${BOOTP}" "${BOOT}"
|
/bin/mount "${BOOTP}" "${BOOT}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -615,13 +581,13 @@ function mountPartitions(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -d "${ROOT}" ]; then
|
if ! [ -d "${ROOT}" ]; then
|
||||||
/usr/bin/mkdir "${ROOT}"
|
/bin/mkdir "${ROOT}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error making directory ${ROOT} : exiting"
|
error "line ${LINENO} error making directory ${ROOT} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
/usr/bin/mount "${ROOTP}" "${ROOT}"
|
/bin/mount "${ROOTP}" "${ROOT}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error mounting ${ROOTP} : exiting"
|
error "line ${LINENO} error mounting ${ROOTP} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -647,7 +613,7 @@ function unmountingPartitions()
|
|||||||
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
||||||
/usr/bin/umount "${PARTITION}"
|
/usr/bin/umount "${PARTITION}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/usr/bin/rmdir "${MOUNTPOINT}"
|
/bin/rmdir "${MOUNTPOINT}"
|
||||||
else
|
else
|
||||||
error "line ${LINENO} error unmounting ${BOOT}..."
|
error "line ${LINENO} error unmounting ${BOOT}..."
|
||||||
fi
|
fi
|
||||||
@ -658,14 +624,14 @@ function unmountingPartitions()
|
|||||||
if [ ! -z "${BOOTP}" ]; then
|
if [ ! -z "${BOOTP}" ]; then
|
||||||
/usr/bin/umount "${BOOTP}"
|
/usr/bin/umount "${BOOTP}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/usr/bin/rmdir "${BOOT}"
|
/bin/rmdir "${BOOT}"
|
||||||
else
|
else
|
||||||
error "line ${LINENO} error unmounting ${BOOT}..."
|
error "line ${LINENO} error unmounting ${BOOT}..."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
/usr/bin/umount "${ROOTP}"
|
/usr/bin/umount "${ROOTP}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/usr/bin/rmdir "${ROOT}"
|
/bin/rmdir "${ROOT}"
|
||||||
else
|
else
|
||||||
error "line ${LINENO} error unmounting ${ROOT}..."
|
error "line ${LINENO} error unmounting ${ROOT}..."
|
||||||
fi
|
fi
|
||||||
@ -701,8 +667,8 @@ function copyingcommon()
|
|||||||
{
|
{
|
||||||
title "Copying common files and configuration"
|
title "Copying common files and configuration"
|
||||||
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
|
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
|
||||||
rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/usr/bin/"
|
rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
|
||||||
chown root:root "${ROOT}/usr/local/usr/bin/"
|
chown root:root "${ROOT}/usr/local/bin/"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,14 +699,14 @@ function clean()
|
|||||||
# Removing old Build directory
|
# Removing old Build directory
|
||||||
if [ -d "${BUILD_PATH}" ]; then
|
if [ -d "${BUILD_PATH}" ]; then
|
||||||
info "Removing ${BUILD_PATH}"
|
info "Removing ${BUILD_PATH}"
|
||||||
/usr/bin/rm -Rf "${BUILD_PATH}"
|
/bin/rm -Rf "${BUILD_PATH}"
|
||||||
else
|
else
|
||||||
warning "${BUILD_PATH} does not exists"
|
warning "${BUILD_PATH} does not exists"
|
||||||
fi
|
fi
|
||||||
# removing old image
|
# removing old image
|
||||||
if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then
|
if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then
|
||||||
info "Removing ${IMAGE}"
|
info "Removing ${IMAGE}"
|
||||||
/usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
||||||
else
|
else
|
||||||
warning "${IMAGE} does not exists"
|
warning "${IMAGE} does not exists"
|
||||||
fi
|
fi
|
||||||
@ -805,12 +771,12 @@ if [ 0 -ne $(id -u) ]; then
|
|||||||
exit ${ERR_NOT_ROOT}
|
exit ${ERR_NOT_ROOT}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOURCE_PATH="$(/usr/bin/dirname "$(readlink -f "${0}")")"
|
SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
|
||||||
INSTALL_PATH="$(pwd)/build"
|
INSTALL_PATH="$(pwd)/build"
|
||||||
# FILES_PATH="${SOURCE_PATH}/files"
|
# FILES_PATH="${SOURCE_PATH}/files"
|
||||||
PLATFORMS_PATH="${SOURCE_PATH}/platforms"
|
PLATFORMS_PATH="${SOURCE_PATH}/platforms"
|
||||||
|
|
||||||
CMDNAME=$(/usr/bin/basename "${0}")
|
CMDNAME=$(/bin/basename "${0}")
|
||||||
|
|
||||||
|
|
||||||
if [ ${#} == 0 ]; then
|
if [ ${#} == 0 ]; then
|
||||||
@ -820,7 +786,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# parsing commandline
|
# 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
|
if [ ${?} -ne 0 ] ; then error "line ${LINENO} Failed parsing options." >&2 ; exit ${ERR_1} ; fi
|
||||||
eval set -- "${TEMP}"
|
eval set -- "${TEMP}"
|
||||||
|
|
||||||
@ -860,18 +826,6 @@ while true; do
|
|||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--prepare-chroot)
|
|
||||||
if [ -z ${OPT} ]; then
|
|
||||||
OPT="preparechroot"
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--jump-chroot)
|
|
||||||
if [ -z ${OPT} ]; then
|
|
||||||
OPT="jumpchroot"
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--add-urpmimedia)
|
--add-urpmimedia)
|
||||||
if [ -z ${OPT} ]; then
|
if [ -z ${OPT} ]; then
|
||||||
OPT="addurpmimedia"
|
OPT="addurpmimedia"
|
||||||
@ -1008,7 +962,6 @@ info "Build path: ${BUILD_PATH}"
|
|||||||
info "Commande : ${CMDNAME}"
|
info "Commande : ${CMDNAME}"
|
||||||
info "Firmware path : ${FIRMWARE_PATH}"
|
info "Firmware path : ${FIRMWARE_PATH}"
|
||||||
info "Firmware dir : ${FIRMWARE_DIR}"
|
info "Firmware dir : ${FIRMWARE_DIR}"
|
||||||
info "Installation method : ${INSTALL_METHOD}"
|
|
||||||
|
|
||||||
# Defining default image size to 7 go
|
# Defining default image size to 7 go
|
||||||
if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then
|
if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then
|
||||||
@ -1019,7 +972,7 @@ fi
|
|||||||
if [ "${OPT}" != "clean" ]; then
|
if [ "${OPT}" != "clean" ]; then
|
||||||
info "cd ${INSTALL_PATH}"
|
info "cd ${INSTALL_PATH}"
|
||||||
if ! [ -e "${INSTALL_PATH}" ]; then
|
if ! [ -e "${INSTALL_PATH}" ]; then
|
||||||
/usr/bin/mkdir -p "${INSTALL_PATH}"
|
/bin/mkdir -p "${INSTALL_PATH}"
|
||||||
if [ -z ${?} ]; then
|
if [ -z ${?} ]; then
|
||||||
error "line ${LINENO} can't make directory ${INSTALL_PATH} , exiting"
|
error "line ${LINENO} can't make directory ${INSTALL_PATH} , exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
@ -1054,16 +1007,19 @@ case ${OPT} in
|
|||||||
fi
|
fi
|
||||||
createImageWrap #Create the empty .img
|
createImageWrap #Create the empty .img
|
||||||
createchroot #Check qemu and activate it
|
createchroot #Check qemu and activate it
|
||||||
if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
genusemirroroptions #Generate mirror options, if needed
|
||||||
addurpmimedia
|
installbasesystem #Generate the rootfs, rootfiles, ...
|
||||||
else
|
enableextrarepos
|
||||||
genusemirroroptions #Generate mirror options, if needed
|
# addurpmimedia
|
||||||
enableextrarepos
|
|
||||||
fi
|
|
||||||
installbasesystem #Generate the rootfs, rootfiles, ...
|
|
||||||
mkfstab
|
mkfstab
|
||||||
preparechroot
|
preparechroot
|
||||||
jumpchroot
|
jumpchroot
|
||||||
|
#Check before is useless (with $MIRROR
|
||||||
|
info "Use mirrorlist to light one server."
|
||||||
|
MIRROR=
|
||||||
|
genusemirroroptions
|
||||||
|
enableextrarepos
|
||||||
|
# addurpmimedia
|
||||||
mountPartitions
|
mountPartitions
|
||||||
copyingsystem
|
copyingsystem
|
||||||
unmountingPartitions
|
unmountingPartitions
|
||||||
@ -1072,12 +1028,6 @@ case ${OPT} in
|
|||||||
"createchroot")
|
"createchroot")
|
||||||
createchroot
|
createchroot
|
||||||
;;
|
;;
|
||||||
"preparechroot")
|
|
||||||
preparechroot
|
|
||||||
;;
|
|
||||||
"jumpchroot")
|
|
||||||
jumpchroot
|
|
||||||
;;
|
|
||||||
"chroot")
|
"chroot")
|
||||||
jumpchroot
|
jumpchroot
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user