mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-10 04:37:29 +00:00
66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
# move the kernel out into a new device tarfile with system/boot
|
||
|
|
||
|
set -e
|
||
|
|
||
|
echo "I: Moving kernel into device tarball"
|
||
|
|
||
|
HERE="$(pwd)"
|
||
|
TMPDIR="$(mktemp -d)"
|
||
|
mkdir -p $TMPDIR/system/
|
||
|
|
||
|
# cp files, we can't simply use tar --transform as it changes the symlink target
|
||
|
(
|
||
|
cd binary/boot/filesystem.dir
|
||
|
cp -ar --parent boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/system/
|
||
|
cp -ar --parent lib/modules/ $TMPDIR/system/
|
||
|
if [ -e vmlinu? ] && [ -e initrd.img ]; then
|
||
|
cp -ar --parent vmlinu? initrd.img $TMPDIR/system
|
||
|
fi
|
||
|
)
|
||
|
# and tar it up
|
||
|
(
|
||
|
cd $TMPDIR
|
||
|
tar -c -z -f $HERE/device.tar.gz system
|
||
|
)
|
||
|
|
||
|
# now build the azure device tarball by adding walinuxagent
|
||
|
if [ -e binary/boot/filesystem.dir/var/lib/dpkg/info/walinuxagent.list ];
|
||
|
then
|
||
|
(
|
||
|
cd binary/boot/filesystem.dir
|
||
|
while read line; do
|
||
|
line=$(echo $line |cut -d/ -f2-)
|
||
|
if [ -e "$line" ] && [ ! -d "$line" ]; then
|
||
|
cp -ar --parent $line $TMPDIR/system
|
||
|
fi
|
||
|
done < var/lib/dpkg/info/walinuxagent.list
|
||
|
# created by walinuxagent postinst/dh-systemd
|
||
|
cp -ar --parent var/lib/systemd/deb-systemd-helper-enabled/walinuxagent* $TMPDIR/system
|
||
|
cp -ar --parent etc/systemd/system/multi-user.target.wants/walinuxagent* $TMPDIR/system
|
||
|
mkdir -p $TMPDIR/system/var/lib/waagent
|
||
|
)
|
||
|
# and tar it up
|
||
|
(
|
||
|
cd $TMPDIR
|
||
|
tar -c -z -f $HERE/device-azure.tar.gz system
|
||
|
)
|
||
|
fi
|
||
|
rm -rf $TMPDIR
|
||
|
|
||
|
# remove files from the root filesystem
|
||
|
(cd binary/boot/filesystem.dir
|
||
|
rm -f boot/vmlinu?-*
|
||
|
rm -f boot/initrd.img-*
|
||
|
rm -f boot/abi-*
|
||
|
rm -f boot/System.map-*
|
||
|
rm -f initrd.img
|
||
|
rm -f vmlinu?
|
||
|
rm -rf lib/modules
|
||
|
# remove walinuxagent
|
||
|
if [ -e var/lib/dpkg/info/walinuxagent.list ]; then
|
||
|
chroot . dpkg --purge walinuxagent || true
|
||
|
fi
|
||
|
)
|