/scripts/alcasar-rpm.sh |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/scripts/alcasar-rpm-download.sh |
---|
1,7 → 1,7 |
#!/bin/bash |
# $Id$ |
# alcasar-rpm-download.sh |
# alcasar-urpmi.sh |
# by Franck BOUIJOUX and Richard REY |
# This script is distributed under the Gnu General Public License (GPL) |
13,7 → 13,7 |
# The kernel version we compile netflow for |
KERNEL="kernel-server-5.10.27-1.mga7-1-1.mga7" |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ****** |
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite php-cli unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamd fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat" |
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite php-cli php-rrd unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamd fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat" |
rpm_repository_sync () |
{ |
32,9 → 32,9 |
{ |
echo |
echo "Relancez l'installation ultérieurement." |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-rpm.sh'" |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'" |
echo "Try an other install later." |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-rpm.sh'" |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'" |
} |
# extract the current architecture (i586 ou X64) |
/scripts/alcasar-uninstall.sh |
---|
418,7 → 418,6 |
# Reset "skip.list" (we keep "kernel" in order not to download kernel we don't want to have) |
echo "/^kernel/" > /etc/urpmi/skip.list |
$SED "/^exclude/d" /etc/dnf/dnf.conf |
# Cleaning (remove all "old" alcasar scripts) |
echo -en "\n- End of cleaning ...\n" |
/scripts/alcasar-urpmi.sh |
---|
0,0 → 1,275 |
#!/bin/bash |
# $Id$ |
# alcasar-urpmi.sh |
# by 3abtux and Rexy |
# This script is distributed under the Gnu General Public License (GPL) |
# script de mise en place des dépots RPM |
# configure the RPM repository |
Lang=`echo $LANG|cut -c 1-2` |
VERSION="7" |
ARCH="x86_64" |
# The kernel version we compile netflow for |
KERNEL="kernel-server-5.10.27-1.mga7-1-1.mga7" |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ****** |
# (old) perl-Socket6 : needed by nfsen |
# "fonts-dejavu-common" & "fonts-ttf-dejavu" : fonts needed by wkhtmltopdf |
# "lsscsi" & nvme-cli" : needed by phpsysinfo |
# "socat" : avoid a warning when run the install script of letsencrypt ("acme.sh") |
# "sudo" : needed after a reinstallation (to be investigated) |
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite php-cli php-rrd unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamd fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat" |
rpm_repository_sync () |
{ |
cat <<EOF > /etc/urpmi/urpmi.cfg |
{ |
downloader: wget |
} |
EOF |
echo ${!MIRRORLIST} |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates |
urpmi.addmedia nonfree --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/release |
urpmi.addmedia nonfree-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/updates |
} |
rpm_error () |
{ |
echo |
if [ $Lang == "fr" ] |
then |
echo "Relancez l'installation ultérieurement." |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'" |
else |
echo "Try an other install later." |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'" |
fi |
} |
# extract the current Mageia version and hardware architecture (i586 ou X64) |
fic=`cat /etc/product.id` |
old="$IFS" |
IFS="," |
set $fic |
for i in $* |
do |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ] |
then |
DISTRIBUTION=`echo $i|cut -d"=" -f2` |
fi |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ] |
then |
CURRENT_VERSION=`echo $i|cut -d"=" -f2` |
fi |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ] |
then |
ARCH=`echo $i|cut -d"=" -f2` |
fi |
done |
IFS="$old" |
# We prefer wget than curl |
urpmi --no-verify-rpm --auto rpms/$ARCH/wget*.rpm |
# Set the RPM repository (if not already set) |
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l` |
MIRROR_NBR=2 |
# For Europeans |
MIRRORLIST1="https://www.mirrorservice.org/pub/mageia/distrib/$VERSION/$ARCH" |
# For International install |
MIRRORLIST2="https://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list" |
try_nb="0"; nb_repository="0" |
while [ "$nb_repository" != "4" ] |
do |
try_nb=`expr $try_nb + 1` |
MIRRORLIST="MIRRORLIST$try_nb" |
rpm_repository_sync |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l` |
if [ "$nb_repository" != "4" ] |
then |
if [ $Lang == "fr" ] |
then |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb." |
else |
echo "An error occurs when synchronising the repositories N°$try_nb" |
fi |
if [ $(expr $try_nb) -eq $MIRROR_NBR ] |
then |
rpm_error |
exit 1 |
fi |
if [ $Lang == "fr" ] |
then |
echo "Voulez-vous tenter une synchronisation avec un autre dépôt ? (O/n)" |
else |
echo "Do you want to try a synchronisation with an other repository? (Y/n)" |
fi |
response=0 |
PTN='^[oOnNyY]?$' |
until [[ "$response" =~ $PTN ]] |
do |
read response |
done |
if [ "$response" = "n" ] || [ "$response" = "N" ] |
then |
exit 1 |
fi |
fi |
done |
# download the kernel used by ALCASAR |
if [ $Lang == "fr" ] |
then |
echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..." |
else |
echo "Download the Linux kernel used by ALCASAR. Please wait ..." |
fi |
urpmi --auto --quiet $KERNEL |
# Remove some of our RPMs in order to avoid their update |
urpme wkhtmltopdf |
# download updated RPM in cache |
if [ $Lang == "fr" ] |
then |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..." |
echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)" |
else |
echo "Updated RPM download. Please wait ..." |
echo "You should now take a coffe (or a good beer) ;-)" |
fi |
urpmi --auto --auto-update --quiet --test --retry 2 |
if [ "$?" != "0" ] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "Une erreur a été détectée lors de la récupération des paquetages." |
else |
echo "An error occurs when downloading RPMS" |
fi |
rpm_error |
exit 1 |
fi |
# update with cached RPM |
urpmi --auto --auto-update |
if [ "$?" != "0" ] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "Une erreur a été détectée lors de la mise à jour des paquetages." |
else |
echo "An error occurs when updating packages" |
fi |
rpm_error |
exit 1 |
fi |
# Clean the RPM cache |
urpmi --clean |
# Download of ALCASAR specifics RPM in cache (and test) |
if [ $Lang == "fr" ] |
then |
echo "Récupération des paquetages complémentaires. Veuillez patienter ..." |
else |
echo "Download of complementary packages. Please wait ..." |
fi |
urpmi --auto --no-recommends $PACKAGES --quiet --test --retry 2 |
if [ "$?" != "0" ] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires." |
else |
echo "An error occurs when downloading complementary packages" |
fi |
rpm_error |
exit 1 |
fi |
# update with cached RPM |
urpmi --auto --no-recommends $PACKAGES |
if [ "$?" != "0" ] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires." |
else |
echo "An error occurs when installing complementary packages" |
fi |
rpm_error |
exit 1 |
fi |
# Keep only the kernel version we compil netflow with, and remove all others |
kernelVersion=$(rpm -qa | grep -e ^kernel-server -e ^kernel-desktop) |
for i in $kernelVersion |
do |
if [ $i != $KERNEL ];then |
urpme --auto $i |
fi |
done |
# delete unused RPMs |
if [ $Lang == "fr" ] |
then |
echo "Cleaning the system : " |
else |
echo "Nettoyage du système : " |
fi |
rm_rpm="shorewall mandi plymouth cpupower squid" |
/usr/sbin/urpme --auto -a $rm_rpm |
/usr/sbin/urpme --auto --auto-orphans |
# Save chilli launch script (erase with new rpm one) |
[ -e /etc/chilli.conf ] && cp /etc/chilli.conf /tmp/ |
# Install home made RPMs |
for pkg in `ls rpms/$ARCH/*.rpm` |
do |
urpmi --no-verify --auto $pkg |
done |
# restore chilli launch script |
[ -e /tmp/chilli.conf ] && mv /tmp/chilli.conf /etc/ |
# Clean the RPM cache |
urpmi --clean |
# the ipt-netflow RPM add the kernel module ipt_NETFLOW (the modules dependance tree need to be updated). "2>/dev/null" in order not to display a error (the running kernel is not the ALCASAR one during the installation process) |
/sbin/depmod -a 2>/dev/null |
# test if all needed rpms are correctly installed |
count_pkg=0; nb_pkg=0; |
for pkg in $PACKAGES |
do |
nb_pkg=`expr $nb_pkg + 1` |
if rpm -q --quiet $pkg ; then |
count_pkg=`expr $count_pkg + 1` |
else |
echo "error installing $pkg" |
fi |
done |
if [ $count_pkg -ne $nb_pkg ] |
then |
exit 1 |
fi |
# test if all custom rpms are correctly installed |
count_pkg=0; nb_pkg=0; |
for pkg in `ls rpms/$ARCH/|sed 's/.x86_64.rpm//'` |
do |
nb_pkg=`expr $nb_pkg + 1` |
if rpm -q --quiet $pkg ; then |
count_pkg=`expr $count_pkg + 1` |
else |
echo "error installing $pkg" |
fi |
done |
if [ $count_pkg -ne $nb_pkg ] |
then |
exit 1 |
fi |
# fix some RPM versions |
echo "/^kernel/" > /etc/urpmi/skip.list |
echo "/^freeradius/" >> /etc/urpmi/skip.list |
echo "/^wkhtmltopdf/" >> /etc/urpmi/skip.list |
echo "/^clamd/" >> /etc/urpmi/skip.list |
echo "/^clamav/" >> /etc/urpmi/skip.list |
exit 0 |
Property changes: |
Added: svn:eol-style |
+LF |
\ No newline at end of property |
Added: svn:executable |
+* |
\ No newline at end of property |
Added: svn:keywords |
+Id Author Date |
\ No newline at end of property |
/alcasar.sh |
---|
2176,7 → 2176,6 |
[ -e /etc/bashrc.default ] || cp /etc/bashrc /etc/bashrc.default |
cp -f $DIR_CONF/bashrc /etc/. ; chmod 644 /etc/bashrc ; chown root:root /etc/bashrc |
$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc |
$SED "s?^alias ll=.*?alias ll=\"ls -al --color\"?g" /etc/profile.d/60alias.sh |
# sudoers configuration for "apache" & "sysadmin" |
[ -e /etc/sudoers.default ] || cp /etc/sudoers /etc/sudoers.default |
cp -f $DIR_CONF/sudoers /etc/ ; chmod 440 /etc/sudoers ; chown root:root /etc/sudoers |
2385,11 → 2384,7 |
fi |
done |
# RPMs install |
if [ "$mode" == "update" ] # to avoid updating unbound during the V5.3.3 update (to be removed after this version) |
then |
echo "/^unbound/" >> /etc/urpmi/skip.list |
fi |
$DIR_SCRIPTS/alcasar-rpm.sh |
$DIR_SCRIPTS/alcasar-urpmi.sh |
if [ "$?" != "0" ] |
then |
exit 0 |
/web/acc/alcasar-3.5.3-presentation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-installation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-technique.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-presentation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-installation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-exploitation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.3-exploitation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-exploitation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-exploitation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-installation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-installation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-presentation-en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-presentation-fr.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/alcasar-3.5.2-technique.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/conf/bashrc |
---|
16,42 → 16,36 |
# are we an interactive shell? |
if [ "$PS1" ]; then |
i='${USER}@${HOSTNAME%%.*}:$([[ "${PWD}" =~ ^"${HOME}"(/|$) ]] && echo "~${PWD#${HOME}}" || echo "${PWD}")' |
case $TERM in |
xterm*) |
PROMPT_COMMAND='echo -ne "\033]0;'${i}'\007"' |
;; |
screen) |
PROMPT_COMMAND='echo -ne "\033_'${i}'\033\\"' |
;; |
*) |
;; |
xterm*) |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' |
;; |
*) |
;; |
esac |
unset i |
# [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " # default |
# color prompt |
if [ `id -un` = root ]; then |
PS1='\e[31;1;40m\]\h-$ORGANISME[\w]\$\e[37;0;40m\] ' |
alias ll='ls -al --color' |
else |
PS1='\e[32;1;40m\]\h-$ORGANISME[\w]\$\e[37;0;40m\] ' |
fi |
# met un peu de couleur sur le compte 'root' |
if [ `id -un` = root ]; then |
PS1='\[\033[1;31m\]\h-$ORGANISME:\w\$\[\033[0m\] ' |
else |
PS1='\[\033[1;30m\]\h-$ORGANISME:\w\$\[\033[0m\] ' |
fi |
if [ -z "$loginsh" ]; then # We're not a login shell |
if [ -z "$loginsh" ]; then # We're not a login shell |
# Not all scripts in profile.d are compatible with other shells |
# TODO: make the scripts compatible or check the running shell by |
# themselves. |
if [ -n "${BASH_VERSION}${KSH_VERSION}${ZSH_VERSION}" ]; then |
for i in /etc/profile.d/*.sh; do |
if [ -x $i ]; then |
. $i |
fi |
done |
unset i |
fi |
if [ -n "${BASH_VERSION}${KSH_VERSION}${ZSH_VERSION}" ]; then |
for i in /etc/profile.d/*.sh; do |
if [ -x $i ]; then |
. $i |
fi |
done |
unset i |
fi |
fi |
fi |
unset loginsh |
/iso/build-iso.sh |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/iso/scripts/build-image.sh |
---|
0,0 → 1,268 |
#!/bin/bash |
# |
# Authors: Mageia Team |
# Update for ALCASAR : Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux - Aurelien Dubois - Pierre Rivault |
## |
# Usage: $0 ARGS |
# --iso-file, -i Mageia-xxx-xxxxxx-xxx.iso (mandatory) |
# --lang, -l Language for installation (optional) |
# Supported languages: fr;en |
# |
####################### |
###### Variables ###### |
################################################################################ |
CURRENT_DIR="$(readlink -f "$(dirname $0)")" |
LOG_FILE="$CURRENT_DIR/build-image.log" |
# Mageia |
MAGEIA_VERSION=`cat /etc/release|cut -d" " -f3` |
ARCH=`cat /etc/release|cut -d" " -f6` |
MAGEIA_NEW_DIR=/tmp/mageia_new |
MAGEIA_OFFICIAL_DIR=/tmp/mageia_official |
MAGEIA_OFFICIAL_DIR_EFI=/tmp/mageia_official_efi |
# ISO file |
ISO_DIR="/var/iso" |
ISO_IN="$ISO_DIR/Mageia-$MAGEIA_VERSION-$ARCH.iso" |
# Drake installer |
INSTALLER_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/alcasar" |
EFI_GRUB_CFG="${MAGEIA_NEW_DIR}/boot/grub2/grub.cfg" |
AUTO_INSTALL_CFG="/var/iso/auto_inst.cfg.pl" |
ADVERT_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/extra/advertising" |
# Alcasar |
ALCASAR_TAR="$1" |
ALCASAR_EXTRACTED_DIR=$(echo $ALCASAR_TAR | rev | cut -d '.' -f 3- | rev) |
# Mirrors |
ISO_SUPPORT="http://ftp.free.fr/mirrors/mageia.org/iso/$MAGEIA_VERSION/Mageia-$MAGEIA_VERSION-$ARCH/Mageia-$MAGEIA_VERSION-$ARCH.iso" |
ISO_MD5="http://ftp.free.fr/mirrors/mageia.org/iso/$MAGEIA_VERSION/Mageia-$MAGEIA_VERSION-$ARCH/Mageia-$MAGEIA_VERSION-$ARCH.iso.md5" |
# RPMs |
RPM_DIR="/root/rpms" |
BASE_RPM_LIST="acpi acpid alsa-utils aoss arp-scan basesystem bash-completion coreutils-doc cpupower curl dhcp-client dmraid dnf dnf-plugins-core dosfstools dracut drakx-net-text gpm grub2 grub2-efi grub2-mageia-theme harddrake hdparm hexedit info iwlwifi-agn-ucode kernel-server-latest kernel-firmware kernel-firmware-nonfree ldetect lftp lib64alsa-plugins lib64glib-networking-gnutls locales-en locales-fr lsof lvm2 mageia-theme-Default man-db mandi-ifw man-pages microcode microcode_ctl mtools ntfs-3g numlock os-prober p11-kit perl-Hal-Cdroms plymouth procmail python3 python3-dbus radeon-firmware ralink-firmware rtlwifi-firmware sharutils shorewall-ipv6 strace sysfsutils tmpwatch tree vim-minimal vnstat xdg-user-dirs-gtk sudo socat" |
####################### |
###### Functions ###### |
################################################################################ |
# Print the given error message and exit 1 |
function errorExit() |
{ |
tput bold |
echo -e "ERROR : $1 \nAborting\n" >&2 |
echo "$1" > "$LOG_FILE" |
tput sgr0 |
exit 1 |
} |
#------------------------------------------------------------------------------- |
# Print progress bar. $1 is a multiple of five |
function printProgress() |
{ |
local a |
let "a = $1 / 5" |
let "b = 25 - $a" |
progressStr=$(printf "%${a}s") |
progressStrBlanks=$(printf "%${b}s") |
echo -en "Downloading...$1% [${progressStr// /#}${progressStrBlanks// / }]\r" |
} |
#------------------------------------------------------------------------------- |
function printBold() |
{ |
tput bold 2>/dev/null |
echo $1 |
tput sgr0 2>/dev/null |
} |
####################### |
###### Main ###### |
################################################################################ |
# Retrieve list of Alcasar dependencies |
tar -xf /var/iso/$ALCASAR_TAR -C /tmp/ || errorExit "could not extract alcasar tar archive" |
alcasarRpmList="$(grep -oP "(?<=PACKAGES=\").*?(?=\")" /tmp/$ALCASAR_EXTRACTED_DIR/scripts/alcasar-urpmi.sh)" |
alcasarKernel="$(grep -oP "(?<=KERNEL=\").*?(?=\")" /tmp/$ALCASAR_EXTRACTED_DIR/scripts/alcasar-urpmi.sh)" |
alcasarRpmList="$alcasarRpmList $alcasarKernel" |
# Make clean rpm list |
rpmList=$(echo $BASE_RPM_LIST $alcasarRpmList | sed "s/ /\n/g" | sort | uniq | sed "s/\n/ /g") |
# Insert list into AUTO_INSTALL_CFG |
formattedList=$(echo $rpmList | sed "s/[^ ]*/\'\0\'/g" | sed "s/ /,\n/g" | sed "/kernel-server/d") |
cp "${AUTO_INSTALL_CFG}_template" "$AUTO_INSTALL_CFG" -f |
insertLineNumber=$(grep -n "'default_packages' => " "$AUTO_INSTALL_CFG" | cut -d ':' -f1) |
fileTop=$(head -n "+$insertLineNumber" "$AUTO_INSTALL_CFG") |
fileBottom=$(tail -n "+$insertLineNumber" "$AUTO_INSTALL_CFG" | tail -n +2) |
cat /dev/null > "$AUTO_INSTALL_CFG" |
echo "$fileTop" > "$AUTO_INSTALL_CFG" |
echo "$formattedList" >> "$AUTO_INSTALL_CFG" |
echo "$fileBottom" >> "$AUTO_INSTALL_CFG" |
# Installing tools to create the iso |
printBold "Installing necessary tools" |
dnf install 'dnf-command(download)' -y || errorExit "could not install necessary packages" |
#dnf install 'dnf-command(config-manager)' -y || errorExit "could not install necessary packages" |
dnf config-manager --set-enabled mageia-x86_64-nonfree updates-x86_64-nonfree || errorExit "could not install necessary packages" |
dnf install -y lftp wget cdrkit-genisoimage xorriso rpmtools syslinux || errorExit "could not install necessary packages" |
# Directories initialization |
#------------------------------------------------------------------------------- |
[[ ! -d "$RPM_DIR" ]] && mkdir -p "$RPM_DIR" |
# Beggining work on the ISO |
#------------------------------------------------------------------------------- |
# Checking the optional Mageia image. If not present or does not match the |
# docker's version, download it |
if [[ ! -f "$ISO_IN" ]]; then |
printBold "Downloading the Mageia iso" |
cd $ISO_DIR || errorExit "could not cd to $ISO_DIR" |
echo Installing lftp |
lftpget -c $ISO_SUPPORT || ( cd "$CURRENT_DIR" && errorExit "could not download Mageia iso" ) |
cd $CURRENT_DIR |
fi |
# Mounting the image |
printBold "Mounting the image" |
[[ ! -d "$MAGEIA_OFFICIAL_DIR" ]] && mkdir -p "$MAGEIA_OFFICIAL_DIR" |
mount -o ro,loop "$ISO_IN" "$MAGEIA_OFFICIAL_DIR" || (sleep 5 ; mount -o ro,loop "$ISO_IN" "$MAGEIA_OFFICIAL_DIR" || errorExit "failed mounting $ISO_IN. Running the script again might solve the issue.") |
# Checking ARCHitecture |
[[ -d ${MAGEIA_OFFICIAL_DIR}/x86_64 ]] && ARCH=x86_64 || ARCH=i586 |
# Creating new directory that will contains the "cleared" iso image |
[[ -d ${MAGEIA_NEW_DIR} ]] && rm -rf ${MAGEIA_NEW_DIR} |
mkdir ${MAGEIA_NEW_DIR} |
# Copying main files except core and nonfree directories |
echo "Extracting base image..." |
cd $MAGEIA_OFFICIAL_DIR && \ |
tar cf - --exclude=${ARCH}/media . | (cd $MAGEIA_NEW_DIR && tar xf - ) && cd "${CURRENT_DIR}" |
# Creating new directories core and nonfree and dir for alcasar stufs |
mkdir -p ${MAGEIA_NEW_DIR}/${ARCH}/{media/{core,nonfree},install/alcasar} |
# Adding Alcasar image advert to the installer |
cp -f /var/iso/install_slideshow/* "$ADVERT_DIR" |
# Retrieving core and nonfree dirs (official) |
coreDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/core |
nonFreeDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/nonfree |
# Retrieving core and nonfree dirs (new) |
coreDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/core/ |
nonFreeDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/nonfree |
plopFilePath=${MAGEIA_NEW_DIR}/${ARCH}/media/plop.idx |
# Initializing counts |
count=0 |
# Getting list of rpms needed by Mageia |
#mageiaRpms="$(cat $MINIMAL_rpmList)" |
# Copying the RPM in core and nonfree and clearing the plop.idx file |
echo "Copying RPMS in ISO ..." |
echo /dev/null > ${plopFilePath} |
dnf upgrade -y |
installedList="$(dnf list installed | cut -d ' ' -f1 | rev | cut -d . -f2- | rev | tail -n +2 | tr '\n' ' ')" |
nbInstalled=$(echo $installedList | wc -w) |
rpmList="$installedList $BASE_RPM_LIST $alcasarRpmList" |
total=`echo $rpmList | wc -w` |
for rpm in ${rpmList}; do |
let percent="${count} * 100 / ${total}" |
if [[ $count -lt $nbInstalled ]] ; then |
dnf reinstall -y --downloadonly --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm" |
else |
dnf install -y --downloadonly --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm" |
fi |
printProgress ${percent} |
count=$(expr ${count} + 1) |
done |
# Sorting the plop file alphabetically |
cat ${plopFilePath} | sort > /tmp/tmpFileMageia && mv /tmp/tmpFileMageia ${plopFilePath} |
# Informations |
printBold "$count RPMs copied" |
# Downloading rpms needed by Alcasar |
cd "$CURRENT_DIR" |
printBold "Downloading Alcasar dependencies" |
tar -xf /var/iso/$ALCASAR_TAR |
# Copying the Alcasar tar to be put into the ISO |
cp /var/iso/$ALCASAR_TAR $INSTALLER_DIR/ |
# Add automatic install options |
mkdir -p $INSTALLER_DIR || errorExit "could not create directory $INSTALLER_DIR" |
cp $AUTO_INSTALL_CFG $INSTALLER_DIR || errorExit "could not copy $AUTO_INSTALL_CFG to $INSTALLER_DIR" |
# Generating media info for core |
echo "Generating media_info for core..." |
genhdlist2 ${coreDirNew} --allow-empty-media --quiet |
echo "Generating media_info for nonfree..." |
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet |
# Puting pubkeys in media_info |
cp ${coreDir}/media_info/pubkey ${coreDirNew}/media_info/ |
cp ${nonFreeDir}/media_info/pubkey ${nonFreeDirNew}/media_info/ |
# Retrieving media.cfg & compssUsers.pl depending on the arch |
mkdir ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info |
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/compssUsers.pl ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/compssUsers.pl |
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/media.cfg ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/media.cfg |
# Specify install configuration |
#sed -i -e 's*rdz*rdz kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g' ${MAGEIA_NEW_DIR}/isolinux/isolinux.cfg |
sed -i -e 's*noiswmd*noiswmd kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g' $EFI_GRUB_CFG |
# Generating distr |
echo "Generating mirror tree..." |
gendistrib -s ${MAGEIA_NEW_DIR}/${ARCH} |
# Creating the new iso file |
echo "Creating the isofile..." |
alcasarVersion=$(echo $ALCASAR_TAR | cut -d '-' -f2 | rev | cut -d '.' -f 3- | rev ) |
newIsoName=Mageia-$MAGEIA_VERSION-${ARCH}-Alcasar${alcasarVersion}.iso |
# Generating the iso file |
# Parameters for xorriso found using the following command on the original mageia iso |
# xorriso -indev Mageia-7-x86_64.iso -report_el_torito as_mkisofs |
cd ${MAGEIA_NEW_DIR} && xorriso -as mkisofs \ |
-V 'Mageia-7.1-x86_64' \ |
--grub2-mbr --interval:local_fs:0s-15s:zero_mbrpt:${ISO_IN} \ |
-partition_cyl_align off \ |
-partition_offset 0 \ |
--mbr-force-bootable \ |
-append_partition 2 0xef --interval:local_fs:8785156d-8793347d::${ISO_IN} \ |
-iso_mbr_part_type 0x00 \ |
-c '/boot.catalog' \ |
-b '/boot/grub2/eltorito.img' \ |
-no-emul-boot \ |
-boot-load-size 4 \ |
-boot-info-table \ |
--grub2-boot-info \ |
-eltorito-alt-boot \ |
-e '--interval:appended_partition_2_start_2196289s_size_8192d:all::' \ |
-no-emul-boot \ |
-boot-load-size 8192 \ |
-o ${CURRENT_DIR}/${newIsoName} . |
# Unmounting |
echo "Umounting..." |
umount ${MAGEIA_OFFICIAL_DIR} && rmdir ${MAGEIA_OFFICIAL_DIR} |
# Removing temporary dir |
rm -rf ${MAGEIA_NEW_DIR} |
mv ${CURRENT_DIR}/${newIsoName} /var/iso/ |
# Finished |
rm -f "$AUTO_INSTALL_CFG" |
echo "Done." |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:executable |
+* |
\ No newline at end of property |
/iso/ressources/install_slideshow/02_IM_mageia.pl |
---|
0,0 → 1,0 |
$title = N("Make it yours!"); |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/iso/ressources/install_slideshow/02_IM_mageia.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/iso/ressources/install_slideshow/list |
---|
1,3 → 1,2 |
01_IM_mageia.png |
02_IM_mageia.png |
alcasar.png |
/iso/README.md |
---|
1,27 → 1,34 |
Mageia + ALCASAR (Mageiar) ISO builder |
Mageiar ISO builder |
=================== |
Goal |
---- |
The goal is to create a minimalist ISO image to install both Mageia and Alcasar with all its dependencies. |
The goal here is to create a minimalist ISO image to install both Mageia and Alcasar with all its dependencies, wth only one command. |
How it works |
------------ |
The script lists the RPMs installed on a running ALCASAR in order to download them from Internet repository. |
Then, it downloads the RPM need to create an ISO file. |
Once the ISO is done, one can boot on it and install the OS normally. The ALCASAR archive is copied in /root folder |
The script uses an official Mageia docker image to retrieve a recursive list of dependecies that are downloaded and packaged in the installation ISO. Alcasar dependencies list, as well as its kernel version, are retrieved from the Alcasar tar archive. |
Once the ISO is done, one can boot on it and install the OS normally. The dependencies are installed along the basesystem packages, which means that the Alcasar installer will only download updates. |
What it needs |
------------- |
The Mageia ISO image and ALCASAR archive are to be placed in the `ressources` directory before running the script. |
The script can be provided with both the Alcasar tar archive as well as the Mageia ISO image. |
The Alcasar archive can be given in argument using the `-a` option. Otherwise it will be downloaded automatically in its latest version. |
The Mageia ISO image is to be placed in the `ressources` directory. |
If Mageia image has been provided, it will be downloaded in the docker. |
This is because the version has to match the one in the docker |
The script's only dependency is the docker service. All other dependencies, such as the RPM and ISO tools, will be installed within the docker. |
How to use |
---------- |
Usage : build-iso.sh |
Usage : buildMageiar [-a alcasar.tar.gz] |
What can be done |
---------------- |
29,6 → 36,5 |
The ISO image seems to be already as light as it can be. With all the necessary packages, it weighs around 800Mo. |
Here is a list of interesting functionnalities: |
- if a needed RPM has not been updated, copy it from the Mageia iso file instead of download it from repository |
- Use DrakX to install and configure Alcasar graphically |
- Propose an automatic partition table suitable for Alcasar |
/iso/buildMageiar.sh |
---|
0,0 → 1,109 |
#!/bin/bash |
####################### |
###### Variables ###### |
################################################################################ |
# Script variables |
CURRENT_DIR="$(readlink -f "$(dirname $0)")" |
RESSOURCES="$CURRENT_DIR/ressources" |
SCRIPTS_DIR="$CURRENT_DIR/scripts" |
SCRIPTS_TMP_DIR="$CURRENT_DIR/scripts_tmp" |
BUILDER_SCRIPT="build-image.sh" |
LOG_FILE="${CURRENT_DIR}/mageiarBuilder.log" |
####################### |
###### Functions ###### |
################################################################################ |
# Print the given error message and exit 1 |
function errorExit() |
{ |
tput bold |
echo -e "ERROR : $1 \nAborting\n" >&2 |
echo "$1" > "$LOG_FILE" |
tput sgr0 |
exit 1 |
} |
#------------------------------------------------------------------------------- |
function printBold() |
{ |
tput bold 2>/dev/null |
echo $1 |
tput sgr0 2>/dev/null |
} |
####################### |
###### Main ###### |
################################################################################ |
# Check root |
[[ $(whoami) != 'root' ]] && errorExit 'Please run as root' |
# Check options |
while getopts "a:h" option; do |
case $option in |
a) # Alcasar image |
alcasarTar="$(echo $OPTARG | rev | cut -d '/' -f 1 | rev)" |
[[ ! -f "$OPTARG" ]] && errorExit "could not find $OPTARG" |
# Copy the image in the ressource directory to be accessible from the docker |
printBold "Copying $OPTARG" in $RESSOURCES |
rsync -usP "$OPTARG" "$RESSOURCES/$alcasarTar" || \ |
errorExit "could not copy $OPTARG to $RESSOURCES" |
;; |
*) |
echo "Usage : buildMageiar [-a alcasar.tar.gz]" |
exit 1 |
;; |
esac |
done |
# Check if auto_inst.cfg.pl is present |
[[ ! -f "$RESSOURCES/auto_inst.cfg.pl_template" ]] && errorExit "No auto_inst.cfg.pl_template file in $RESSOURCES" |
#------------------------------------------------------------------------------- |
# If needed, download Alcasar image |
#------------------------------------------------------------------------------- |
if [[ -z $alcasarTar ]]; then |
latestAlcasarVersion="-$(dig version.alcasar.net txt | \ |
grep "ANSWER SECTION" -A 1 | \ |
grep version | cut -d '"' -f2 || \ |
errorExit "could not retrieve Alcasar latest version")" |
alcasarTar="alcasar$latestAlcasarVersion.tar.gz" |
printBold "Downloading Alcasar image" |
wget -O "$RESSOURCES/$alcasarTar" "ftp.alcasar.net:/pub/stable/$alcasarTar" || errorExit 'could not download Alcasar' |
fi |
# |
# If Mageia image isn't provided here, it will be downloaded in the docker. |
# This is because the version has to match the one in the docker |
# |
#------------------------------------------------------------------------------- |
# Run docker image |
#------------------------------------------------------------------------------- |
systemctl start docker || errorExit 'could not start docker service' |
# Copy script folder to temporary one |
cp -r "$SCRIPTS_DIR" "$SCRIPTS_TMP_DIR" |
printBold "Running mageia docker" |
docker run --privileged --rm --volume "$RESSOURCES":/var/iso --volume "$SCRIPTS_TMP_DIR":/root/ -it mageia "/root/$BUILDER_SCRIPT" "$alcasarTar" |
[[ -d "$SCRIPTS_TMP_DIR" ]] && rm -Rf "$SCRIPTS_TMP_DIR" 2>/dev/null |
# Retrieve created iso image |
mv "$RESSOURCES"/Mageia*Alcasar* "$CURRENT_DIR" 2>/dev/null |
# Give it to SUDO_USER if exists |
[[ ! -z $SUDO_USER ]] && chown -R $SUDO_USER "$CURRENT_DIR"/* 2>/dev/null |
#------------------------------------------------------------------------------- |
# Stopping |
#------------------------------------------------------------------------------- |
read -p 'Stop docker service ? [Y/n] : ' ynAnswer |
[[ ! $ynAnswer = [nN] ]] && systemctl stop docker |
#------------------------------------------------------------------------------- |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:executable |
+* |
\ No newline at end of property |