aboutsummaryrefslogtreecommitdiffstats
path: root/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'functions.sh')
-rwxr-xr-xfunctions.sh22
1 files changed, 10 insertions, 12 deletions
diff --git a/functions.sh b/functions.sh
index dfb3b16..655383d 100755
--- a/functions.sh
+++ b/functions.sh
@@ -28,7 +28,6 @@ function cleanExit(){
if [ 0 -ne ${#} ]; then
if [ 0 -ne ${1} ]; then
warning "unmounting all mounted files before exit"
- unmountdevsysproc
unmountingPartitions
unloopingImage
fi
@@ -359,6 +358,7 @@ function preparechroot() {
function mountdevsysproc(){
print_info "mounting dev, sys, proc directories in chroot"
+ mkdir -p "${BUILD_PATH}/dev" "${BUILD_PATH}/sys" "${BUILD_PATH}/proc"
/usr/bin/mount -B /dev "${BUILD_PATH}/dev"
# mkdir ${BUILD_PATH}/dev
# ln -s ${DEVICE} ${BUILD_PATH}/dev/loop0
@@ -418,8 +418,6 @@ function unmountdevsysproc(){
function jumpchroot() {
title "chrooting to ${BUILD_PATH}"
- mountdevsysproc
-
print_info "Copying resolv.conf"
/usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/"
if [ ${?} -ne 0 ]; then
@@ -446,8 +444,6 @@ function jumpchroot() {
fi
fi
- unmountdevsysproc
-
return 0
}
@@ -663,12 +659,12 @@ function copyingsystem() {
mkdir -p "${ARM_BOOT}"
fi
print_info "copying Mageia image to root partition"
- /usr/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
- /usr/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
- #/usr/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/"
+ /usr/bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
+ /usr/bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/"
+ #/usr/bin/rsync -rlptogDHx "${BUILD_PATH}/boot/" "${BOOT}/"
else
print_info "copying Mageia image to root partition"
- /usr/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
+ /usr/bin/rsync -rlptogDHx --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
fi
copyingCustomSystem
@@ -710,12 +706,15 @@ function mountPartitions() {
mkdir -p "${BUILD_PATH}/boot/EFI"
/usr/bin/mount -B ${BOOT} "${BUILD_PATH}/boot/EFI"
fi
+ mountdevsysproc
}
function unmountingPartitions() {
title "Unmounting partitions..."
+ unmountdevsysproc
+
# Syncing devices before unmounting
/usr/bin/sync
@@ -805,8 +804,8 @@ function unloopingImage() {
# Copying files common to all systems
function copyingcommon() {
title "Copying common files and configuration"
- rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/"
- rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
+ rsync -rlptDHx "${SOURCE_PATH}/common/" "${ROOT}/"
+ rsync -rlptDHx "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/"
chown root:root "${ROOT}/usr/local/bin/"
return 0
}
@@ -831,7 +830,6 @@ function clean() {
print_info "In case script failed or crash inside the chroot, need to unmount dev|sys|proc..."
# TODO find what blocks the umount.
- unmountdevsysproc
unmountingPartitions
unloopingImage