2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Including common functions
|
2012-08-27 13:52:29 +00:00
|
|
|
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Setting static variables
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Build rootfs image"
|
2007-09-23 08:04:48 +00:00
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
2015-02-05 02:30:47 -01:00
|
|
|
# Processing arguments and configuration files
|
|
|
|
Init_config_data "${@}"
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
Echo_message "Begin building root filesystem image..."
|
2007-09-23 08:04:49 +00:00
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Requiring stage file
|
2020-03-15 12:05:44 -01:00
|
|
|
Require_stagefiles config bootstrap binary_chroot
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:04:50 +00:00
|
|
|
# Checking stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Check_stagefile
|
2007-09-23 08:04:50 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
Acquire_lockfile
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2020-04-01 09:58:47 +00:00
|
|
|
case "${LB_ARCHITECTURE}" in
|
2009-12-09 19:54:41 -01:00
|
|
|
amd64|i386)
|
2007-09-23 08:05:12 +00:00
|
|
|
LINUX="vmlinuz"
|
|
|
|
;;
|
|
|
|
|
2021-11-14 16:22:41 -01:00
|
|
|
powerpc|ppc64el|riscv64)
|
2007-09-23 08:05:12 +00:00
|
|
|
LINUX="vmlinux"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_INITRAMFS}" in
|
2024-06-25 09:35:35 +00:00
|
|
|
live-boot|dracut-live)
|
2007-09-23 08:04:52 +00:00
|
|
|
INITFS="live"
|
|
|
|
;;
|
2011-06-08 08:07:26 +00:00
|
|
|
|
|
|
|
*)
|
|
|
|
INITFS="boot"
|
|
|
|
;;
|
2007-09-23 08:04:52 +00:00
|
|
|
esac
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Creating directory
|
2007-09-23 08:05:11 +00:00
|
|
|
mkdir -p binary/${INITFS}
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
if In_list "rootfs" ${LB_CACHE_STAGES} && [ -d cache/binary_rootfs ]
|
|
|
|
then
|
|
|
|
# Removing old chroot
|
|
|
|
rm -rf binary/"${INITFS}"/filesystem.*
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Restoring old cache
|
|
|
|
mkdir -p binary/"${INITFS}"
|
|
|
|
cp -a cache/binary_rootfs/filesystem.* binary/"${INITFS}"
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Creating stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Create_stagefile
|
2015-01-06 02:43:43 -01:00
|
|
|
exit 0
|
|
|
|
fi
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_CHROOT_FILESYSTEM}" in
|
2011-08-25 21:47:30 +00:00
|
|
|
ext2|ext3|ext4)
|
2007-09-23 08:04:51 +00:00
|
|
|
# Checking depends
|
2015-01-04 16:08:09 -01:00
|
|
|
Check_package chroot /sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Restoring cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Restore_package_cache binary
|
2007-09-23 08:05:15 +00:00
|
|
|
|
2007-09-23 08:04:51 +00:00
|
|
|
# Installing depends
|
2020-05-05 15:42:44 +00:00
|
|
|
Install_packages
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2008-03-02 09:12:02 -01:00
|
|
|
# Remove old image
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2010-09-07 13:11:20 +00:00
|
|
|
rm -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
|
|
|
|
2011-05-25 10:32:52 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
|
|
|
true)
|
2011-06-08 08:02:10 +00:00
|
|
|
DU_DIM="$(du -ms chroot/chroot | cut -f1)"
|
|
|
|
INODES="$(find chroot/chroot | wc -l)"
|
2011-05-25 10:32:52 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
2011-06-08 08:02:10 +00:00
|
|
|
DU_DIM="$(du -ms chroot | cut -f1)"
|
|
|
|
INODES="$(find chroot | wc -l)"
|
2011-05-25 10:32:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_CHROOT_FILESYSTEM})"
|
2011-06-08 08:02:10 +00:00
|
|
|
REAL_INODES="$(Calculate_partition_size ${INODES} ${LB_CHROOT_FILESYSTEM})"
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2011-06-08 08:02:10 +00:00
|
|
|
dd if=/dev/zero of=chroot/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM}
|
2011-09-30 22:23:34 +00:00
|
|
|
|
2020-02-20 07:12:54 -01:00
|
|
|
FAKE_MTAB=false
|
2023-08-20 08:57:43 +00:00
|
|
|
if ! Chroot chroot "test -e /etc/mtab"
|
2011-09-30 22:23:34 +00:00
|
|
|
then
|
|
|
|
Chroot chroot "ln -s /proc/mounts/mtab /etc/mtab"
|
2020-02-20 07:12:54 -01:00
|
|
|
FAKE_MTAB=true
|
2011-09-30 22:23:34 +00:00
|
|
|
fi
|
2021-07-19 09:50:22 +00:00
|
|
|
BLOCK_SIZE=1024
|
|
|
|
if [ "${LB_DM_VERITY}" = "true" ]
|
|
|
|
then
|
|
|
|
# dm-verity needs a block size of at least 4k
|
|
|
|
BLOCK_SIZE=4096
|
|
|
|
fi
|
|
|
|
Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b ${BLOCK_SIZE} -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}"
|
2011-06-08 08:02:10 +00:00
|
|
|
|
|
|
|
mkdir -p filesystem.tmp
|
2013-02-18 09:29:04 -01:00
|
|
|
mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
|
2011-06-08 08:02:10 +00:00
|
|
|
cp -a chroot/chroot/* filesystem.tmp
|
|
|
|
|
2020-02-20 07:12:54 -01:00
|
|
|
if $FAKE_MTAB; then
|
2011-09-30 22:23:34 +00:00
|
|
|
Chroot chroot "rm -f /etc/mtab"
|
|
|
|
fi
|
|
|
|
|
2013-02-18 09:29:04 -01:00
|
|
|
umount filesystem.tmp
|
2011-06-08 08:02:10 +00:00
|
|
|
rmdir filesystem.tmp
|
2007-09-23 08:05:15 +00:00
|
|
|
|
|
|
|
# Move image
|
2010-09-07 13:11:20 +00:00
|
|
|
mv chroot/filesystem.${LB_CHROOT_FILESYSTEM} binary/${INITFS}
|
2009-10-16 16:35:28 +00:00
|
|
|
|
2015-05-03 13:53:27 +00:00
|
|
|
du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size
|
2010-07-02 12:29:52 +00:00
|
|
|
|
2022-01-18 20:30:47 -01:00
|
|
|
# Removing depends
|
|
|
|
Remove_packages
|
|
|
|
|
2009-10-16 16:35:28 +00:00
|
|
|
if [ -e chroot/chroot.cache ]
|
|
|
|
then
|
2015-02-05 02:30:47 -01:00
|
|
|
Remove_lockfile
|
2009-10-16 16:35:28 +00:00
|
|
|
mv chroot/chroot chroot.tmp
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep remove all mode-archives-binary "${@}"
|
2009-10-16 16:35:28 +00:00
|
|
|
|
|
|
|
rm -rf chroot
|
|
|
|
mv chroot.tmp chroot
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep install all mode-archives-binary "${@}"
|
2009-10-16 16:35:28 +00:00
|
|
|
|
|
|
|
touch .lock
|
|
|
|
else
|
|
|
|
rm -rf chroot/chroot
|
|
|
|
fi
|
2007-09-23 08:05:15 +00:00
|
|
|
;;
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2011-06-08 08:02:10 +00:00
|
|
|
dd if=/dev/zero of=binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM}
|
|
|
|
mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
|
|
|
|
|
|
|
|
mkdir -p filesystem.tmp
|
2013-02-18 09:29:04 -01:00
|
|
|
mount -o loop binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
|
2011-06-08 08:02:10 +00:00
|
|
|
cp -a chroot/* filesystem.tmp
|
|
|
|
|
2013-02-18 09:29:04 -01:00
|
|
|
umount filesystem.tmp
|
2011-06-08 08:02:10 +00:00
|
|
|
rmdir filesystem.tmp
|
2007-09-23 08:05:15 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Saving cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Save_package_cache binary
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
|
|
|
|
2008-02-20 23:07:54 -01:00
|
|
|
jffs2)
|
|
|
|
# Checking depends
|
2015-01-04 16:08:09 -01:00
|
|
|
Check_package chroot /usr/sbin/mkfs.jffs2 mtd-tools
|
2008-02-20 23:07:54 -01:00
|
|
|
|
|
|
|
# Restoring cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Restore_package_cache binary
|
2008-02-20 23:07:54 -01:00
|
|
|
|
|
|
|
# Installing depends
|
2020-05-05 15:42:44 +00:00
|
|
|
Install_packages
|
2008-02-20 23:07:54 -01:00
|
|
|
|
2008-03-01 11:19:54 -01:00
|
|
|
# Remove old jffs2 image
|
2008-02-20 23:07:54 -01:00
|
|
|
if [ -f binary/${INITFS}/filesystem.jffs2 ]
|
|
|
|
then
|
|
|
|
rm -f binary/${INITFS}/filesystem.jffs2
|
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_JFFS2_ERASEBLOCK}" ]
|
2008-03-01 11:19:54 -01:00
|
|
|
then
|
2010-09-07 13:11:20 +00:00
|
|
|
JFFS2_OPTIONS="--eraseblock=${LB_JFFS2_ERASEBLOCK}"
|
2008-03-01 11:19:54 -01:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output filesystem.jffs2"
|
2008-02-20 23:07:54 -01:00
|
|
|
|
|
|
|
# Move image
|
|
|
|
mv chroot/filesystem.jffs2 binary/${INITFS}
|
2009-10-16 16:35:28 +00:00
|
|
|
|
2022-01-18 20:30:47 -01:00
|
|
|
# Removing depends
|
|
|
|
Remove_packages
|
|
|
|
|
2009-10-16 16:35:28 +00:00
|
|
|
if [ -e chroot/chroot.cache ]
|
|
|
|
then
|
2015-02-05 02:30:47 -01:00
|
|
|
Remove_lockfile
|
2009-10-16 16:35:28 +00:00
|
|
|
mv chroot/chroot chroot.tmp
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep remove all mode-archives-binary "${@}"
|
2009-10-16 16:35:28 +00:00
|
|
|
|
|
|
|
rm -rf chroot
|
|
|
|
mv chroot.tmp chroot
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep install all mode-archives-binary "${@}"
|
2009-12-21 12:33:03 -01:00
|
|
|
|
|
|
|
touch .lock
|
2009-10-16 16:35:28 +00:00
|
|
|
else
|
|
|
|
rm -rf chroot/chroot
|
|
|
|
fi
|
2008-02-20 23:07:54 -01:00
|
|
|
;;
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2008-03-01 11:19:54 -01:00
|
|
|
mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output binary/${INITFS}/filesystem.jffs2
|
2008-02-20 23:07:54 -01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Saving cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Save_package_cache binary
|
2008-02-20 23:07:54 -01:00
|
|
|
;;
|
|
|
|
|
2012-05-23 05:16:47 +00:00
|
|
|
plain)
|
2007-09-23 08:04:52 +00:00
|
|
|
if [ -d binary/${INITFS}/filesystem.dir ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2007-09-23 08:04:52 +00:00
|
|
|
rm -rf binary/${INITFS}/filesystem.dir
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2022-01-17 13:33:48 -01:00
|
|
|
if [ -e chroot/chroot.cache ]
|
|
|
|
then
|
|
|
|
# Different from the other LB_CHROOT_FILESYSTEM values:
|
|
|
|
# continue working in the bootstrap chroot, not the generated chroot.
|
|
|
|
# This saves the time to create a full copy of the generated chroot.
|
|
|
|
cp -a chroot/chroot/boot chroot
|
|
|
|
mv chroot/chroot binary/${INITFS}/filesystem.dir
|
|
|
|
else
|
|
|
|
rm -fr chroot/chroot
|
|
|
|
|
|
|
|
# Removing depends
|
|
|
|
Remove_packages
|
|
|
|
fi
|
2007-09-23 08:05:15 +00:00
|
|
|
;;
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2007-09-23 08:05:15 +00:00
|
|
|
cp -a chroot binary/${INITFS}/filesystem.dir
|
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
squashfs)
|
2007-09-23 08:04:51 +00:00
|
|
|
# Checking depends
|
2015-01-04 16:08:09 -01:00
|
|
|
Check_package chroot /usr/share/doc/squashfs-tools squashfs-tools
|
2007-09-23 08:05:15 +00:00
|
|
|
|
|
|
|
# Restoring cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Restore_package_cache binary
|
2007-09-23 08:04:51 +00:00
|
|
|
|
|
|
|
# Installing depends
|
2020-05-05 15:42:44 +00:00
|
|
|
Install_packages
|
2007-09-23 08:04:51 +00:00
|
|
|
|
2010-01-23 07:47:41 -01:00
|
|
|
Echo_message "Preparing squashfs image..."
|
|
|
|
Echo_message "This may take a while."
|
|
|
|
|
2007-09-23 08:04:51 +00:00
|
|
|
# Remove old squashfs image
|
2007-09-23 08:04:52 +00:00
|
|
|
if [ -f binary/${INITFS}/filesystem.squashfs ]
|
2007-09-23 08:04:48 +00:00
|
|
|
then
|
2007-09-23 08:04:52 +00:00
|
|
|
rm -f binary/${INITFS}/filesystem.squashfs
|
2007-09-23 08:04:48 +00:00
|
|
|
fi
|
|
|
|
|
2008-03-23 03:08:46 -01:00
|
|
|
# Remove stale squashfs image
|
|
|
|
rm -f chroot/filesystem.squashfs
|
|
|
|
|
2021-02-18 05:15:50 -01:00
|
|
|
# Do not display progress bar if:
|
|
|
|
# - Run with --quiet, or
|
|
|
|
# - stdin is not a terminal (e.g. in CI, cron, etc)
|
|
|
|
if [ "${_QUIET}" = "true" ] || [ ! -t 0 ]
|
2021-01-16 15:09:52 -01:00
|
|
|
then
|
|
|
|
MKSQUASHFS_OPTIONS="-no-progress ${MKSQUASHFS_OPTIONS}"
|
|
|
|
fi
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${_VERBOSE}" = "true" ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-info ${MKSQUASHFS_OPTIONS}"
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|
|
|
|
|
2012-10-22 18:41:40 +00:00
|
|
|
if [ -f config/rootfs/squashfs.sort ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-sort squashfs.sort ${MKSQUASHFS_OPTIONS}"
|
2010-09-30 15:30:23 +00:00
|
|
|
|
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
|
|
|
true)
|
2021-01-01 15:51:02 -01:00
|
|
|
cp -a config/rootfs/squashfs.sort chroot
|
2010-09-30 15:30:23 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
2021-01-01 15:51:02 -01:00
|
|
|
cp -a config/rootfs/squashfs.sort .
|
2010-09-30 15:30:23 +00:00
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2020-10-07 21:25:22 +00:00
|
|
|
# Set squashfs compression type or default to xz
|
|
|
|
if [ -n "${LB_CHROOT_SQUASHFS_COMPRESSION_TYPE}" ]
|
|
|
|
then
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-comp ${LB_CHROOT_SQUASHFS_COMPRESSION_TYPE} ${MKSQUASHFS_OPTIONS}"
|
2020-10-07 21:25:22 +00:00
|
|
|
else
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-comp xz ${MKSQUASHFS_OPTIONS}"
|
2020-10-07 21:25:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL}" ]
|
|
|
|
then
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-Xcompression-level ${LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL} ${MKSQUASHFS_OPTIONS}"
|
2020-10-07 21:25:22 +00:00
|
|
|
fi
|
2011-04-28 22:01:45 +00:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2012-10-22 18:41:40 +00:00
|
|
|
if [ -e config/rootfs/excludes ]
|
2011-06-02 22:21:07 +00:00
|
|
|
then
|
2021-01-01 15:51:02 -01:00
|
|
|
cp -a config/rootfs/excludes chroot/excludes
|
2011-06-02 22:21:07 +00:00
|
|
|
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-wildcards -ef /excludes ${MKSQUASHFS_OPTIONS}"
|
2011-06-02 22:21:07 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Create image
|
2021-01-16 15:14:17 -01:00
|
|
|
Chroot chroot "nice -n 17 mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}"
|
2007-09-23 08:05:15 +00:00
|
|
|
|
2015-01-07 21:14:56 -01:00
|
|
|
rm -f chroot/excludes
|
2011-06-02 22:21:07 +00:00
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Move image
|
2013-02-18 09:29:04 -01:00
|
|
|
mv chroot/filesystem.squashfs binary/${INITFS}
|
|
|
|
rm -f chroot/squashfs.sort
|
2009-10-16 16:35:28 +00:00
|
|
|
|
2022-01-18 20:30:47 -01:00
|
|
|
# Removing depends
|
|
|
|
Remove_packages
|
|
|
|
|
2009-10-16 16:35:28 +00:00
|
|
|
if [ -e chroot/chroot.cache ]
|
|
|
|
then
|
2015-02-05 02:30:47 -01:00
|
|
|
Remove_lockfile
|
2009-10-16 16:35:28 +00:00
|
|
|
mv chroot/chroot chroot.tmp
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep remove all mode-archives-binary "${@}"
|
2009-10-16 16:35:28 +00:00
|
|
|
|
|
|
|
rm -rf chroot
|
|
|
|
mv chroot.tmp chroot
|
|
|
|
|
2020-04-05 19:07:44 +00:00
|
|
|
lb chroot_prep install all mode-archives-binary "${@}"
|
2009-10-16 16:35:28 +00:00
|
|
|
|
|
|
|
touch .lock
|
|
|
|
else
|
|
|
|
rm -rf chroot/chroot
|
|
|
|
fi
|
2007-09-23 08:05:15 +00:00
|
|
|
;;
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2012-10-22 18:41:40 +00:00
|
|
|
if [ -e config/rootfs/excludes ]
|
2011-06-02 22:21:07 +00:00
|
|
|
then
|
2021-01-14 10:29:51 -01:00
|
|
|
MKSQUASHFS_OPTIONS="-wildcards -ef config/rootfs/excludes ${MKSQUASHFS_OPTIONS}"
|
2011-06-02 22:21:07 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-24 15:04:04 -01:00
|
|
|
nice -n 19 mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS}
|
2007-09-23 08:05:15 +00:00
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2015-01-07 21:17:19 -01:00
|
|
|
chmod 0644 binary/${INITFS}/filesystem.squashfs
|
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Saving cache
|
2015-01-06 02:46:37 -01:00
|
|
|
Save_package_cache binary
|
2007-09-23 08:04:46 +00:00
|
|
|
;;
|
2009-02-25 07:51:28 -01:00
|
|
|
|
|
|
|
none)
|
|
|
|
if [ -d binary ]
|
|
|
|
then
|
|
|
|
rm -rf binary
|
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2009-02-25 07:51:28 -01:00
|
|
|
mv chroot/chroot binary
|
|
|
|
;;
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2009-02-25 07:51:28 -01:00
|
|
|
Echo_message "This may take a while."
|
|
|
|
cp -a chroot binary
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2010-10-04 13:49:08 +00:00
|
|
|
esac
|
2010-09-26 12:28:41 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
if In_list "rootfs" ${LB_CACHE_STAGES}
|
|
|
|
then
|
|
|
|
rm -rf cache/binary_rootfs
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
mkdir -p cache/binary_rootfs
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
if [ "${LB_CHROOT_FILESYSTEM}" != "none" ]
|
|
|
|
then
|
|
|
|
cp -a binary/"${INITFS}"/filesystem.* cache/binary_rootfs
|
2007-09-23 08:05:12 +00:00
|
|
|
fi
|
2015-01-06 02:43:43 -01:00
|
|
|
fi
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Creating stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Create_stagefile
|