Subversion Repositories ALCASAR

Rev

Rev 2947 | Rev 3114 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2947 Rev 2950
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# Build Mageiar (Mageia + ALCASAR) ISO file
3
# Build Mageiar (Mageia + ALCASAR) ISO file
4
# Authors: Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux - Aurelien Dubois - Pierre Rivault
4
# Authors: Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux - Aurelien Dubois - Pierre Rivault
5
#
5
#
6
####################################
6
####################################
7
###### Variables & functions  ######
7
###### Variables & functions  ######
8
################################################################################
8
################################################################################
9
 
9
 
10
CURRENT_DIR="$(readlink -f "$(dirname $0)")"
10
CURRENT_DIR="$(readlink -f "$(dirname $0)")"
11
LOG_FILE="$CURRENT_DIR/build-image.log"
11
LOG_FILE="$CURRENT_DIR/build-image.log"
12
RESSOURCES="$CURRENT_DIR/ressources"
12
RESSOURCES="$CURRENT_DIR/ressources"
13
 
13
 
14
# Print the given error message and exit 1
14
# Print the given error message and exit 1
15
function errorExit()
15
function errorExit()
16
{
16
{
17
    tput bold
17
    tput bold
18
    echo -e "ERROR : $1 \nAborting\n" >&2
18
    echo -e "ERROR : $1 \nAborting\n" >&2
19
    echo "$1" > "$LOG_FILE"
19
    echo "$1" > "$LOG_FILE"
20
    tput sgr0
20
    tput sgr0
21
    exit 1
21
    exit 1
22
}
22
}
23
#-------------------------------------------------------------------------------
23
#-------------------------------------------------------------------------------
24
# Print progress bar. $1 is a multiple of five
24
# Print progress bar. $1 is a multiple of five
25
function printProgress()
25
function printProgress()
26
{
26
{
27
    local a
27
    local a
28
    let "a = $1 / 5"
28
    let "a = $1 / 5"
29
    let "b = 25 - $a"
29
    let "b = 25 - $a"
30
    progressStr=$(printf "%${a}s")
30
    progressStr=$(printf "%${a}s")
31
    progressStrBlanks=$(printf "%${b}s")
31
    progressStrBlanks=$(printf "%${b}s")
32
    echo -en "Downloading...$1% [${progressStr// /#}${progressStrBlanks// / }]\r"
32
    echo -en "Downloading...$1% [${progressStr// /#}${progressStrBlanks// / }]\r"
33
}
33
}
34
#-------------------------------------------------------------------------------
34
#-------------------------------------------------------------------------------
35
function printBold()
35
function printBold()
36
{
36
{
37
    tput bold 2>/dev/null
37
    tput bold 2>/dev/null
38
    echo $1
38
    echo $1
39
    tput sgr0 2>/dev/null
39
    tput sgr0 2>/dev/null
40
}
40
}
41
 
41
 
42
ISO_IN=`ls $RESSOURCES | grep '^Mageia.*iso'`
42
ISO_IN=`ls $RESSOURCES | grep '^Mageia.*iso'`
-
 
43
FULL_PATH_ISO_IN=$CURRENT_DIR/ressources/$ISO_IN
43
MAGEIA_VERSION=`echo $ISO_IN|cut -d"-" -f2`
44
MAGEIA_VERSION=`echo $ISO_IN|cut -d"-" -f2`
44
ARCH=`echo $ISO_IN |cut -d"-" -f3|cut -d"." -f1`
45
ARCH=`echo $ISO_IN |cut -d"-" -f3|cut -d"." -f1`
45
ALCASAR_TARBALL=`ls $RESSOURCES| grep '^alcasar.*gz'`
46
ALCASAR_TARBALL=`ls $RESSOURCES| grep '^alcasar.*gz'`
46
ALCASAR_EXTRACTED_DIR=$(echo $ALCASAR_TARBALL | rev | cut -d '.' -f 3- | rev)
47
ALCASAR_EXTRACTED_DIR=$(echo $ALCASAR_TARBALL | rev | cut -d '.' -f 3- | rev)
47
ALCASAR_VERSION=`echo $ALCASAR_EXTRACTED_DIR | cut -d"-" -f2`
48
ALCASAR_VERSION=`echo $ALCASAR_EXTRACTED_DIR | cut -d"-" -f2`
48
TMP_DIR=/var/tmp
49
TMP_DIR=/var/tmp
49
MAGEIA_NEW_DIR=$TMP_DIR/mageia_new
50
MAGEIA_NEW_DIR=$TMP_DIR/mageia_new
50
MAGEIA_OFFICIAL_DIR=$TMP_DIR/mageia_official
51
MAGEIA_OFFICIAL_DIR=$TMP_DIR/mageia_official
51
coreDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/core
52
coreDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/core
52
nonFreeDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/nonfree
53
nonFreeDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/nonfree
53
mediaDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media
54
mediaDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media
54
coreDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/core/
55
coreDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/core/
55
nonFreeDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/nonfree
56
nonFreeDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/nonfree
56
urpmi_cache=/var/cache/urpmi/rpms
57
urpmi_cache=/var/cache/urpmi/rpms
57
 
58
 
58
# Drake installer
59
# Drake installer
59
INSTALLER_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/alcasar"
60
INSTALLER_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/alcasar"
60
EFI_GRUB_CFG="${MAGEIA_NEW_DIR}/boot/grub2/grub.cfg"
61
EFI_GRUB_CFG="${MAGEIA_NEW_DIR}/boot/grub2/grub.cfg"
61
ADVERT_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/extra/advertising"
62
ADVERT_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/extra/advertising"
62
AUTO_INSTALL_CFG=$TMP_DIR/auto_inst.cfg.pl
63
AUTO_INSTALL_CFG=$TMP_DIR/auto_inst.cfg.pl
63
 
64
 
64
# RPMs needed during an install stage
65
# RPMs needed during an install stage
65
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 ldetect lftp lib64alsa-plugins lib64glib-networking-gnutls locales-en locales-fr lsof lvm2 mageia-theme-Default man-db 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 mandi mandi-ifw"
66
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 ldetect lftp lib64alsa-plugins lib64glib-networking-gnutls locales-en locales-fr lsof lvm2 mageia-theme-Default man-db 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 mandi mandi-ifw"
66
ISO_RPM_LIST="cdrkit-genisoimage xorriso rpmtools syslinux"
67
ISO_RPM_LIST="cdrkit-genisoimage xorriso rpmtools syslinux"
67
 
68
 
68
#######################
69
#######################
69
######    Main    ######
70
######    Main    ######
70
################################################################################
71
################################################################################
71
 
72
 
72
# Some checks
73
# Some checks
73
[[ $(whoami) != 'root' ]] && errorExit 'Please run as root'
74
[[ $(whoami) != 'root' ]] && errorExit 'Please run as root'
74
[[ $ISO_IN == "" ]] && errorExit "No Mageia iso file in $RESSOURCES"
75
[[ $ISO_IN == "" ]] && errorExit "No Mageia iso file in $RESSOURCES"
75
[[ ! -f "$RESSOURCES/auto_inst.cfg.pl_template" ]] && errorExit "No auto_inst.cfg.pl_template file in $RESSOURCES"
76
[[ ! -f "$RESSOURCES/auto_inst.cfg.pl_template" ]] && errorExit "No auto_inst.cfg.pl_template file in $RESSOURCES"
76
[[ $ALCASAR_TARBALL == "" ]] && errorExit "No ALCASAR tarball file in $RESSOURCES"
77
[[ $ALCASAR_TARBALL == "" ]] && errorExit "No ALCASAR tarball file in $RESSOURCES"
77
 
78
 
78
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
79
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
79
do
80
do
80
	[ -d $directory ] || mkdir -p $directory
81
	[ -d $directory ] || mkdir -p $directory
81
done
82
done
82
printBold "Mageiar will be build with Mageia-$MAGEIA_VERSION-$ARCH and $ALCASAR_EXTRACTED_DIR" 
83
printBold "Mageiar will be build with Mageia-$MAGEIA_VERSION-$ARCH and $ALCASAR_EXTRACTED_DIR" 
83
# Update the system. Keep only RPMs needed to create ALCASAR rpmslist
84
# Update the system. Keep only RPMs needed to create ALCASAR rpmslist
84
urpmi --auto-update --auto 2>/dev/null
85
urpmi --auto-update --auto 2>/dev/null
85
urpme $ISO_RPM_LIST --auto-orphans --force 2>/dev/null
86
urpme $ISO_RPM_LIST --auto-orphans --force 2>/dev/null
86
urpmi $BASE_RPM_LIST --force --auto 2>/dev/null
87
urpmi $BASE_RPM_LIST --force --auto 2>/dev/null
87
# Retrieve list of installed RPM (without those that will be installed with the alcasar install script)
88
# Retrieve list of installed RPM (without those that will be installed with the alcasar install script)
88
RPM_LIST="$(rpm -qa --queryformat "%{NAME}\n"| grep -Ev 'coova-chilli|gammu|lib64gammu8|ipt-netflow|nfdump|wkhtmltopdf' | tr '\n' ' ')"
89
RPM_LIST="$(rpm -qa --queryformat "%{NAME}\n"| grep -Ev 'coova-chilli|gammu|lib64gammu8|ipt-netflow|nfdump|wkhtmltopdf' | tr '\n' ' ')"
89
 
90
 
90
# Insert list into AUTO_INSTALL_CFG
91
# Insert list into AUTO_INSTALL_CFG
91
formattedList=$(echo $RPM_LIST | sed "s/[^ ]*/\'\0\'/g" | sed "s/ /,\n/g")
92
formattedList=$(echo $RPM_LIST | sed "s/[^ ]*/\'\0\'/g" | sed "s/ /,\n/g")
92
cp -f $RESSOURCES/auto_inst.cfg.pl_template $AUTO_INSTALL_CFG
93
cp -f $RESSOURCES/auto_inst.cfg.pl_template $AUTO_INSTALL_CFG
93
insertLineNumber=$(grep -n "'default_packages' => " "$AUTO_INSTALL_CFG" | cut -d ':' -f1)
94
insertLineNumber=$(grep -n "'default_packages' => " "$AUTO_INSTALL_CFG" | cut -d ':' -f1)
94
fileTop=$(head -n "+$insertLineNumber" "$AUTO_INSTALL_CFG")
95
fileTop=$(head -n "+$insertLineNumber" "$AUTO_INSTALL_CFG")
95
fileBottom=$(tail -n "+$insertLineNumber" "$AUTO_INSTALL_CFG" | tail -n +2)
96
fileBottom=$(tail -n "+$insertLineNumber" "$AUTO_INSTALL_CFG" | tail -n +2)
96
cat /dev/null > "$AUTO_INSTALL_CFG"
97
cat /dev/null > "$AUTO_INSTALL_CFG"
97
echo "$fileTop" > "$AUTO_INSTALL_CFG"
98
echo "$fileTop" > "$AUTO_INSTALL_CFG"
98
echo "$formattedList" >> "$AUTO_INSTALL_CFG"
99
echo "$formattedList" >> "$AUTO_INSTALL_CFG"
99
echo "$fileBottom" >> "$AUTO_INSTALL_CFG"
100
echo "$fileBottom" >> "$AUTO_INSTALL_CFG"
100
 
101
 
101
# Installing tools to create the iso file
102
# Installing tools to create the iso file
102
printBold "Installing ISO building tools"
103
printBold "Installing ISO building tools"
103
#dnf install -y $ISO_RPM_LIST || errorExit "could not install necessary packages"
104
#dnf install -y $ISO_RPM_LIST || errorExit "could not install necessary packages"
104
urpmi $ISO_RPM_LIST --force|| errorExit "could not install necessary packages"
105
urpmi $ISO_RPM_LIST --force|| errorExit "could not install necessary packages"
105
 
106
 
106
# Mounting the ISO image
107
# Mounting the ISO image
107
printBold "Mounting the image"
108
printBold "Mounting the image"
108
if [ `mount |grep $MAGEIA_OFFICIAL_DIR | wc -l` -eq 0 ]; then # if not already mounted
109
if [ `mount |grep $MAGEIA_OFFICIAL_DIR | wc -l` -eq 0 ]; then # if not already mounted
109
	mount -o ro,loop $RESSOURCES/$ISO_IN $MAGEIA_OFFICIAL_DIR || errorExit "failed mounting $ISO_IN."
110
	mount -o ro,loop $RESSOURCES/$ISO_IN $MAGEIA_OFFICIAL_DIR || errorExit "failed mounting $ISO_IN."
110
fi
111
fi
111
sleep 1 # wait for mounting process
112
sleep 1 # wait for mounting process
112
[ -d ${MAGEIA_OFFICIAL_DIR}/x86_64 ] || umount $MAGEIA_OFFICIAL_DIR || errorExit "The ISO file isn't in the target architecture ($ARCH)" 
113
[ -d ${MAGEIA_OFFICIAL_DIR}/x86_64 ] || umount $MAGEIA_OFFICIAL_DIR || errorExit "The ISO file isn't in the target architecture ($ARCH)" 
113
 
114
 
114
# Copying main files except core and nonfree directories
115
# Copying main files except core and nonfree directories
115
echo "Extracting base image..."
116
echo "Extracting base image..."
116
cd $MAGEIA_OFFICIAL_DIR && \
117
cd $MAGEIA_OFFICIAL_DIR && \
117
    tar cf - --exclude=${ARCH}/media . | (cd $MAGEIA_NEW_DIR && tar xf - ) && cd "${CURRENT_DIR}"
118
    tar cf - --exclude=${ARCH}/media . | (cd $MAGEIA_NEW_DIR && tar xf - ) && cd "${CURRENT_DIR}"
118
 
119
 
119
# Creating new directories core and nonfree and dir for alcasar stufs
120
# Creating new directories core and nonfree and dir for alcasar stufs
120
mkdir -p ${MAGEIA_NEW_DIR}/${ARCH}/{media/{core,nonfree},install/alcasar}
121
mkdir -p ${MAGEIA_NEW_DIR}/${ARCH}/{media/{core,nonfree},install/alcasar}
121
 
122
 
122
# Adding Alcasar image advert to the installer
123
# Adding Alcasar image advert to the installer
123
cp -f $RESSOURCES/install_slideshow/* "$ADVERT_DIR" || errorExit "could not copy custom slideshow to $ADVERT_DIR"
124
cp -f $RESSOURCES/install_slideshow/* "$ADVERT_DIR" || errorExit "could not copy custom slideshow to $ADVERT_DIR"
124
 
125
 
125
# Create the installed RPM list excluding those brought with alcasar archive (they aren't in repository)
126
# Create the installed RPM list excluding those brought with alcasar archive (they aren't in repository)
126
nbInstalled=$(echo $RPM_LIST | wc -w)
127
nbInstalled=$(echo $RPM_LIST | wc -w)
127
total=`echo $RPM_LIST | wc -w`
128
total=`echo $RPM_LIST | wc -w`
128
count=0
129
count=0
129
# Copying the RPM in core and clearing the plop.idx file
130
# Copying the RPM in core and clearing the plop.idx file
130
echo "Copying $total RPMS in ISO ..."
131
echo "Copying $total RPMS in ISO ..."
131
for rpm in ${RPM_LIST}; do
132
for rpm in ${RPM_LIST}; do
132
	let percent="${count} * 100 / ${total}"
133
	let percent="${count} * 100 / ${total}"
133
	full_rpm_name=`rpm -q $rpm`
134
	full_rpm_name=`rpm -q $rpm`
134
	if [ `ls $urpmi_cache/$full_rpm_name* 2>/dev/null | wc -l` -ne 1 ] ; then  # rpm isn't already in $urpmi_cache
135
	if [ `ls $urpmi_cache/$full_rpm_name* 2>/dev/null | wc -l` -ne 1 ] ; then  # rpm isn't already in $urpmi_cache
135
		if [ `ls $coreDir/$full_rpm_name* 2>/dev/null | wc -l` -eq 1 ] ; then  # rpm is in official ISO file
136
		if [ `ls $coreDir/$full_rpm_name* 2>/dev/null | wc -l` -eq 1 ] ; then  # rpm is in official ISO file
136
			cp $coreDir/$full_rpm_name* $urpmi_cache/
137
			cp $coreDir/$full_rpm_name* $urpmi_cache/
137
		else # rpm must be downloaded
138
		else # rpm must be downloaded
138
			# dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm"
139
			# dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm"
139
			urpmi --no-install --replacepkgs -q $rpm 2> /dev/null || urpmi --no-install -q --force $rpm 2> /dev/null || echo "could not download $rpm"
140
			urpmi --no-install --replacepkgs -q $rpm 2> /dev/null || urpmi --no-install -q --force $rpm 2> /dev/null || echo "could not download $rpm"
140
		fi
141
		fi
141
	fi
142
	fi
142
	printProgress ${percent}
143
	printProgress ${percent}
143
	count=$(expr ${count} + 1)
144
	count=$(expr ${count} + 1)
144
done
145
done
145
printBold "$count RPMs copied"
146
printBold "$count RPMs copied"
146
# Copying the Alcasar tarball & automatic install option into the ISO
147
# Copying the Alcasar tarball & automatic install option into the ISO
147
mkdir -p $INSTALLER_DIR || errorExit "could not create directory $INSTALLER_DIR"
148
mkdir -p $INSTALLER_DIR || errorExit "could not create directory $INSTALLER_DIR"
148
cp $RESSOURCES/$ALCASAR_TARBALL $INSTALLER_DIR || errorExit "could not copy $RESSOURCES/$ALCASAR_TARBALL to $INSTALLER_DIR"
149
cp $RESSOURCES/$ALCASAR_TARBALL $INSTALLER_DIR || errorExit "could not copy $RESSOURCES/$ALCASAR_TARBALL to $INSTALLER_DIR"
149
cp $AUTO_INSTALL_CFG $INSTALLER_DIR || errorExit "could not copy $AUTO_INSTALL_CFG to $INSTALLER_DIR"
150
cp $AUTO_INSTALL_CFG $INSTALLER_DIR || errorExit "could not copy $AUTO_INSTALL_CFG to $INSTALLER_DIR"
150
 
151
 
151
mv $urpmi_cache/*.rpm $coreDirNew
152
mv $urpmi_cache/*.rpm $coreDirNew
152
# Generating media info for core
153
# Generating media info for core
153
echo "Generating media_info for core..."
154
echo "Generating media_info for core..."
154
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
155
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
155
echo "Generating media_info for nonfree..."
156
echo "Generating media_info for nonfree..."
156
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
157
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
157
 
158
 
158
# Puting pubkeys in media_info
159
# Puting pubkeys in media_info
159
cp ${coreDir}/media_info/pubkey ${coreDirNew}/media_info/
160
cp ${coreDir}/media_info/pubkey ${coreDirNew}/media_info/
160
cp ${nonFreeDir}/media_info/pubkey ${nonFreeDirNew}/media_info/
161
cp ${nonFreeDir}/media_info/pubkey ${nonFreeDirNew}/media_info/
161
 
162
 
162
# Retrieving media.cfg & compssUsers.pl depending on the arch
163
# Retrieving media.cfg & compssUsers.pl depending on the arch
163
mkdir ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info
164
mkdir ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info
164
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/compssUsers.pl ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/compssUsers.pl
165
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/compssUsers.pl ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/compssUsers.pl
165
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/media.cfg ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/media.cfg
166
cp ${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/media_info/media.cfg ${MAGEIA_NEW_DIR}/${ARCH}/media/media_info/media.cfg
166
 
167
 
167
# Specify install configuration
168
# Specify install configuration
168
#sed -i -e 's*rdz*rdz kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g'  ${MAGEIA_NEW_DIR}/isolinux/isolinux.cfg
169
#sed -i -e 's*rdz*rdz kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g'  ${MAGEIA_NEW_DIR}/isolinux/isolinux.cfg
169
sed -i -e 's*noiswmd*noiswmd kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g'  $EFI_GRUB_CFG 
170
sed -i -e 's*noiswmd*noiswmd kickstart=/tmp/media/x86_64/install/alcasar/auto_inst.cfg.pl*g'  $EFI_GRUB_CFG 
170
 
171
 
171
# Generating distr
172
# Generating distr
172
echo "Generating mirror tree..."
173
echo "Generating mirror tree..."
173
gendistrib -s ${MAGEIA_NEW_DIR}/${ARCH}
174
gendistrib -s ${MAGEIA_NEW_DIR}/${ARCH}
174
 
175
 
175
# Creating the new iso file
176
# Creating the new iso file
176
echo "Creating the isofile..."
177
echo "Creating the isofile..."
177
newIsoName=Mageia-$MAGEIA_VERSION-${ARCH}-Alcasar-$ALCASAR_VERSION.iso
178
newIsoName=Mageia-$MAGEIA_VERSION-${ARCH}-Alcasar-$ALCASAR_VERSION.iso
178
 
179
 
179
# Generating the iso file
180
# Generating the iso file
180
# Parameters for xorriso found using the following command on the original mageia iso
181
# Parameters for xorriso found using the following command on the Magiea iso file used in ressource folder
181
# xorriso -indev Mageia-7-x86_64.iso -report_el_torito as_mkisofs
182
# ex: xorriso -indev Mageia-7.1-x86_64.iso -report_el_torito as_mkisofs
182
cd ${MAGEIA_NEW_DIR} && xorriso -as mkisofs \
183
cd ${MAGEIA_NEW_DIR} && xorriso -as mkisofs \
183
	-V 'Mageia-7.1-x86_64' \
184
	-V 'Mageia-7.1-x86_64' \
-
 
185
	--grub2-mbr --interval:local_fs:0s-15s:zero_mbrpt:$FULL_PATH_ISO_IN \
184
	-partition_cyl_align off \
186
	-partition_cyl_align off \
185
	-partition_offset 0 \
187
	-partition_offset 0 \
186
	--mbr-force-bootable \
188
	--mbr-force-bootable \
-
 
189
	-append_partition 2 0xef --interval:local_fs:8785156d-8793347d::$FULL_PATH_ISO_IN \
187
	-iso_mbr_part_type 0x00 \
190
	-iso_mbr_part_type 0x00 \
188
	-c 'boot.catalog' \
191
	-c /boot.catalog \
189
	-b 'boot/grub2/eltorito.img' \
192
	-b /boot/grub2/eltorito.img \
190
	-no-emul-boot \
193
	-no-emul-boot \
191
	-boot-load-size 4 \
194
	-boot-load-size 4 \
192
	-boot-info-table \
195
	-boot-info-table \
193
	--grub2-boot-info \
196
	--grub2-boot-info \
194
	-eltorito-alt-boot \
197
	-eltorito-alt-boot \
-
 
198
	-e '--interval:appended_partition_2_start_2196289s_size_8192d:all::' \
-
 
199
	-no-emul-boot \
195
	-boot-load-size 8192 \
200
	-boot-load-size 8192 \
196
	-o ${TMP_DIR}/${newIsoName} .
201
	-o ${TMP_DIR}/${newIsoName} .
197
 
202
 
198
# Unmounting & Removing temporary dir
203
# Unmounting & Removing temporary dir
199
echo "Umounting..."
204
echo "Umounting..."
200
umount $MAGEIA_OFFICIAL_DIR
205
umount $MAGEIA_OFFICIAL_DIR
201
mv $coreDirNew/*.rpm $urpmi_cache
206
mv $coreDirNew/*.rpm $urpmi_cache
202
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
207
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
203
do
208
do
204
	[ -d $directory ] && rm -rf $directory
209
	[ -d $directory ] && rm -rf $directory
205
done
210
done
206
rm -f "$AUTO_INSTALL_CFG"
211
rm -f "$AUTO_INSTALL_CFG"
207
echo "All RPM are always in $urpmi_cache. Remove them if nedded."
212
echo "All RPM are always in $urpmi_cache. Remove them if nedded."
208
echo "The ISO file is here : ${TMP_DIR}/${newIsoName}"
213
echo "The ISO file is here : ${TMP_DIR}/${newIsoName}"
209
 
214