Subversion Repositories ALCASAR

Rev

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

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