Subversion Repositories ALCASAR

Rev

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

Rev 2484 Rev 2525
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# Authors: Mageia Team
3
# Authors: Mageia Team
4
# Update for ALCASAR : Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux
4
# Update for ALCASAR : Hamza ESSAYEGH (Querdos) - Rexy - Laurent Roux
5
##
5
##
6
# Usage: $0 ARGS
6
# Usage: $0 ARGS
7
#     --iso-file, -i      Mageia-xxx-xxxxxx-xxx.iso (mandatory)
7
#     --iso-file, -i      Mageia-xxx-xxxxxx-xxx.iso (mandatory)
8
#     --lang, -l          Language for installation (optional)
8
#     --lang, -l          Language for installation (optional)
9
#                         Supported languages: fr;en
9
#                         Supported languages: fr;en
10
#
10
#
11
 
11
 
12
# Colors parameters
12
# Colors parameters
13
RED='\033[0;31m'
13
RED='\033[0;31m'
14
GREEN='\033[0;32m'
14
GREEN='\033[0;32m'
15
YELLOW='\033[0;33m'
15
YELLOW='\033[0;33m'
16
NC='\033[0m'
16
NC='\033[0m'
17
 
17
 
18
function print_percentage() {
18
function print_percentage() {
19
    local percent=$1
19
    local percent=$1
20
    if [ ${percent} -lt 5 ]; then
20
    if [ ${percent} -lt 5 ]; then
21
        echo -ne "Downloading... [                      ] ${percent}%\r"
21
        echo -ne "Downloading... [                      ] ${percent}%\r"
22
    elif [ ${percent} -lt 10 ]; then
22
    elif [ ${percent} -lt 10 ]; then
23
        echo -ne "Downloading... [ #                    ] ${percent}%\r"
23
        echo -ne "Downloading... [ #                    ] ${percent}%\r"
24
    elif [  ${percent} -lt 15  ]; then
24
    elif [  ${percent} -lt 15  ]; then
25
        echo -ne "Downloading... [ ##                   ] ${percent}%\r"
25
        echo -ne "Downloading... [ ##                   ] ${percent}%\r"
26
    elif [  ${percent} -lt 20  ]; then
26
    elif [  ${percent} -lt 20  ]; then
27
        echo -ne "Downloading... [ ###                  ] ${percent}%\r"
27
        echo -ne "Downloading... [ ###                  ] ${percent}%\r"
28
    elif [  ${percent} -lt 25  ]; then
28
    elif [  ${percent} -lt 25  ]; then
29
        echo -ne "Downloading... [ ####                 ] ${percent}%\r"
29
        echo -ne "Downloading... [ ####                 ] ${percent}%\r"
30
    elif [  ${percent} -lt 30  ]; then
30
    elif [  ${percent} -lt 30  ]; then
31
        echo -ne "Downloading... [ #####                ] ${percent}%\r"
31
        echo -ne "Downloading... [ #####                ] ${percent}%\r"
32
    elif [  ${percent} -lt 35  ]; then
32
    elif [  ${percent} -lt 35  ]; then
33
        echo -ne "Downloading... [ ######               ] ${percent}%\r"
33
        echo -ne "Downloading... [ ######               ] ${percent}%\r"
34
    elif [  ${percent} -lt 40  ]; then
34
    elif [  ${percent} -lt 40  ]; then
35
        echo -ne "Downloading... [ #######              ] ${percent}%\r"
35
        echo -ne "Downloading... [ #######              ] ${percent}%\r"
36
    elif [  ${percent} -lt 45  ]; then
36
    elif [  ${percent} -lt 45  ]; then
37
        echo -ne "Downloading... [ ########             ] ${percent}%\r"
37
        echo -ne "Downloading... [ ########             ] ${percent}%\r"
38
    elif [  ${percent} -lt 50  ]; then
38
    elif [  ${percent} -lt 50  ]; then
39
        echo -ne "Downloading... [ #########            ] ${percent}%\r"
39
        echo -ne "Downloading... [ #########            ] ${percent}%\r"
40
    elif [  ${percent} -lt 55  ]; then
40
    elif [  ${percent} -lt 55  ]; then
41
        echo -ne "Downloading... [ ##########           ] ${percent}%\r"
41
        echo -ne "Downloading... [ ##########           ] ${percent}%\r"
42
    elif [  ${percent} -lt 60  ]; then
42
    elif [  ${percent} -lt 60  ]; then
43
        echo -ne "Downloading... [ ###########          ] ${percent}%\r"
43
        echo -ne "Downloading... [ ###########          ] ${percent}%\r"
44
    elif [  ${percent} -lt 65  ]; then
44
    elif [  ${percent} -lt 65  ]; then
45
        echo -ne "Downloading... [ ############         ] ${percent}%\r"
45
        echo -ne "Downloading... [ ############         ] ${percent}%\r"
46
    elif [  ${percent} -lt 70  ]; then
46
    elif [  ${percent} -lt 70  ]; then
47
        echo -ne "Downloading... [ #############        ] ${percent}%\r"
47
        echo -ne "Downloading... [ #############        ] ${percent}%\r"
48
    elif [  ${percent} -lt 75  ]; then
48
    elif [  ${percent} -lt 75  ]; then
49
        echo -ne "Downloading... [ ##############       ] ${percent}%\r"
49
        echo -ne "Downloading... [ ##############       ] ${percent}%\r"
50
    elif [  ${percent} -lt 80  ]; then
50
    elif [  ${percent} -lt 80  ]; then
51
        echo -ne "Downloading... [ ###############      ] ${percent}%\r"
51
        echo -ne "Downloading... [ ###############      ] ${percent}%\r"
52
    elif [  ${percent} -lt 85  ]; then
52
    elif [  ${percent} -lt 85  ]; then
53
        echo -ne "Downloading... [ ################     ] ${percent}%\r"
53
        echo -ne "Downloading... [ ################     ] ${percent}%\r"
54
    elif [  ${percent} -lt 90  ]; then
54
    elif [  ${percent} -lt 90  ]; then
55
        echo -ne "Downloading... [ #################    ] ${percent}%\r"
55
        echo -ne "Downloading... [ #################    ] ${percent}%\r"
56
    elif [  ${percent} -lt 95  ]; then
56
    elif [  ${percent} -lt 95  ]; then
57
        echo -ne "Downloading... [ ##################   ] ${percent}%\r"
57
        echo -ne "Downloading... [ ##################   ] ${percent}%\r"
58
    elif [  ${percent} -lt 100  ]; then
58
    elif [  ${percent} -lt 100  ]; then
59
        echo -ne "Downloading... [ ###################  ] ${percent}%\r"
59
        echo -ne "Downloading... [ ###################  ] ${percent}%\r"
60
    elif [  ${percent} == 100  ]; then
60
    elif [  ${percent} == 100  ]; then
61
        echo -ne "Downloading... [ #################### ] ${percent}%\r"
61
        echo -ne "Downloading... [ #################### ] ${percent}%\r"
62
    fi
62
    fi
63
}
63
}
64
 
64
 
65
# Check if a given option is valid an set a global var with the option value
65
# Check if a given option is valid an set a global var with the option value
66
function optionIsValid() {
66
function optionIsValid() {
67
    # Retrieving option and its value
67
    # Retrieving option and its value
68
    local option=$1
68
    local option=$1
69
    local value=$2
69
    local value=$2
70
 
70
 
71
    # Available options (short and long)
71
    # Available options (short and long)
72
    local isoFileOption="--iso-file -i"
72
    local isoFileOption="--iso-file -i"
73
    local langOption="--lang -l"
73
    local langOption="--lang -l"
74
 
74
 
75
    # Iso file option ?
75
    # Iso file option ?
76
    for opt in ${isoFileOption}; do
76
    for opt in ${isoFileOption}; do
77
        if [[ ${opt} = ${option} ]]; then
77
        if [[ ${opt} = ${option} ]]; then
78
            isoFile=${value}
78
            isoFile=${value}
79
            return 0
79
            return 0
80
        fi
80
        fi
81
    done
81
    done
82
 
82
 
83
    # Language option ?
83
    # Language option ?
84
    for opt in ${langOption}; do
84
    for opt in ${langOption}; do
85
        if [[ ${opt} = ${option} ]]; then
85
        if [[ ${opt} = ${option} ]]; then
86
            lang="-${value}"
86
            lang="-${value}"
87
            return 0
87
            return 0
88
        fi
88
        fi
89
    done
89
    done
90
 
90
 
91
    # Unknown option
91
    # Unknown option
92
    echo "Unknown option '${option}'. Aborting." && exit 1
92
    echo "Unknown option '${option}'. Aborting." && exit 1
93
}
93
}
94
 
94
 
95
# Check if needed packages are installed
95
# Check if needed packages are installed
96
function requiredPackagesInstalled() {
96
function requiredPackagesInstalled() {
97
    # Checking mkisofs
97
    # Checking mkisofs
98
    command -v genisoimage > /dev/null 2>&1 || \
98
    command -v genisoimage > /dev/null 2>&1 || \
99
        { echo "The package genisoimage is not installed." && \
99
        { echo "The package genisoimage is not installed." && \
100
            genisoimageNotInstalled=1; }
100
            genisoimageNotInstalled=1; }
101
 
101
 
102
    # Checking genhdlist2
102
    # Checking genhdlist2
103
    command -v genhdlist2 > /dev/null 2>&1 || \
103
    command -v genhdlist2 > /dev/null 2>&1 || \
104
        { echo "The package genhdlist2 is not installed." && \
104
        { echo "The package genhdlist2 is not installed." && \
105
            genhdlist2NotInstalled=1; }
105
            genhdlist2NotInstalled=1; }
106
 
106
 
107
    # Checking gendistrib
107
    # Checking gendistrib
108
    command -v gendistrib > /dev/null 2>&1 || \
108
    command -v gendistrib > /dev/null 2>&1 || \
109
        { echo "The package gendistrib is not installed (rpmtools)." && \
109
        { echo "The package gendistrib is not installed (rpmtools)." && \
110
            gendistribNotInstalled=1; }
110
            gendistribNotInstalled=1; }
111
 
111
 
112
    # If one of the following, aborting
112
    # If one of the following, aborting
113
    [[ ${genisoimageNotInstalled} -eq 1 ]] || \
113
    [[ ${genisoimageNotInstalled} -eq 1 ]] || \
114
        [[ ${genhdlist2NotInstalled} -eq 1 ]] || \
114
        [[ ${genhdlist2NotInstalled} -eq 1 ]] || \
115
        [[ ${gendistribNotInstalled} -eq 1 ]] && exit 1
115
        [[ ${gendistribNotInstalled} -eq 1 ]] && exit 1
116
}
116
}
117
 
117
 
118
# Check if a given language is supported by this script or not
118
# Check if a given language is supported by this script or not
119
function languageIsSupported() {
119
function languageIsSupported() {
120
    local lang=$1
120
    local lang=$1
121
    local supportedLang="fr en"
121
    local supportedLang="fr en"
122
 
122
 
123
    # Comparing with available langs
123
    # Comparing with available langs
124
    for supLang in ${supportedLang}; do
124
    for supLang in ${supportedLang}; do
125
        if [[ ${supLang} = ${lang} ]]; then
125
        if [[ ${supLang} = ${lang} ]]; then
126
            return 0
126
            return 0
127
        fi
127
        fi
128
    done
128
    done
129
 
129
 
130
    # Language is not supported
130
    # Language is not supported
131
    echo "Language '${lang}' is not supported. Aborting." && exit 1
131
    echo "Language '${lang}' is not supported. Aborting." && exit 1
132
}
132
}
133
 
133
 
134
# "Purify" the rpm name -> for the plop.idx file ("Mageia-5.1-x86_64 rpmname" for example)
134
# "Purify" the rpm name -> for the plop.idx file ("Mageia-5.1-x86_64 rpmname" for example)
135
function purifyRpmName() {
135
function purifyRpmName() {
136
    local str=$1
136
    local str=$1
137
    local arch=$2
137
    local arch=$2
138
    local len=${#str}
138
    local len=${#str}
139
 
139
 
140
    p=`echo ${str} | grep -oP ".*\.mga6"`
140
    p=`echo ${str} | grep -oP ".*\.mga6"`
141
    echo "Mageia-6-${arch} ${p}"
141
    echo "Mageia-6-${arch} ${p}"
142
}
142
}
143
 
143
 
-
 
144
#################################
-
 
145
#          BEGIN HERE           #
-
 
146
#################################
144
# Checking arguments (rpm_list and iso file and eventually lang)
147
# Checking arguments (rpm_list and iso file and eventually lang)
145
[[ ($# -lt 1) || ($# -gt 2) ]] && echo \
148
[[ ($# -lt 1) || ($# -gt 2) ]] && echo \
146
"Usage: $0 ARGS
149
"Usage: $0 ARGS
147
    --iso-file, -i      Mageia-xxx-xxxxxx-xxx.iso (mandatory)
150
    --iso-file, -i      Mageia-xxx-xxxxxx-xxx.iso (mandatory)
148
    --lang, -l          Language for installation (optional)
151
    --lang, -l          Language for installation (optional)
149
                        Supported languages: fr;en
152
                        Supported languages: fr;en
150
" && exit 1
153
" && exit 1
151
 
154
 
152
# Checking options
155
# Checking options
153
optionIsValid $1 $2
156
optionIsValid $1 $2
154
 
157
 
155
# Checking that mandatory option have been specified
158
# Checking that mandatory option have been specified
156
[[ -z ${isoFile} ]] && { echo "Iso file option is mandatory. Aborting." && exit 1; }
159
[[ -z ${isoFile} ]] && { echo "Iso file option is mandatory. Aborting." && exit 1; }
157
 
160
 
158
# Checking validity of options
161
# Checking validity of options
159
[[ -f ${isoFile} ]] || { echo "Invalid iso file. Aborting." && exit 1; }
162
[[ -f ${isoFile} ]] || { echo "Invalid iso file. Aborting." && exit 1; }
160
 
163
 
161
# Checking that executed as root
164
# Checking that executed as root
162
[[ $(whoami) != "root" ]] && \
165
[[ $(whoami) != "root" ]] && \
163
    { echo "This script must be executed with root privileges. Aborting." && exit 1; }
166
    { echo "This script must be executed with root privileges. Aborting." && exit 1; }
164
 
167
 
165
# Checking required packages
168
# Checking required packages
166
requiredPackagesInstalled
169
requiredPackagesInstalled
167
 
170
 
168
# Directories
171
# Directories
169
actualDir=$(pwd)
172
actualDir=$(pwd)
170
RPMS_DIR=$(pwd)"/rpms"
173
RPMS_DIR=$(pwd)"/rpms"
171
[[ -d ${RPMS_DIR} ]] && rm -rf ${RPMS_DIR}
174
[[ -d ${RPMS_DIR} ]] && rm -rf ${RPMS_DIR}
172
mkdir ${RPMS_DIR}
175
mkdir ${RPMS_DIR}
173
# Retreiving rpm_list
176
# Retreiving rpm_lists
174
rpm_needed=`rpm -qa`
177
rpm_need_by_alcasar=`rpm -qa`
-
 
178
rpm_need_by_mageia=`cat minimal-rpm-list`
175
 
179
 
176
# official and new dirs
180
# official and new dirs
177
mageiaNewDir=/tmp/mageia_new
181
mageiaNewDir=/tmp/mageia_new
178
mageiaOfficialDir=/tmp/mageia_official
182
mageiaOfficialDir=/tmp/mageia_official
179
 
183
 
180
 
184
 
181
 
185
 
182
# Mounting the image
186
# Mounting the image
183
echo "Mounting the image..."
187
echo "Mounting the image..."
184
[[ ! -d ${mageiaOfficialDir} ]] && mkdir ${mageiaOfficialDir}
188
[[ ! -d ${mageiaOfficialDir} ]] && mkdir ${mageiaOfficialDir}
185
mount -o ro,loop ${isoFile} ${mageiaOfficialDir} || { echo "Failed mounting '${isoFile}'. Aborting." && exit 1; }
189
mount -o ro,loop ${isoFile} ${mageiaOfficialDir} || { echo "Failed mounting '${isoFile}'. Aborting." && exit 1; }
186
 
190
 
187
# Checking architecture
191
# Checking architecture
188
[[ -d ${mageiaOfficialDir}/x86_64 ]] && arch=x86_64 || arch=i586
192
[[ -d ${mageiaOfficialDir}/x86_64 ]] && arch=x86_64 || arch=i586
189
 
193
 
190
# Creating new directory that will contains the "cleared" iso image
194
# Creating new directory that will contains the "cleared" iso image
191
[[ -d ${mageiaNewDir} ]] && rm -rf ${mageiaNewDir}
195
[[ -d ${mageiaNewDir} ]] && rm -rf ${mageiaNewDir}
192
mkdir ${mageiaNewDir}
196
mkdir ${mageiaNewDir}
193
 
197
 
194
# Copying main files except core and nonfree directories
198
# Copying main files except core and nonfree directories
195
echo "Extracting base image..."
199
echo "Extracting base image..."
196
cd /tmp/mageia_official && \
200
cd $mageiaOfficialDir && \
197
    tar cf - --exclude=${arch}/media . | (cd $mageiaNewDir && tar xf - ) && cd "${actualDir}"
201
    tar cf - --exclude=${arch}/media . | (cd $mageiaNewDir && tar xf - ) && cd "${actualDir}"
198
 
202
 
199
# Creating new directories core and nonfree and dir for alcasar stufs
203
# Creating new directories core and nonfree and dir for alcasar stufs
200
mkdir -p ${mageiaNewDir}/${arch}/{media/{core,nonfree},install/alcasar}
204
mkdir -p ${mageiaNewDir}/${arch}/{media/{core,nonfree},install/alcasar}
201
    
205
    
202
# Retrieving core and nonfree dirs (official)
206
# Retrieving core and nonfree dirs (official)
203
coreDir=${mageiaOfficialDir}/${arch}/media/core
207
coreDir=${mageiaOfficialDir}/${arch}/media/core
204
nonFreeDir=${mageiaOfficialDir}/${arch}/media/nonfree
208
nonFreeDir=${mageiaOfficialDir}/${arch}/media/nonfree
205
 
209
 
206
# Retrieving core and nonfree dirs (new)
210
# Retrieving core and nonfree dirs (new)
207
coreDirNew=${mageiaNewDir}/${arch}/media/core/
211
coreDirNew=${mageiaNewDir}/${arch}/media/core/
208
nonFreeDirNew=${mageiaNewDir}/${arch}/media/nonfree
212
nonFreeDirNew=${mageiaNewDir}/${arch}/media/nonfree
209
plopFilePath=${mageiaNewDir}/${arch}/media/plop.idx
213
plopFilePath=${mageiaNewDir}/${arch}/media/plop.idx
210
 
214
 
211
# Initializing counts
215
# Initializing counts
212
count=0
216
count=0
213
countCore=0
217
countCore=0
214
countNonFree=0
218
countNonFree=0
215
 
219
 
216
# Copying the RPM in core and nonfree and clearing the plop.idx file
220
# Copying the RPM in core and nonfree and clearing the plop.idx file
217
echo "Copying RPMS in ISO ..."
221
echo "Copying RPMS in ISO ..."
218
> ${plopFilePath}
222
> ${plopFilePath}
219
total=`echo $rpm_needed | wc -w`
223
total=`echo $rpm_need_by_mageia | wc -w`
220
 
-
 
221
# Selecting rpm
224
# Selecting & copying of rpm need by Mageia
222
for rpm in ${rpm_needed}; do
225
for rpm in ${rpm_need_by_mageia}; do
223
	let percent="${count} * 100 / ${total}"
226
	let percent="${count} * 100 / ${total}"
224
	print_percentage ${percent}
227
	print_percentage ${percent}
225
	# Retreiving output of ls in directories
228
	# Retreiving output of ls in directories
226
	fileInCore=$(ls ${coreDir} | grep "^${rpm}")
229
	fileInCore=$(ls ${coreDir} | grep "^${rpm}")
227
	fileInNonFree=$(ls ${nonFreeDir} | grep "^${rpm}")
230
	fileInNonFree=$(ls ${nonFreeDir} | grep "^${rpm}")
228
	# If present in core, copying in core_new
231
	# If present in core, copying in core_new
229
	if [[ ! -z ${fileInCore} ]]; then
232
	if [[ ! -z ${fileInCore} ]]; then
230
		# Copying RPM
233
		# Copying RPM
231
		cp "${coreDir}/${fileInCore}" ${coreDirNew}
234
		cp "${coreDir}/${fileInCore}" ${coreDirNew}
232
		countCore=$(expr ${countCore} + 1)
235
		countCore=$(expr ${countCore} + 1)
233
    # Updating the plop.idx
236
		# Updating the plop.idx
234
    purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
237
		purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
235
  # If present in nonfree, copying in nonfree_new
238
	# if present in nonfree, copying in nonfree_new
236
	elif [[ ! -z ${fileInNonFree} ]]; then
239
	elif [[ ! -z ${fileInNonFree} ]]; then 
237
		# Copying RPM
240
		# Copying RPM
238
		cp  "${nonFreeDir}/${fileInNonFree}" ${nonFreeDirNew}
241
		cp  "${nonFreeDir}/${fileInNonFree}" ${nonFreeDirNew}
239
		countNonFree=$(expr ${countNonFree} + 1)
242
		countNonFree=$(expr ${countNonFree} + 1)
240
    # Updating the plop.idx
243
		# Updating the plop.idx
241
    purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
244
		purifyRpmName ${rpm} ${arch} >> ${plopFilePath}
242
	else
245
	else 
243
	# we need to download it and to copy on ALCASAR special RPM tarball
-
 
244
	# if RPM name is also in core/nonfree, we need to copying it in core/nonfree
-
 
245
	# be carefull with kernel (ISO must boot on the original one)
-
 
246
		url=$(urpmq --ignorearch --sources ${rpm} | grep 'updates\|release' | uniq)
-
 
247
		wget -P "${RPMS_DIR}" "${url}" --quiet
-
 
248
		short_name=`rpm -q $rpm --qf "%{NAME}\n"`
246
		echo "$rpm not found"
249
		# echo "$count - $countCore - $countNonFree : $rpm not in core/update - shortame = $short_name"
-
 
250
		#read a
-
 
251
		cp ${RPMS_DIR}/${rpm}.${arch}.rpm ${coreDirNew}
-
 
252
	fi
247
	fi
253
	count=$(expr ${count} + 1)
248
	count=$(expr ${count} + 1)
254
done
249
done
255
 
-
 
256
# Sorting the plop file alphabetically
250
# Sorting the plop file alphabetically
257
cat ${plopFilePath} | sort > /tmp/tmpFileMageia && mv /tmp/tmpFileMageia ${plopFilePath}
251
cat ${plopFilePath} | sort > /tmp/tmpFileMageia && mv /tmp/tmpFileMageia ${plopFilePath}
-
 
252
# Informations
-
 
253
echo "$count RPMs copied (${countCore} from core and ${countNonFree} from nonfree)"
-
 
254
echo "Hit a Key to download complemmentary RPMs"
-
 
255
read a
258
 
256
 
-
 
257
count=0
-
 
258
total=`echo $rpm_need_by_alcasar | wc -w`
-
 
259
# Selecting & copying of rpm need by alcasar
-
 
260
for rpm in ${rpm_need_by_alcasar}; do
-
 
261
	let percent="${count} * 100 / ${total}"
-
 
262
	print_percentage ${percent}
-
 
263
	# Retreiving output of ls in directories
-
 
264
	fileInCore=$(ls ${coreDir} | grep "^${rpm}")
-
 
265
	fileInNonFree=$(ls ${nonFreeDir} | grep "^${rpm}")
-
 
266
	# we need to download icomplementary RPMS (that aren't in core nor in nonfree)
-
 
267
	if [ -z ${fileInCore} ] && [ -z ${fileInNonFree} ]; then
-
 
268
		url=$(urpmq --ignorearch --sources ${rpm} | grep 'updates\|release' | uniq)
-
 
269
		wget -P "${RPMS_DIR}" "${url}" --quiet
-
 
270
		short_name=`rpm -q $rpm --qf "%{NAME}\n"`
-
 
271
	fi
-
 
272
	count=$(expr ${count} + 1)
-
 
273
done
-
 
274
tar -cvf ${actualDir}/alcasar.tar.gz ${RPMS_DIR}/
-
 
275
cp ${actualDir}/alcasar.tar.gz ${mageiaNewDir}/${arch}/install/alcasar
259
# Informations
276
# Informations
260
echo "${countCore} files kept from core"
277
echo "$count complementary RPMs copied"
261
echo "${countNonFree} files kept from nonfree"
278
echo "Hit a Key to create the ISO file"
-
 
279
read a
262
 
280
 
263
# Copying customized files
281
# Copying customized files
264
echo "Copying customized files..."
282
echo "Copying customized files..."
265
tar -cvf ${actualDir}/alcasar.tar.gz ${RPMS_DIR}/
-
 
266
cp ${actualDir}/alcasar.tar.gz ${mageiaNewDir}/${arch}/install/alcasar
-
 
267
###   only if we want to change the normal install procedure ###
283
###   only if we want to change the normal install procedure ###
268
#cp ${actualDir}/config/first_login ${mageiaNewDir}/${arch}/install/alcasar
284
#cp ${actualDir}/config/first_login ${mageiaNewDir}/${arch}/install/alcasar
269
#cp ${actualDir}/config/auto_inst-${arch}${lang}.cfg.pl ${mageiaNewDir}/${arch}/install/alcasar/auto_inst-${arch}.cfg.pl
285
#cp ${actualDir}/config/auto_inst-${arch}${lang}.cfg.pl ${mageiaNewDir}/${arch}/install/alcasar/auto_inst-${arch}.cfg.pl
270
#cp -f ${actualDir}"/config/isolinux-x86_64.cfg" ${mageiaNewDir}/isolinux/isolinux.cfg
286
#cp -f ${actualDir}"/config/isolinux-x86_64.cfg" ${mageiaNewDir}/isolinux/isolinux.cfg
271
 
287
 
272
# Generating media info for core
288
# Generating media info for core
273
echo "Generating media_info for core..."
289
echo "Generating media_info for core..."
274
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
290
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
275
 
291
 
276
echo "Generating media_info for nonfree..."
292
echo "Generating media_info for nonfree..."
277
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
293
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
278
 
294
 
279
# Puting pubkeys in media_info
295
# Puting pubkeys in media_info
280
cp ${coreDir}/media_info/pubkey ${coreDirNew}/media_info/
296
cp ${coreDir}/media_info/pubkey ${coreDirNew}/media_info/
281
cp ${nonFreeDir}/media_info/pubkey ${nonFreeDirNew}/media_info/
297
cp ${nonFreeDir}/media_info/pubkey ${nonFreeDirNew}/media_info/
282
 
298
 
283
# Retrieving media.cfg & compssUsers.pl depending on the arch
299
# Retrieving media.cfg & compssUsers.pl depending on the arch
284
mkdir ${mageiaNewDir}/${arch}/media/media_info
300
mkdir ${mageiaNewDir}/${arch}/media/media_info
285
cp ${mageiaOfficialDir}/${arch}/media/media_info/compssUsers.pl ${mageiaNewDir}/${arch}/media/media_info/compssUsers.pl
301
cp ${mageiaOfficialDir}/${arch}/media/media_info/compssUsers.pl ${mageiaNewDir}/${arch}/media/media_info/compssUsers.pl
286
cp ${mageiaOfficialDir}/${arch}/media/media_info/media.cfg ${mageiaNewDir}/${arch}/media/media_info/media.cfg
302
cp ${mageiaOfficialDir}/${arch}/media/media_info/media.cfg ${mageiaNewDir}/${arch}/media/media_info/media.cfg
287
 
303
 
288
# Generating distr
304
# Generating distr
289
echo "Generating mirror tree..."
305
echo "Generating mirror tree..."
290
gendistrib -s ${mageiaNewDir}/${arch}
306
gendistrib -s ${mageiaNewDir}/${arch}
291
 
307
 
292
# Creating the new iso file
308
# Creating the new iso file
293
echo "Creating the isofile..."
309
echo "Creating the isofile..."
294
newIsoName=Mageia-6-${arch}${lang}-Alcasar.iso
310
newIsoName=Mageia-6-${arch}${lang}-Alcasar.iso
295
cd ${mageiaNewDir} && genisoimage -quiet -o ${actualDir}/${newIsoName} \
311
cd ${mageiaNewDir} && genisoimage -quiet -o ${actualDir}/${newIsoName} \
296
    -b isolinux/isolinux.bin \
312
    -b isolinux/isolinux.bin \
297
    -c boot.catalog \
313
    -c boot.catalog \
298
    -no-emul-boot -boot-load-size 4 \
314
    -no-emul-boot -boot-load-size 4 \
299
    -boot-info-table -J -R -V "Mageia-6 Alcasar (${arch})" .
315
    -boot-info-table -J -R -V "Mageia-6 Alcasar (${arch})" .
300
 
316
 
301
# Unmounting
317
# Unmounting
302
echo "Umounting..."
318
echo "Umounting..."
303
umount ${mageiaOfficialDir} && rmdir ${mageiaOfficialDir}
319
umount ${mageiaOfficialDir} && rmdir ${mageiaOfficialDir}
304
 
320
 
305
# Removing temporary dir
321
# Removing temporary dir
306
rm -rf ${mageiaNewDir}
322
rm -rf ${mageiaNewDir}
307
 
323
 
308
# Setting same permissions as the initial image
324
# Setting same permissions as the initial image
309
cd ${actualDir}
325
cd ${actualDir}
310
chmod --reference=${isoFile} ${newIsoName}
326
chmod --reference=${isoFile} ${newIsoName}
311
chown --reference=${isoFile} ${newIsoName}
327
chown --reference=${isoFile} ${newIsoName}
312
 
328
 
313
# Finished
329
# Finished
314
echo "Done."
330
echo "Done."
315
 
331