Subversion Repositories ALCASAR

Rev

Rev 2484 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2484 Rev 2525
Line 139... Line 139...
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)
Line 168... Line 171...
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
 
Line 191... Line 195...
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
   
Line 214... Line 218...
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}")
Line 230... Line 233...
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