mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
parallel-debian: Rework scripts to not use loopback mounts
It's not necessary and adds a lot of overhead for the build. Instead, just dynamically make an ext4 image of the fs when booting in QEMU.
This commit is contained in:
parent
d0b3a07cf1
commit
0c568ff604
@ -1,3 +1,8 @@
|
||||
|
||||
all: ostree_switch_root chroot_break
|
||||
|
||||
ostree_switch_root: ostree_switch_root.c Makefile
|
||||
gcc -Wall -o $@ $<
|
||||
|
||||
chroot_break: chroot_break.c Makefile
|
||||
gcc -Wall -o $@ $<
|
||||
|
@ -35,11 +35,7 @@ if test -d /ostree; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
mount -o loop gnomeos-filesystem.img fs
|
||||
cp -a fs/ostree /
|
||||
umount fs
|
||||
cp -a gnomeos-fs/ostree /
|
||||
initrd=`readlink gnomeos-initrd.img`
|
||||
cp ${initrd} /boot
|
||||
grubby --title "GNOME OS" --add-kernel=$kernel --copy-default --initrd=/boot/${initrd}
|
||||
|
@ -69,33 +69,17 @@ if ! test -d ${OBJ} ; then
|
||||
mv ${OBJ}.tmp ${OBJ}
|
||||
fi
|
||||
|
||||
OBJ=$DEBTARGET.img
|
||||
if ! test -f ${OBJ}; then
|
||||
umount fs || true
|
||||
mkdir -p fs
|
||||
qemu-img create ${OBJ}.tmp 2G
|
||||
mkfs.ext4 -q -F ${OBJ}.tmp
|
||||
mount -o loop ${OBJ}.tmp fs
|
||||
OBJ=$DEBTARGET-fs
|
||||
if ! test -d ${OBJ}; then
|
||||
rm -rf ${OBJ}.tmp
|
||||
mkdir ${OBJ}.tmp
|
||||
|
||||
for d in debootstrap-$DEBTARGET/var/cache/apt/archives/*.deb; do
|
||||
rm -rf work; mkdir work
|
||||
(cd work && ar x ../$d && tar -x -z -C ../fs -f data.tar.gz)
|
||||
(cd work && ar x ../$d && tar -x -z -C ../${OBJ}.tmp -f data.tar.gz)
|
||||
done
|
||||
|
||||
umount fs
|
||||
mv ${OBJ}.tmp ${OBJ}
|
||||
fi
|
||||
|
||||
# TODO download source for above
|
||||
# TODO download build dependencies for above
|
||||
|
||||
OBJ=gnomeos-filesystem.img
|
||||
if ! test -f ${OBJ}; then
|
||||
cp -a --sparse=always $DEBTARGET.img ${OBJ}.tmp
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
mount -o loop ${OBJ}.tmp fs
|
||||
(cd fs;
|
||||
(cd ${OBJ}.tmp;
|
||||
mkdir ostree
|
||||
mkdir ostree/repo
|
||||
mkdir ostree/gnomeos-origin
|
||||
@ -114,21 +98,44 @@ if ! test -f ${OBJ}; then
|
||||
fi
|
||||
done
|
||||
|
||||
$OSTREE init --repo=ostree/repo
|
||||
(cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Initial import' --repo=../repo --from-stdin)
|
||||
)
|
||||
if test -d ${OBJ}; then
|
||||
mv ${OBJ} ${OBJ}.old
|
||||
fi
|
||||
mv ${OBJ}.tmp ${OBJ}
|
||||
rm -rf ${OBJ}.old
|
||||
fi
|
||||
|
||||
# TODO download source for above
|
||||
# TODO download build dependencies for above
|
||||
|
||||
OBJ=gnomeos-fs
|
||||
if ! test -d ${OBJ}; then
|
||||
rm -rf ${OBJ}.tmp
|
||||
cp -al $DEBTARGET-fs ${OBJ}.tmp
|
||||
(cd ${OBJ}.tmp;
|
||||
|
||||
cp ${SRCDIR}/debian-setup.sh ostree/gnomeos-origin/
|
||||
chroot ostree/gnomeos-origin ./debian-setup.sh
|
||||
rm ostree/gnomeos-origin/debian-setup.sh
|
||||
(cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Run debian-setup.sh' --repo=../repo --from-stdin)
|
||||
|
||||
cp -p ${SRCDIR}/chroot_break ostree/gnomeos-origin/sbin/chroot_break
|
||||
(cd ostree/gnomeos-origin; $OSTREE commit -s 'Add chroot_break' --repo=../repo --add=sbin/chroot_break)
|
||||
|
||||
$OSTREE init --repo=ostree/repo
|
||||
(cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Initial import' --repo=../repo --from-stdin)
|
||||
rm -rf ostree/gnomeos-origin
|
||||
(cd ostree;
|
||||
rev=`cat repo/HEAD`
|
||||
$OSTREE checkout --repo=repo HEAD gnomeos-${rev}
|
||||
$OSTREE run-triggers --repo=repo current
|
||||
ln -s gnomeos-${rev} current)
|
||||
)
|
||||
umount fs
|
||||
if test -d ${OBJ}; then
|
||||
mv ${OBJ} ${OBJ}.old
|
||||
fi
|
||||
mv ${OBJ}.tmp ${OBJ}
|
||||
rm -rf ${OBJ}.old
|
||||
fi
|
||||
|
||||
cp ${SRCDIR}/ostree_switch_root ${WORKDIR}
|
||||
|
@ -24,11 +24,22 @@ set -x
|
||||
SRCDIR=`dirname $0`
|
||||
WORKDIR=`pwd`
|
||||
|
||||
OBJ=gnomeos-initrd.img
|
||||
if ! test -f ${OBJ}; then
|
||||
echo "Error: couldn't find '$OBJ'. Run gnomeos-make-image.sh"
|
||||
if ! test -d gnomeos-fs; then
|
||||
echo "Error: couldn't find gnomeos-fs. Run gnomeos-make-image.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umount fs || true
|
||||
exec qemu-kvm -kernel `grubby --default-kernel` -initrd gnomeos-initrd.img -hda gnomeos-filesystem.img -append "root=/dev/sda ostree=current"
|
||||
OBJ=gnomeos-fs.img
|
||||
if (! test -f ${OBJ}) || test gnomeos-fs -nt ${OBJ}; then
|
||||
rm -f ${OBJ}.tmp
|
||||
qemu-img create ${OBJ}.tmp 2G
|
||||
mkfs.ext4 -q -F ${OBJ}.tmp
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
mount -o loop ${OBJ}.tmp fs
|
||||
cp -a gnomeos-fs/* fs
|
||||
umount fs
|
||||
mv ${OBJ}.tmp ${OBJ}
|
||||
fi
|
||||
|
||||
exec qemu-kvm -kernel `grubby --default-kernel` -initrd gnomeos-initrd.img -hda gnomeos-fs.img -append "root=/dev/sda ostree=current"
|
||||
|
Loading…
x
Reference in New Issue
Block a user