parent
7245efa89f
commit
1f3dfce9e9
@ -1,11 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
# Boot using systemd and disable quiet boot
|
||||
# to see what is happening.
|
||||
systemd=/lib/systemd/systemd
|
||||
if [ -f /etc/default/grub ]; then
|
||||
sed -i \
|
||||
-e "s,^\\([ ]*GRUB_CMDLINE_LINUX\\)=\"\"$,\\1=\"init=$systemd\",g" \
|
||||
-e 's,^\([ ]*GRUB_CMDLINE_LINUX_DEFAULT\)="quiet splash",\1="",g' \
|
||||
/etc/default/grub
|
||||
fi
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/03-boot_with_systemd.chroot
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
if=eth0
|
||||
|
||||
# Manually configure the first ethernet device
|
||||
cat >/etc/network/interfaces.d/"$if"<<EOT
|
||||
allow-hotplug $if
|
||||
iface $if inet dhcp
|
||||
EOT
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/04-configure_network.chroot
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
cat >>/etc/fstab<<EOT
|
||||
# Minimal setup required for systemd to provide a r/w FS
|
||||
/dev/root / rootfs defaults 0 0
|
||||
EOT
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/05-create_minimal_fstab.chroot
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
# Change default cache partition (until LP: #1373467 is fixed).
|
||||
if [ -f /etc/system-image/client.ini ]; then
|
||||
sed -ie 's!cache_partition: /android/cache/recovery!cache_partition: /userdata/cache!g' \
|
||||
/etc/system-image/client.ini
|
||||
fi
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/07-configure-system-image-client.chroot
|
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p /etc/writable
|
||||
|
||||
# cloud-init needs to be able to modify hostname and has the ability to
|
||||
# set the other two.
|
||||
for f in timezone localtime hostname; do
|
||||
if [ -e /etc/$f ]; then
|
||||
echo "I: Moving /etc/$f to /etc/writable/"
|
||||
mv /etc/$f /etc/writable/$f
|
||||
fi
|
||||
echo "I: Linking /etc/$f to /etc/writable/"
|
||||
ln -s writable/$f /etc/$f
|
||||
done
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/08-etc-writable.chroot
|
@ -1,22 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
echo "I: Remove unneeded files from /usr/share/doc "
|
||||
find binary/boot/filesystem.dir/usr/share/doc -depth -type f ! -name copyright|xargs rm -f || true
|
||||
find binary/boot/filesystem.dir/usr/share/doc -empty|xargs rmdir || true
|
||||
find binary/boot/filesystem.dir/usr/share/doc -type f -exec gzip -9 {} \;
|
||||
|
||||
echo "I: Remove man/info pages"
|
||||
rm -rf binary/boot/filesystem.dir/usr/share/man \
|
||||
binary/boot/filesystem.dir/usr/share/groff \
|
||||
binary/boot/filesystem.dir/usr/share/info \
|
||||
binary/boot/filesystem.dir/usr/share/lintian \
|
||||
binary/boot/filesystem.dir/usr/share/linda \
|
||||
binary/boot/filesystem.dir/var/cache/man
|
||||
|
||||
|
||||
echo "I: Removing /var/lib/apt/lists/*"
|
||||
find binary/boot/filesystem.dir/var/lib/apt/lists/ -type f | xargs rm -f
|
||||
|
||||
echo "I: Removing /var/cache/apt/*.bin"
|
||||
rm -f binary/boot/filesystem.dir/var/cache/apt/*.bin
|
||||
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/10-remove-documentation.binary
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# see bug https://bugs.launchpad.net/snappy-ubuntu/+bug/1442231
|
||||
rm -f /etc/init.d/grub-common
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/15-remove-grub-common.chroot
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
echo "I: Creating warning to use snappy when apt-get is used"
|
||||
|
||||
PREFIX=binary/boot/filesystem.dir
|
||||
|
||||
mkdir -p $PREFIX/usr/local/bin
|
||||
cat >$PREFIX/usr/local/bin/no-apt <<EOF
|
||||
#!/bin/sh
|
||||
cat <<EOF
|
||||
Ubuntu Core does not use apt-get, see 'snappy --help'!
|
||||
EOF
|
||||
chmod 755 $PREFIX/usr/local/bin/no-apt
|
||||
|
||||
for cmd in apt apt-cache apt-get; do
|
||||
ln -s no-apt $PREFIX/usr/local/bin/$cmd
|
||||
done
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/400-create-apt-get-warning.binary
|
@ -1,108 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# move the kernel out into a new device tarfile with system/boot
|
||||
|
||||
set -ex
|
||||
|
||||
echo "I: Moving kernel into device tarball"
|
||||
|
||||
HERE="$(pwd)"
|
||||
TMPDIR="$(mktemp -d)"
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
mkdir -p $TMPDIR/system/
|
||||
mkdir -p $TMPDIR/assets/
|
||||
|
||||
# cp files, we can't simply use tar --transform as it changes the symlink target
|
||||
(
|
||||
cd binary/boot/filesystem.dir
|
||||
|
||||
# for compatibility with current grub/u-d-f
|
||||
cp -ar --parent boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/system/
|
||||
if [ -e vmlinu? ] && [ -e initrd.img ]; then
|
||||
cp -ar --parent vmlinu? initrd.img $TMPDIR/system
|
||||
fi
|
||||
cp -ar --parent lib/modules/ $TMPDIR/system/
|
||||
cp -ar --parent lib/firmware/ $TMPDIR/system/
|
||||
|
||||
# new assets handling
|
||||
cp -ar boot/vmlinu?-* $TMPDIR/assets/vmlinuz
|
||||
cp -ar boot/initrd.img-* $TMPDIR/assets/initrd.img
|
||||
cp -ar boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/assets/
|
||||
|
||||
dtbs=$(find lib/firmware -type d -name 'device-tree' -print0)
|
||||
[ -n "$dtbs" ] && mv "$dtbs" $TMPDIR/assets/dtbs
|
||||
|
||||
if [ -e vmlinu? ] && [ -e initrd.img ]; then
|
||||
cp -ar --parent vmlinu? initrd.img $TMPDIR/assets
|
||||
cp -ar --parent vmlinu? initrd.img $TMPDIR/assets
|
||||
fi
|
||||
)
|
||||
# create hardware.yaml for u-boot
|
||||
# this assumes armh == u-boot
|
||||
# and all others grub
|
||||
(
|
||||
# common bits
|
||||
cat > $TMPDIR/hardware.yaml << EOF
|
||||
kernel: assets/vmlinuz
|
||||
initrd: assets/initrd.img
|
||||
partiton-layout: system-AB
|
||||
EOF
|
||||
|
||||
# arch specific ones
|
||||
if [ "$ARCH" = "armhf" ]; then
|
||||
cat >> $TMPDIR/hardware.yaml << EOF
|
||||
dtbs: assets/dtbs
|
||||
bootloader: u-boot
|
||||
EOF
|
||||
else
|
||||
cat >> $TMPDIR/hardware.yaml << EOF
|
||||
bootloader: grub
|
||||
EOF
|
||||
fi
|
||||
)
|
||||
|
||||
# and tar it up
|
||||
(
|
||||
cd $TMPDIR
|
||||
tar -c -z -f $HERE/device.tar.gz system assets hardware.yaml
|
||||
)
|
||||
|
||||
# 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 assets hardware.yaml
|
||||
)
|
||||
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
|
||||
rm -rf lib/firmware
|
||||
# remove walinuxagent
|
||||
if [ -e var/lib/dpkg/info/walinuxagent.list ]; then
|
||||
chroot . dpkg --purge walinuxagent || true
|
||||
fi
|
||||
)
|
@ -0,0 +1 @@
|
||||
../../ubuntu-core/hooks/500-move-kernel-to-device-tar.binary
|
Loading…
Reference in new issue