Subversion Repositories ALCASAR

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2476 → Rev 2477

/iso/procedure-iso_v2.2.odt
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
/iso/scripts/build_alcasar_iso.sh
0,0 → 1,278
#!/bin/bash
#
# Authors: Mageia Team
# Update for ALCASAR : Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux
##
# Usage: $0 ARGS
# --iso-file, -i Mageia-xxx-xxxxxx-xxx.iso (mandatory)
# --config-file, -c Minimal rpm list (mandatory)
# --lang, -l Language for installation (optional)
# Supported languages: fr;en
#
 
# Colors parameters
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
 
# Check if a given option is valid an set a global var with the option value
function optionIsValid() {
# Retrieving option and its value
local option=$1
local value=$2
 
# Available options (short and long)
local configFileOption="--config-file -c"
local isoFileOption="--iso-file -i"
local langOption="--lang -l"
 
# Config file option ?
for opt in ${configFileOption}; do
if [[ ${opt} = ${option} ]]; then
configFile=${value}
return 0
fi
done
 
# Iso file option ?
for opt in ${isoFileOption}; do
if [[ ${opt} = ${option} ]]; then
isoFile=${value}
return 0
fi
done
 
# Language option ?
for opt in ${langOption}; do
if [[ ${opt} = ${option} ]]; then
lang="-${value}"
return 0
fi
done
 
# Unknown option
echo "Unknown option '${option}'. Aborting." && exit 1
}
 
# Check if needed packages are installed
function requiredPackagesInstalled() {
# Checking mkisofs
command -v genisoimage > /dev/null 2>&1 || \
{ echo "The package genisoimage is not installed." && \
genisoimageNotInstalled=1; }
 
# Checking genhdlist2
command -v genhdlist2 > /dev/null 2>&1 || \
{ echo "The package genhdlist2 is not installed." && \
genhdlist2NotInstalled=1; }
 
# Checking gendistrib
command -v gendistrib > /dev/null 2>&1 || \
{ echo "The package gendistrib is not installed (rpmtools)." && \
gendistribNotInstalled=1; }
 
# If one of the following, aborting
[[ ${genisoimageNotInstalled} -eq 1 ]] || \
[[ ${genhdlist2NotInstalled} -eq 1 ]] || \
[[ ${gendistribNotInstalled} -eq 1 ]] && exit 1
}
 
# Check if a given language is supported by this script or not
function languageIsSupported() {
local lang=$1
local supportedLang="fr en"
 
# Comparing with available langs
for supLang in ${supportedLang}; do
if [[ ${supLang} = ${lang} ]]; then
return 0
fi
done
 
# Language is not supported
echo "Language '${lang}' is not supported. Aborting." && exit 1
}
 
# "Purify" the rpm name -> for the plop.idx file ("Mageia-5.1-x86_64 rpmname" for example)
function purifyRpmName() {
local str=$1
local arch=$2
local len=${#str}
 
p=`echo ${str} | grep -oP ".*\.mga6"`
echo "Mageia-6-${arch} ${p}"
}
 
# Checking arguments (rpm_list and iso file and eventually lang)
[[ ($# -lt 4) || ($# -eq 5) || ($# -gt 6) ]] && echo \
"Usage: $0 ARGS
--iso-file, -i Mageia-xxx-xxxxxx-xxx.iso (mandatory)
--config-file, -c Minimal rpm list (mandatory)
--lang, -l Language for installation (optional)
Supported languages: fr;en
" && exit 1
 
# Checking options
optionIsValid $1 $2 && optionIsValid $3 $4
 
# Checking if other options have been specified
[[ $# -eq 6 ]] && optionIsValid $5 $6
 
# Checking that mandatory option have been specified
[[ -z ${isoFile} ]] && { echo "Iso file option is mandatory. Aborting." && exit 1; }
[[ -z ${configFile} ]] && { echo "Configuration file option is mandatory. Aborting." && exit 1; }
 
# Checking validity of options
[[ -f ${configFile} ]] || { echo "Invalid config file. Aborting." && exit 1; }
[[ -f ${isoFile} ]] || { echo "Invalid iso file. Aborting." && exit 1; }
 
# Checking required packages
requiredPackagesInstalled
 
# Actual directory
actualDir=$(pwd)
 
# Retreiving elements in rpm_list
filesInRpm=$(cat ${configFile})
 
# official and new dirs
mageiaNewDir=/tmp/mageia_new
mageiaOfficialDir=/tmp/mageia_official
 
# Checking that executed as root
[[ $(whoami) != "root" ]] && \
{ echo "This script must be executed with root privileges. Aborting." && exit 1; }
 
# Mounting the image
echo "Mounting the image..."
[[ ! -d ${mageiaOfficialDir} ]] && mkdir ${mageiaOfficialDir}
mount -o ro,loop ${isoFile} ${mageiaOfficialDir} || { echo "Failed mounting '${isoFile}'. Aborting." && exit 1; }
 
# Checking architecture
[[ -d ${mageiaOfficialDir}/x86_64 ]] && arch=x86_64 || arch=i586
 
# Creating new directory that will contains the "cleared" iso image
[[ ! -d ${mageiaNewDir} ]] && mkdir ${mageiaNewDir}
 
# Copying main files except core and nonfree directories
echo "Extracting base image..."
cd /tmp/mageia_official && \
tar cf - --exclude=${arch}/media . | (cd /tmp/mageia_new && tar xf - ) && cd "${actualDir}"
 
# Creating new directories core and nonfree and dir for alcasar stufs
mkdir -p ${mageiaNewDir}/${arch}/{media/{core,nonfree},install/alcasar}
 
# Copying configuration files
echo "Copying initial configuration files..."
 
cp -f ${mageiaOfficialDir}"/isolinux/isolinux.bin" ${mageiaNewDir}/isolinux/isolinux.bin
cp ${actualDir}/config/alcasar.tar.gz ${mageiaNewDir}/${arch}/install/alcasar
 
### only if we want to change the normal install procedure ###
#cp ${actualDir}/config/first_login ${mageiaNewDir}/${arch}/install/alcasar
#cp ${actualDir}/config/auto_inst-${arch}${lang}.cfg.pl ${mageiaNewDir}/${arch}/install/alcasar/auto_inst-${arch}.cfg.pl
#cp -f ${actualDir}"/config/isolinux-x86_64.cfg" ${mageiaNewDir}/isolinux/isolinux.cfg
 
# alcasar needed rpms
if [ -f ${actualDir}/rpms-${arch}.tar.gz ]; then
echo -e "${GREEN}RPMs archive found, using it${NC}"
cp ${actualDir}/rpms-${arch}.tar.gz ${mageiaNewDir}/${arch}/install/alcasar
else
echo -e "${RED}config/rpms-x86_64.tar.gz not found, skipping${NC}"
fi
 
# Retrieving core and nonfree dirs (official)
coreDir=${mageiaOfficialDir}/${arch}/media/core
nonFreeDir=${mageiaOfficialDir}/${arch}/media/nonfree
 
# Retrieving core and nonfree dirs (new)
coreDirNew=${mageiaNewDir}/${arch}/media/core/
nonFreeDirNew=${mageiaNewDir}/${arch}/media/nonfree
plopFilePath=${mageiaNewDir}/${arch}/media/plop.idx
 
# Initializing counts
countCore=0
countNonFree=0
 
# Creating the RPM list in core and nonfree and clearing the plop.idx file
echo "Comparing RPMS..."
> ${plopFilePath}
 
# Selecting rpm
for rpm in ${filesInRpm}; do
# Retreiving output of ls in directories
fileInCore=$(ls ${coreDir} | grep "^${rpm}")
fileInNonFree=$(ls ${nonFreeDir} | grep "^${rpm}")
 
# If present in core, copying in core_new
if [[ ! -z ${fileInCore} ]]; then
# Moving RPM
cp "${coreDir}/${fileInCore}" ${coreDirNew}
countCore=$(expr ${countCore} + 1)
 
# Updating the plop.idx
purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
 
# If present in nonfree, copying in nonfree_new
elif [[ ! -z ${fileInNonFree} ]]; then
# Copying RPM
cp "${nonFreeDir}/${fileInNonFree}" ${nonFreeDirNew}
countNonFree=$(expr ${countNonFree} + 1)
 
# Updating the plop.idx
purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
fi
done
 
# Sorting the plop file alphabetically
cat ${plopFilePath} | sort > /tmp/tmpFileMageia && mv /tmp/tmpFileMageia ${plopFilePath}
 
# Informations
echo "${countCore} files kept from core"
echo "${countNonFree} files kept from nonfree"
 
# 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 ${mageiaNewDir}/${arch}/media/media_info
cp ${mageiaOfficialDir}/${arch}/media/media_info/compssUsers.pl ${mageiaNewDir}/${arch}/media/media_info/compssUsers.pl
cp ${mageiaOfficialDir}/${arch}/media/media_info/media.cfg ${mageiaNewDir}/${arch}/media/media_info/media.cfg
 
# Generating distr
echo "Generating mirror tree..."
gendistrib -s ${mageiaNewDir}/${arch}
 
# Creating the new iso file
echo "Creating the isofile..."
newIsoName=Mageia-6-${arch}${lang}-Alcasar.iso
cd ${mageiaNewDir} && genisoimage -quiet -o ${actualDir}/${newIsoName} \
-b isolinux/isolinux.bin \
-c boot.catalog \
-no-emul-boot -boot-load-size 4 \
-boot-info-table -J -R -V "Mageia-6 Alcasar (${arch})" .
 
# Unmounting
echo "Umounting..."
umount ${mageiaOfficialDir} && rmdir ${mageiaOfficialDir}
 
# Removing temporary dir
rm -rf ${mageiaNewDir}
 
# Setting same permissions as the initial image
cd ${actualDir}
chmod --reference=${isoFile} ${newIsoName}
chown --reference=${isoFile} ${newIsoName}
 
# Finished
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/scripts/download_needed_rpm.sh
0,0 → 1,105
#!/bin/bash
#
# Author: Hamza ESSAYEGH (Querdos)
#
# Script used to download all needed package
# for Alcasar.
#
# It must be run on a virtual Mageia 5,
# with ALCASAR installed.
#
 
function print_percentage() {
local percent=$1
if [ ${percent} -lt 5 ]; then
echo -ne "Downloading... [ ] ${percent}%\r"
elif [ ${percent} -lt 10 ]; then
echo -ne "Downloading... [ # ] ${percent}%\r"
elif [ ${percent} -lt 15 ]; then
echo -ne "Downloading... [ ## ] ${percent}%\r"
elif [ ${percent} -lt 20 ]; then
echo -ne "Downloading... [ ### ] ${percent}%\r"
elif [ ${percent} -lt 25 ]; then
echo -ne "Downloading... [ #### ] ${percent}%\r"
elif [ ${percent} -lt 30 ]; then
echo -ne "Downloading... [ ##### ] ${percent}%\r"
elif [ ${percent} -lt 35 ]; then
echo -ne "Downloading... [ ###### ] ${percent}%\r"
elif [ ${percent} -lt 40 ]; then
echo -ne "Downloading... [ ####### ] ${percent}%\r"
elif [ ${percent} -lt 45 ]; then
echo -ne "Downloading... [ ######## ] ${percent}%\r"
elif [ ${percent} -lt 50 ]; then
echo -ne "Downloading... [ ######### ] ${percent}%\r"
elif [ ${percent} -lt 55 ]; then
echo -ne "Downloading... [ ########## ] ${percent}%\r"
elif [ ${percent} -lt 60 ]; then
echo -ne "Downloading... [ ########### ] ${percent}%\r"
elif [ ${percent} -lt 65 ]; then
echo -ne "Downloading... [ ############ ] ${percent}%\r"
elif [ ${percent} -lt 70 ]; then
echo -ne "Downloading... [ ############# ] ${percent}%\r"
elif [ ${percent} -lt 75 ]; then
echo -ne "Downloading... [ ############## ] ${percent}%\r"
elif [ ${percent} -lt 80 ]; then
echo -ne "Downloading... [ ############### ] ${percent}%\r"
elif [ ${percent} -lt 85 ]; then
echo -ne "Downloading... [ ################ ] ${percent}%\r"
elif [ ${percent} -lt 90 ]; then
echo -ne "Downloading... [ ################# ] ${percent}%\r"
elif [ ${percent} -lt 95 ]; then
echo -ne "Downloading... [ ################## ] ${percent}%\r"
elif [ ${percent} -lt 100 ]; then
echo -ne "Downloading... [ ################### ] ${percent}%\r"
elif [ ${percent} == 100 ]; then
echo -ne "Downloading... [ #################### ] ${percent}%\r"
fi
}
 
# Colors parameters
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
 
# Config and RPMS directory
#CONFIG_DIR=$(pwd)"/config"
RPMS_DIR=$(pwd)"/rpms"
CONFIG_FILE=$(pwd)"/alcasar_rpms_x86_64"
 
# Retrieving list of installed RPMS
rpm -qa > ${CONFIG_FILE}
 
# Checking if RPMS dir exists and create it if needed
[[ ! -d ${RPMS_DIR} ]] && mkdir ${RPMS_DIR}
 
# Retrieving files in configuration file
files=$(cat ${CONFIG_FILE})
 
# params for percentage
total=$(wc -l < ${CONFIG_FILE})
count=0
 
# for each package in configuration file
echo -e "${YELLOW}This step may take some time, depending on your connection ...${NC}"
for pckg in ${files}; do
let percent="${count} * 100 / ${total}"
print_percentage ${percent}
 
url=$(urpmq --ignorearch --sources ${pckg} | grep 'updates\|release' | uniq)
wget -P "${RPMS_DIR}" "${url}" --quiet
 
let count="${count}+1"
done
 
echo "Creating the tarball ..."
 
# Creating the tarball
cd ${RPMS_DIR} && tar -czf rpms-x86_64.tar.gz *
 
# Moving it in the root directory
mv rpms-x86_64.tar.gz ../
rm -rf ${RPMS_DIR}
 
echo "Done"
echo
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:executable
+*
\ No newline at end of property