Subversion Repositories ALCASAR

Rev

Rev 2525 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2525 Rev 2526
Line 7... Line 7...
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
Line 179... Line 173...
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
 
Line 252... Line 244...
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