[scripts] mkloopcard.txt: cleanup and fixes
This commit is contained in:
parent
00930cadf9
commit
fbe5502b69
@ -27,10 +27,11 @@ cleanup_loopbacks() {
|
|||||||
sync
|
sync
|
||||||
sleep 5
|
sleep 5
|
||||||
sync
|
sync
|
||||||
|
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}" &> /dev/null; rmdir "${tmp_dir}" &> /dev/null; }
|
||||||
|
sleep 1
|
||||||
[[ -n "${vfat_part}" ]] && losetup -d "${vfat_part}" 2> /dev/null
|
[[ -n "${vfat_part}" ]] && losetup -d "${vfat_part}" 2> /dev/null
|
||||||
[[ -n "${ext_part}" ]] && losetup -d "${ext_part}" 2> /dev/null
|
[[ -n "${ext_part}" ]] && losetup -d "${ext_part}" 2> /dev/null
|
||||||
[[ -n "${DRIVE}" ]] && losetup -d "${DRIVE}" 2> /dev/null
|
[[ -n "${DRIVE}" ]] && losetup -d "${DRIVE}" 2> /dev/null
|
||||||
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}" &> /dev/null; rmdir "${tmp_dir}" &> /dev/null; }
|
|
||||||
}
|
}
|
||||||
trap "cleanup_loopbacks" 1 2 3 6 9 14 15 EXIT
|
trap "cleanup_loopbacks" 1 2 3 6 9 14 15 EXIT
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ echo "Formatting ExtFS ${ext_part}..."
|
|||||||
mkfs.ext3 -L "Sabayon" "${ext_part}" || exit 1
|
mkfs.ext3 -L "Sabayon" "${ext_part}" || exit 1
|
||||||
|
|
||||||
tmp_dir=$(mktemp -d)
|
tmp_dir=$(mktemp -d)
|
||||||
if [ -z "${tmp_dir}" ]]; then
|
if [[ -z "${tmp_dir}" ]]; then
|
||||||
echo "Cannot create temporary dir"
|
echo "Cannot create temporary dir"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -120,24 +121,27 @@ umount "${tmp_dir}" || exit 1
|
|||||||
|
|
||||||
echo "Setting up the extfs directory content, mounting on ${tmp_dir}"
|
echo "Setting up the extfs directory content, mounting on ${tmp_dir}"
|
||||||
mount "${ext_part}" "${tmp_dir}"
|
mount "${ext_part}" "${tmp_dir}"
|
||||||
rsync -avP _H -A -X --delete-during "${CHROOT_DIR}"/ "${tmp_dir}"/ || exit 1
|
rsync -a -H -A -X --delete-during "${CHROOT_DIR}"/ "${tmp_dir}"/ || exit 1
|
||||||
|
|
||||||
# work out paths to empty and paths to remove
|
# work out paths to empty and paths to remove
|
||||||
# XXX
|
|
||||||
oldifs="${IFS}"
|
oldifs="${IFS}"
|
||||||
IFS=";"
|
IFS=";"
|
||||||
for path in "${tmp_dir}"/${PATHS_TO_REMOVE}; do
|
if [ -n "${PATHS_TO_REMOVE}" ]; then
|
||||||
if [ -e "${path}" ]; then
|
for path in "${tmp_dir}"/${PATHS_TO_REMOVE}; do
|
||||||
echo "Removing: ${path}"
|
if [ -e "${path}" ]; then
|
||||||
rm -rf "${path}"
|
echo "Removing: ${path}"
|
||||||
fi
|
rm -rf "${path}"
|
||||||
done
|
fi
|
||||||
for path in "${tmp_dir}"/${PATHS_TO_EMPTY}; do
|
done
|
||||||
if [ -d "${path}" ]; then
|
fi
|
||||||
echo "Emptying: ${path}"
|
if [ -n "${PATHS_TO_EMPTY}" ]; then
|
||||||
rm -rf "${path}"/*
|
for path in "${tmp_dir}"/${PATHS_TO_EMPTY}; do
|
||||||
fi
|
if [ -d "${path}" ]; then
|
||||||
done
|
echo "Emptying: ${path}"
|
||||||
|
rm -rf "${path}"/*
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
IFS="${oldifs}"
|
IFS="${oldifs}"
|
||||||
|
|
||||||
if [ -n "${RELEASE_FILE}" ]; then
|
if [ -n "${RELEASE_FILE}" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user