|
@@ -1,4 +1,4 @@
|
1
|
|
-#!/bin/bash
|
|
1
|
+#!/usr/bin/bash
|
2
|
2
|
|
3
|
3
|
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
|
4
|
4
|
# Jean-Baptiste Biernacki <j.biernacki@free.fr>
|
|
@@ -6,7 +6,7 @@
|
6
|
6
|
#
|
7
|
7
|
# This program is free software; you can redistribute it and/or modify
|
8
|
8
|
# it under the terms of the GNU General Public License as published by
|
9
|
|
-# the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+# the Free Software Foundation; either version 2 of the License,dnf or
|
10
|
10
|
# (at your option) any later version.
|
11
|
11
|
#
|
12
|
12
|
# This program is distributed in the hope that it will be useful,
|
|
@@ -87,33 +87,35 @@ function createchroot()
|
87
|
87
|
title "Making chroot"
|
88
|
88
|
if ! [ -f /usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia ]; then
|
89
|
89
|
title "distribution-gpg-keys package not present : installing distribution-gpg-keys"
|
90
|
|
- /usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install distribution-gpg-keys
|
|
90
|
+ #/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install distribution-gpg-keys
|
|
91
|
+ installpkg "distribution-gpg-keys" "--setopt=install_weak_deps=False"
|
91
|
92
|
if [ ${?} -ne 0 ]; then
|
92
|
93
|
error "line ${LINENO} can't install distribution-gpg-keys : exiting"
|
93
|
94
|
exit ${ERR_1}
|
94
|
95
|
fi
|
95
|
96
|
fi
|
96
|
97
|
|
97
|
|
- if ! [ -f /bin/qemu-arm-static ]; then
|
|
98
|
+ if ! [ -f /usr/bin/qemu-arm-static ]; then
|
98
|
99
|
title "Qemu package not present : installing qemu packages"
|
99
|
|
- /usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
|
100
|
|
- if [ ${?} -ne 0 ]; then
|
|
100
|
+ #/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static
|
|
101
|
+ installpkg "qemu-user-static" "--setopt=install_weak_deps=False"
|
|
102
|
+ if [ ${?} -ne 0 ]; then
|
101
|
103
|
error "line ${LINENO} can't install qemu-user-static : exiting"
|
102
|
104
|
exit ${ERR_1}
|
103
|
105
|
fi
|
104
|
106
|
fi
|
105
|
107
|
# Starting qemu service if not started
|
106
|
|
- /bin/systemctl is-active systemd-binfmt.service
|
|
108
|
+ /usr/bin/systemctl is-active systemd-binfmt.service
|
107
|
109
|
if [ ${?} -ne 0 ]; then
|
108
|
110
|
title "Starting systemd-binfmt.service"
|
109
|
|
- /bin/systemctl start systemd-binfmt.service
|
|
111
|
+ /usr/bin/systemctl start systemd-binfmt.service
|
110
|
112
|
if [ ${?} -ne 0 ]; then
|
111
|
113
|
error "line ${LINENO} can't start qemu-user-static : exiting"
|
112
|
114
|
exit ${ERR_1}
|
113
|
115
|
fi
|
114
|
116
|
else
|
115
|
117
|
title "Restarting systemd-binfmt.service"
|
116
|
|
- /bin/systemctl restart systemd-binfmt.service
|
|
118
|
+ /usr/bin/systemctl restart systemd-binfmt.service
|
117
|
119
|
if [ ${?} -ne 0 ]; then
|
118
|
120
|
error "line ${LINENO} can't start qemu-user-static : exiting"
|
119
|
121
|
exit ${ERR_1}
|
|
@@ -166,7 +168,7 @@ function enableextrarepos()
|
166
|
168
|
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
167
|
169
|
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
|
168
|
170
|
fi
|
169
|
|
- /usr/bin/dnf $DNFPARAM;
|
|
171
|
+ /usr/bin/dnf $DNFPARAM
|
170
|
172
|
err=${?}
|
171
|
173
|
if [ ${err} -ne 0 ]; then
|
172
|
174
|
error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
|
|
@@ -179,7 +181,7 @@ function enableextrarepos()
|
179
|
181
|
if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
|
180
|
182
|
DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
|
181
|
183
|
fi
|
182
|
|
- /usr/bin/dnf $DNFPARAM²
|
|
184
|
+ /usr/bin/dnf $DNFPARAM
|
183
|
185
|
err=${?}
|
184
|
186
|
if [ ${err} -ne 0 ]; then
|
185
|
187
|
error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
|
|
@@ -240,7 +242,7 @@ function installbasesystem()
|
240
|
242
|
read yn
|
241
|
243
|
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
|
242
|
244
|
title "Creating ${BUILD_PATH}"
|
243
|
|
- /bin/mkdir -p "${BUILD_PATH}/usr/bin" "${BUILD_PATH}/usr/lib/binfmt.d"
|
|
245
|
+ /usr/bin/mkdir -p "${BUILD_PATH}/usr/bin" "${BUILD_PATH}/usr/lib/binfmt.d"
|
244
|
246
|
if [ ${?} -ne 0 ]; then
|
245
|
247
|
error "line ${LINENO} can't create ${BUILD_PATH} : exiting"
|
246
|
248
|
exit ${ERR_1}
|
|
@@ -266,7 +268,8 @@ function installbasesystem()
|
266
|
268
|
fi
|
267
|
269
|
|
268
|
270
|
title "installing basesystem"
|
269
|
|
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
|
|
271
|
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
|
|
272
|
+ installpkg "shadow-utils basesystem-minimal"
|
270
|
273
|
if [ ${?} -ne 0 ]; then
|
271
|
274
|
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
|
272
|
275
|
exit ${ERR_1}
|
|
@@ -276,27 +279,43 @@ function installbasesystem()
|
276
|
279
|
# error "line ${LINENO} error installing basesystem-minimal : exiting"
|
277
|
280
|
# exit ${ERR_1}
|
278
|
281
|
#fi
|
279
|
|
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
|
280
|
|
- if [ ${?} -ne 0 ]; then
|
281
|
|
- error "line ${LINENO} error installing dnf or locales : exiting"
|
282
|
|
- exit ${ERR_1}
|
283
|
|
- fi
|
284
|
|
- if [ "${ARM_VERSION}" = "armv7hl" ]; then
|
285
|
|
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
|
286
|
|
- if [ ${?} -ne 0 ]; then
|
287
|
|
- error "line ${LINENO} error installing u-boot : exiting"
|
288
|
|
- exit ${ERR_1}
|
289
|
|
- fi
|
290
|
|
- fi
|
291
|
|
- /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
|
292
|
|
- if [ ${?} -ne 0 ]; then
|
293
|
|
- error "line ${LINENO} error installing urpmi : exiting"
|
294
|
|
- exit ${ERR_1}
|
295
|
|
- fi
|
|
282
|
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
|
283
|
+ installpkg "urpmi locales"
|
|
284
|
+ else
|
|
285
|
+ installpkg "dnf dnf-plugins-core locales"
|
|
286
|
+ fi
|
|
287
|
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales
|
|
288
|
+
|
|
289
|
+ #if [ ${?} -ne 0 ]; then
|
|
290
|
+ # error "line ${LINENO} error installing dnf or locales : exiting"
|
|
291
|
+ # exit ${ERR_1}
|
|
292
|
+ #fi
|
|
293
|
+ #if [ "${ARM_VERSION}" = "aarch64" ]; then
|
|
294
|
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install u-boot
|
|
295
|
+ # installpkg "/u-boot*"
|
|
296
|
+ # if [ ${?} -ne 0 ]; then
|
|
297
|
+ # error "line ${LINENO} error installing u-boot : exiting"
|
|
298
|
+ # exit ${ERR_1}
|
|
299
|
+ # fi
|
|
300
|
+ #fi
|
|
301
|
+ #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
|
|
302
|
+ #installpkg "urpmi"
|
|
303
|
+ #if [ ${?} -ne 0 ]; then
|
|
304
|
+ # error "line ${LINENO} error installing urpmi : exiting"
|
|
305
|
+ # exit ${ERR_1}
|
|
306
|
+ #fi
|
296
|
307
|
return 0
|
297
|
308
|
}
|
298
|
309
|
|
|
310
|
+function installpkg()
|
|
311
|
+{
|
|
312
|
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
|
313
|
+ /usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 $3 $1;
|
|
314
|
+ else
|
|
315
|
+ /usr/bin/dnf $2 --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install $1;
|
|
316
|
+ fi
|
299
|
317
|
|
|
318
|
+}
|
300
|
319
|
function preparechroot()
|
301
|
320
|
{
|
302
|
321
|
title "Preparing chrooting in ${BUILD_PATH}"
|
|
@@ -305,27 +324,33 @@ function preparechroot()
|
305
|
324
|
echo "${HOSTNAME}" > "${BUILD_PATH}/etc/hostname"
|
306
|
325
|
|
307
|
326
|
info "copying second stage script in ${BUILD_PATH}"
|
308
|
|
- #echo "/bin/cp ${CONFIG_PATH}/second_stage_install.sh ${BUILD_PATH}/"
|
|
327
|
+ #echo "/usr/bin/cp ${CONFIG_PATH}/second_stage_install.sh ${BUILD_PATH}/"
|
309
|
328
|
cp --preserve=mode "${CONFIG_PATH}/second_stage_install.sh" "${BUILD_PATH}/second_stage_install.sh"
|
310
|
329
|
if [ ${?} -ne 0 ]; then
|
311
|
330
|
error "line ${LINENO} error copying ${CONFIG_PATH}/second_stage_install.sh : exiting"
|
312
|
331
|
exit ${ERR_1}
|
313
|
332
|
fi
|
|
333
|
+ info "configuring second_install_install.sh for ${INSTALL_METHOD}"
|
|
334
|
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
|
335
|
+ sed -i -e "s/<INSTALL_EXEC>/sbin\/urpmi --no-verify-rpm --auto/g" "${BUILD_PATH}/second_stage_install.sh"
|
|
336
|
+ else
|
|
337
|
+ sed -i -e "s/<INSTALL_EXEC>/bin\/dnf --nogpgcheck --assumeyes install/g" "${BUILD_PATH}/second_stage_install.sh"
|
|
338
|
+ fi
|
314
|
339
|
|
315
|
340
|
info "Preparation for setting root and user account"
|
316
|
341
|
if [ -n "${ROOT_PWD}" ]; then #If root password defined, it will be setted at the end of the chroot of the second_stage_install.sh script
|
317
|
|
- echo -e "/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
|
342
|
+ echo -e "/usr/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
318
|
343
|
else
|
319
|
344
|
info "No root password... One password will be set at the first login."
|
320
|
|
- echo -e "/bin/passwd -d root\n/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
|
345
|
+ echo -e "/usr/bin/passwd -d root\n/usr/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
321
|
346
|
fi
|
322
|
347
|
|
323
|
348
|
if [ -n "${ID_USER}" ]; then #If user ID defined, it will be setted at the end of the chroot of the second_stage_install.sh script
|
324
|
349
|
echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
325
|
350
|
if [ -n "${PASSWORD}" ]; then
|
326
|
|
- echo -e "/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
|
|
351
|
+ echo -e "/usr/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
|
327
|
352
|
else
|
328
|
|
- echo -e "/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
|
353
|
+ echo -e "/usr/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
329
|
354
|
fi
|
330
|
355
|
else
|
331
|
356
|
info "No user defined, no user account created."
|
|
@@ -334,7 +359,7 @@ function preparechroot()
|
334
|
359
|
|
335
|
360
|
# BUG: This line break the default .bashrc file from the package "rootfiles" and the values as PATH (and /usr/sbin programs).
|
336
|
361
|
# info "Copying skel in root directory"
|
337
|
|
-# /bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
|
|
362
|
+# /usr/bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
|
338
|
363
|
|
339
|
364
|
postPrepareChroot
|
340
|
365
|
if [ ${?} -ne 0 ]; then
|
|
@@ -349,49 +374,58 @@ function jumpchroot()
|
349
|
374
|
{
|
350
|
375
|
title "chrooting to ${BUILD_PATH}"
|
351
|
376
|
info "mounting dev, sys, proc directories in chroot"
|
352
|
|
- /bin/mount -B /dev "${BUILD_PATH}/dev"
|
|
377
|
+ /usr/bin/mount -B /dev "${BUILD_PATH}/dev"
|
353
|
378
|
if [ ${?} -ne 0 ]; then
|
354
|
379
|
error "line ${LINENO} error mounting ${BUILD_PATH}/dev : exiting"
|
355
|
380
|
exit ${ERR_1}
|
356
|
381
|
fi
|
357
|
|
- /bin/mount -B /sys "${BUILD_PATH}/sys"
|
|
382
|
+ /usr/bin/mount -B /sys "${BUILD_PATH}/sys"
|
358
|
383
|
if [ ${?} -ne 0 ]; then
|
359
|
384
|
error "line ${LINENO} error mounting ${BUILD_PATH}/sys : exiting"
|
360
|
385
|
exit ${ERR_1}
|
361
|
386
|
fi
|
362
|
|
- /bin/mount -B /proc "${BUILD_PATH}/proc"
|
|
387
|
+ /usr/bin/mount -B /proc "${BUILD_PATH}/proc"
|
363
|
388
|
if [ ${?} -ne 0 ]; then
|
364
|
389
|
error "line ${LINENO} error mounting ${BUILD_PATH}/proc : exiting"
|
365
|
390
|
exit ${ERR_1}
|
366
|
391
|
fi
|
367
|
392
|
info "Copying resolv.conf"
|
368
|
|
- /bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
|
|
393
|
+ /usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
|
369
|
394
|
if [ ${?} -ne 0 ]; then
|
370
|
395
|
error "line ${LINENO} error copying ${BUILD_PATH}/etc/resolv.conf : exiting"
|
371
|
396
|
exit ${ERR_1}
|
372
|
397
|
fi
|
|
398
|
+ info "chrooting to ${BUILD_PATH}"
|
373
|
399
|
if [ "$OPT" = "chroot" ]; then
|
|
400
|
+ info "/sbin/chroot ${BUILD_PATH}"
|
374
|
401
|
/sbin/chroot "${BUILD_PATH}"
|
|
402
|
+ RET=${?}
|
|
403
|
+ if [ ${RET} -ne 0 ]; then
|
|
404
|
+ error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
|
|
405
|
+ ERRORN=$((${ERRORN}+1))
|
|
406
|
+ fi
|
375
|
407
|
else
|
376
|
|
- /sbin/chroot --userspec root:root "${BUILD_PATH}" /bin/bash -v -c 'bash /second_stage_install.sh 2>&1'
|
377
|
|
- fi
|
378
|
|
- RET=${?}
|
379
|
|
- if [ ${RET} -ne 0 ]; then
|
380
|
|
- error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
|
381
|
|
- ERRORN=$((${ERRORN}+1))
|
|
408
|
+ info "/sbin/chroot --userspec root:root ${BUILD_PATH} /usr/bin/bash -v -c 'bash /second_stage_install.sh 2>&1'"
|
|
409
|
+ /sbin/chroot --userspec root:root "${BUILD_PATH}" /usr/bin/bash -v -c 'bash /second_stage_install.sh 2>&1'
|
|
410
|
+ RET=${?}
|
|
411
|
+ if [ ${RET} -ne 0 ]; then
|
|
412
|
+ error "line ${LINENO} Warning : chrooting to ${BUILD_PATH} retrurn an error ${RET}"
|
|
413
|
+ ERRORN=$((${ERRORN}+1))
|
|
414
|
+ fi
|
382
|
415
|
fi
|
|
416
|
+
|
383
|
417
|
info "unmounting dev, sys, proc"
|
384
|
|
- /bin/umount -lf "${BUILD_PATH}/dev"
|
|
418
|
+ /usr/bin/umount -lf "${BUILD_PATH}/dev"
|
385
|
419
|
if [ ${?} -ne 0 ]; then
|
386
|
420
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/dev, continuing anyway"
|
387
|
421
|
ERRORN=$((${ERRORN}+1))
|
388
|
422
|
fi
|
389
|
|
- /bin/umount -lf "${BUILD_PATH}/sys"
|
|
423
|
+ /usr/bin/umount -lf "${BUILD_PATH}/sys"
|
390
|
424
|
if [ ${?} -ne 0 ]; then
|
391
|
425
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/sys, continuing anyway"
|
392
|
426
|
ERRORN=$((${ERRORN}+1))
|
393
|
427
|
fi
|
394
|
|
- /bin/umount -lf "${BUILD_PATH}/proc"
|
|
428
|
+ /usr/bin/umount -lf "${BUILD_PATH}/proc"
|
395
|
429
|
if [ ${?} -ne 0 ]; then
|
396
|
430
|
warning "line ${LINENO} Warning : error unmounting ${BUILD_PATH}/proc, continuing anyway"
|
397
|
431
|
ERRORN=$((${ERRORN}+1))
|
|
@@ -423,7 +457,7 @@ function createimage()
|
423
|
457
|
title " in ${IMAGE}"
|
424
|
458
|
if [ -f "${INSTALL_PATH}/${IMAGE}" ]; then
|
425
|
459
|
warning "Deleting previous image"
|
426
|
|
- /bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
|
460
|
+ /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
427
|
461
|
if [ ${?} -ne 0 ]; then
|
428
|
462
|
error "line ${LINENO} error can't remove previous image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
429
|
463
|
exit ${ERR_1}
|
|
@@ -431,7 +465,7 @@ function createimage()
|
431
|
465
|
fi
|
432
|
466
|
|
433
|
467
|
warning "please wait until end of image creation"
|
434
|
|
- /bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 ))
|
|
468
|
+ /usr/bin/dd if=/dev/zero of="${INSTALL_PATH}/${IMAGE}" bs=1MB count=$(( ${IMAGE_SIZE} * 1024 )) status=progress
|
435
|
469
|
if [ ${?} -ne 0 ]; then
|
436
|
470
|
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
437
|
471
|
exit ${ERR_1}
|
|
@@ -511,7 +545,7 @@ function generateExtlinux()
|
511
|
545
|
info "\tFound extlinux.conf"
|
512
|
546
|
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
513
|
547
|
info "making /boot/extlinux/extlinux.conf"
|
514
|
|
- /bin/rm -rf "${BUILD_PATH}/boot/extlinux"
|
|
548
|
+ /usr/bin/rm -rf "${BUILD_PATH}/boot/extlinux"
|
515
|
549
|
mkdir -p "${BUILD_PATH}/boot/extlinux"
|
516
|
550
|
fi
|
517
|
551
|
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
|
|
@@ -531,7 +565,7 @@ function copyingsystem()
|
531
|
565
|
generateExtlinux
|
532
|
566
|
|
533
|
567
|
info "Remove second_stage_install.sh"
|
534
|
|
- /bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
|
568
|
+ /usr/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
535
|
569
|
|
536
|
570
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
537
|
571
|
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
|
@@ -540,12 +574,12 @@ function copyingsystem()
|
540
|
574
|
mkdir -p "${ARM_BOOT}"
|
541
|
575
|
fi
|
542
|
576
|
info "copying Mageia image to root partition"
|
543
|
|
- /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
544
|
|
- /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
|
545
|
|
- /bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
|
|
577
|
+ /usr/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
|
578
|
+ /usr/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
|
|
579
|
+ #/usr/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
|
546
|
580
|
else
|
547
|
581
|
info "copying Mageia image to root partition"
|
548
|
|
- /bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
|
582
|
+ /usr/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
549
|
583
|
fi
|
550
|
584
|
|
551
|
585
|
copyingCustomSystem
|
|
@@ -567,13 +601,13 @@ function mountPartitions(){
|
567
|
601
|
|
568
|
602
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
569
|
603
|
if ! [ -d "${BOOT}" ]; then
|
570
|
|
- /bin/mkdir "${BOOT}"
|
|
604
|
+ /usr/bin/mkdir "${BOOT}"
|
571
|
605
|
if [ ${?} -ne 0 ]; then
|
572
|
606
|
error "line ${LINENO} error making directory ${BOOT} : exiting"
|
573
|
607
|
exit ${ERR_1}
|
574
|
608
|
fi
|
575
|
609
|
fi
|
576
|
|
- /bin/mount "${BOOTP}" "${BOOT}"
|
|
610
|
+ /usr/bin/mount "${BOOTP}" "${BOOT}"
|
577
|
611
|
if [ ${?} -ne 0 ]; then
|
578
|
612
|
error "line ${LINENO} error mounting ${BOOTP} : exiting"
|
579
|
613
|
exit ${ERR_1}
|
|
@@ -581,13 +615,13 @@ function mountPartitions(){
|
581
|
615
|
fi
|
582
|
616
|
|
583
|
617
|
if ! [ -d "${ROOT}" ]; then
|
584
|
|
- /bin/mkdir "${ROOT}"
|
|
618
|
+ /usr/bin/mkdir "${ROOT}"
|
585
|
619
|
if [ ${?} -ne 0 ]; then
|
586
|
620
|
error "line ${LINENO} error making directory ${ROOT} : exiting"
|
587
|
621
|
exit ${ERR_1}
|
588
|
622
|
fi
|
589
|
623
|
fi
|
590
|
|
- /bin/mount "${ROOTP}" "${ROOT}"
|
|
624
|
+ /usr/bin/mount "${ROOTP}" "${ROOT}"
|
591
|
625
|
if [ ${?} -ne 0 ]; then
|
592
|
626
|
error "line ${LINENO} error mounting ${ROOTP} : exiting"
|
593
|
627
|
exit ${ERR_1}
|
|
@@ -613,7 +647,7 @@ function unmountingPartitions()
|
613
|
647
|
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
614
|
648
|
/usr/bin/umount "${PARTITION}"
|
615
|
649
|
if [ ${?} -eq 0 ]; then
|
616
|
|
- /bin/rmdir "${MOUNTPOINT}"
|
|
650
|
+ /usr/bin/rmdir "${MOUNTPOINT}"
|
617
|
651
|
else
|
618
|
652
|
error "line ${LINENO} error unmounting ${BOOT}..."
|
619
|
653
|
fi
|
|
@@ -624,14 +658,14 @@ function unmountingPartitions()
|
624
|
658
|
if [ ! -z "${BOOTP}" ]; then
|
625
|
659
|
/usr/bin/umount "${BOOTP}"
|
626
|
660
|
if [ ${?} -eq 0 ]; then
|
627
|
|
- /bin/rmdir "${BOOT}"
|
|
661
|
+ /usr/bin/rmdir "${BOOT}"
|
628
|
662
|
else
|
629
|
663
|
error "line ${LINENO} error unmounting ${BOOT}..."
|
630
|
664
|
fi
|
631
|
665
|
fi
|
632
|
666
|
/usr/bin/umount "${ROOTP}"
|
633
|
667
|
if [ ${?} -eq 0 ]; then
|
634
|
|
- /bin/rmdir "${ROOT}"
|
|
668
|
+ /usr/bin/rmdir "${ROOT}"
|
635
|
669
|
else
|
636
|
670
|
error "line ${LINENO} error unmounting ${ROOT}..."
|
637
|
671
|
fi
|
|
@@ -667,8 +701,8 @@ function copyingcommon()
|
667
|
701
|
{
|
668
|
702
|
title "Copying common files and configuration"
|
669
|
703
|
rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
|
670
|
|
- rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
|
671
|
|
- chown root:root "${ROOT}/usr/local/bin/"
|
|
704
|
+ rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/usr/bin/"
|
|
705
|
+ chown root:root "${ROOT}/usr/local/usr/bin/"
|
672
|
706
|
return 0
|
673
|
707
|
}
|
674
|
708
|
|
|
@@ -699,14 +733,14 @@ function clean()
|
699
|
733
|
# Removing old Build directory
|
700
|
734
|
if [ -d "${BUILD_PATH}" ]; then
|
701
|
735
|
info "Removing ${BUILD_PATH}"
|
702
|
|
- /bin/rm -Rf "${BUILD_PATH}"
|
|
736
|
+ /usr/bin/rm -Rf "${BUILD_PATH}"
|
703
|
737
|
else
|
704
|
738
|
warning "${BUILD_PATH} does not exists"
|
705
|
739
|
fi
|
706
|
740
|
# removing old image
|
707
|
741
|
if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then
|
708
|
742
|
info "Removing ${IMAGE}"
|
709
|
|
- /bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
|
743
|
+ /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}"
|
710
|
744
|
else
|
711
|
745
|
warning "${IMAGE} does not exists"
|
712
|
746
|
fi
|
|
@@ -771,12 +805,12 @@ if [ 0 -ne $(id -u) ]; then
|
771
|
805
|
exit ${ERR_NOT_ROOT}
|
772
|
806
|
fi
|
773
|
807
|
|
774
|
|
-SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
|
|
808
|
+SOURCE_PATH="$(/usr/bin/dirname "$(readlink -f "${0}")")"
|
775
|
809
|
INSTALL_PATH="$(pwd)/build"
|
776
|
810
|
# FILES_PATH="${SOURCE_PATH}/files"
|
777
|
811
|
PLATFORMS_PATH="${SOURCE_PATH}/platforms"
|
778
|
812
|
|
779
|
|
-CMDNAME=$(/bin/basename "${0}")
|
|
813
|
+CMDNAME=$(/usr/bin/basename "${0}")
|
780
|
814
|
|
781
|
815
|
|
782
|
816
|
if [ ${#} == 0 ]; then
|
|
@@ -786,7 +820,7 @@ fi
|
786
|
820
|
|
787
|
821
|
|
788
|
822
|
# parsing commandline
|
789
|
|
-TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,add-urpmimedia,create-image,,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,nonfree,tainted -n ${CMDNAME} -- "${@}")
|
|
823
|
+TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,prepare-chroot,jump-chroot,add-urpmimedia,create-image,,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,nonfree,tainted -n ${CMDNAME} -- "${@}")
|
790
|
824
|
if [ ${?} -ne 0 ] ; then error "line ${LINENO} Failed parsing options." >&2 ; exit ${ERR_1} ; fi
|
791
|
825
|
eval set -- "${TEMP}"
|
792
|
826
|
|
|
@@ -826,6 +860,18 @@ while true; do
|
826
|
860
|
fi
|
827
|
861
|
shift
|
828
|
862
|
;;
|
|
863
|
+ --prepare-chroot)
|
|
864
|
+ if [ -z ${OPT} ]; then
|
|
865
|
+ OPT="preparechroot"
|
|
866
|
+ fi
|
|
867
|
+ shift
|
|
868
|
+ ;;
|
|
869
|
+ --jump-chroot)
|
|
870
|
+ if [ -z ${OPT} ]; then
|
|
871
|
+ OPT="jumpchroot"
|
|
872
|
+ fi
|
|
873
|
+ shift
|
|
874
|
+ ;;
|
829
|
875
|
--add-urpmimedia)
|
830
|
876
|
if [ -z ${OPT} ]; then
|
831
|
877
|
OPT="addurpmimedia"
|
|
@@ -962,6 +1008,7 @@ info "Build path: ${BUILD_PATH}"
|
962
|
1008
|
info "Commande : ${CMDNAME}"
|
963
|
1009
|
info "Firmware path : ${FIRMWARE_PATH}"
|
964
|
1010
|
info "Firmware dir : ${FIRMWARE_DIR}"
|
|
1011
|
+info "Installation method : ${INSTALL_METHOD}"
|
965
|
1012
|
|
966
|
1013
|
# Defining default image size to 7 go
|
967
|
1014
|
if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then
|
|
@@ -972,7 +1019,7 @@ fi
|
972
|
1019
|
if [ "${OPT}" != "clean" ]; then
|
973
|
1020
|
info "cd ${INSTALL_PATH}"
|
974
|
1021
|
if ! [ -e "${INSTALL_PATH}" ]; then
|
975
|
|
- /bin/mkdir -p "${INSTALL_PATH}"
|
|
1022
|
+ /usr/bin/mkdir -p "${INSTALL_PATH}"
|
976
|
1023
|
if [ -z ${?} ]; then
|
977
|
1024
|
error "line ${LINENO} can't make directory ${INSTALL_PATH} , exiting"
|
978
|
1025
|
exit ${ERR_1}
|
|
@@ -1007,19 +1054,16 @@ case ${OPT} in
|
1007
|
1054
|
fi
|
1008
|
1055
|
createImageWrap #Create the empty .img
|
1009
|
1056
|
createchroot #Check qemu and activate it
|
1010
|
|
- genusemirroroptions #Generate mirror options, if needed
|
1011
|
|
- installbasesystem #Generate the rootfs, rootfiles, ...
|
1012
|
|
- enableextrarepos
|
1013
|
|
-# addurpmimedia
|
|
1057
|
+ if [ ${INSTALL_METHOD} = "urpmi" ]; then
|
|
1058
|
+ addurpmimedia
|
|
1059
|
+ else
|
|
1060
|
+ genusemirroroptions #Generate mirror options, if needed
|
|
1061
|
+ enableextrarepos
|
|
1062
|
+ fi
|
|
1063
|
+ installbasesystem #Generate the rootfs, rootfiles, ...
|
1014
|
1064
|
mkfstab
|
1015
|
1065
|
preparechroot
|
1016
|
1066
|
jumpchroot
|
1017
|
|
- #Check before is useless (with $MIRROR
|
1018
|
|
- info "Use mirrorlist to light one server."
|
1019
|
|
- MIRROR=
|
1020
|
|
- genusemirroroptions
|
1021
|
|
- enableextrarepos
|
1022
|
|
-# addurpmimedia
|
1023
|
1067
|
mountPartitions
|
1024
|
1068
|
copyingsystem
|
1025
|
1069
|
unmountingPartitions
|
|
@@ -1028,6 +1072,12 @@ case ${OPT} in
|
1028
|
1072
|
"createchroot")
|
1029
|
1073
|
createchroot
|
1030
|
1074
|
;;
|
|
1075
|
+ "preparechroot")
|
|
1076
|
+ preparechroot
|
|
1077
|
+ ;;
|
|
1078
|
+ "jumpchroot")
|
|
1079
|
+ jumpchroot
|
|
1080
|
+ ;;
|
1031
|
1081
|
"chroot")
|
1032
|
1082
|
jumpchroot
|
1033
|
1083
|
;;
|