Commit e487aeff authored by Andreas Schmidt's avatar Andreas Schmidt

Add Ubuntu-18.04. images.

parent 1c1c1b5c
......@@ -8,3 +8,5 @@
ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz filter=lfs diff=lfs merge=lfs -text
img/emmc_recovery.img.xz filter=lfs diff=lfs merge=lfs -text
2017-11-29-raspbian-stretch.img.xz filter=lfs diff=lfs merge=lfs -text
ubuntu-18.04-4.14-minimal-odroid-xu4-20180531.img.xz filter=lfs diff=lfs merge=lfs -text
rna.img.xz filter=lfs diff=lfs merge=lfs -text
#!/bin/bash
FILE="ubuntu-18.04-4.14-minimal-odroid-xu4-20180531"
apt-get update
apt-get install qemu-user-static pixz -y
pixz -d ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz ubuntu-16.04.2-minimal-odroid-xu4-20170516.img
md5sum -c ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.md5
limit=$(sfdisk -l --bytes ubuntu-16.04.2-minimal-odroid-xu4-20170516.img | tail -n 1 | awk '{print $2}')
pixz -d $FILE.img.xz $FILE.img
md5sum -c $FILE.img.md5
LIMIT=$(sfdisk -l --bytes $FILE.img | tail -n 1 | awk '{print $2}')
dir=/mnt/rna
DIR=/mnt/rna
mkdir $dir
mount -o loop,offset=$((512 * $limit)) ubuntu-16.04.2-minimal-odroid-xu4-20170516.img $dir
mount --bind /proc $dir/proc/
mount --bind /sys $dir/sys/
mount --bind /dev $dir/dev/
mount --bind /dev/pts $dir/dev/pts
mkdir $dir/srv/salt
mount --bind salt $dir/srv/salt
mkdir $DIR
mount -o loop,offset=$((512 * $LIMIT)) $FILE.img $DIR
mount --bind /proc $DIR/proc/
mount --bind /sys $DIR/sys/
mount --bind /dev $DIR/dev/
mount --bind /dev/pts $DIR/dev/pts
mkdir $DIR/srv/salt
mount --bind salt $DIR/srv/salt
echo 'nameserver 9.9.9.9' >> $dir/etc/resolv.conf
echo 'nameserver 9.9.9.9' >> $DIR/etc/resolv.conf
cp $(which qemu-arm-static) $dir/usr/bin
cp provision.sh $dir/root
chroot $dir qemu-arm-static /bin/bash /root/provision.sh
cp $(which qemu-arm-static) $DIR/usr/bin
cp provision.sh $DIR/root
chroot $DIR qemu-arm-static /bin/bash /root/provision.sh
rm $dir/root/provision.sh
rm $DIR/root/provision.sh
sync
umount -l $dir/srv/salt
umount -l $dir/dev/pts
umount -l $dir/dev
umount -l $dir/proc
umount -l $dir/sys
umount -l $DIR/srv/salt
umount -l $DIR/dev/pts
umount -l $DIR/dev
umount -l $DIR/proc
umount -l $DIR/sys
umount -l $dir
umount -l $DIR
mv ubuntu-16.04.2-minimal-odroid-xu4-20170516.img rna.img
mv $FILE.img rna.img
pixz rna.img rna.img.xz
rm rna.img
17cca8112d4f28d5c3a10f917f0717e9 ubuntu-18.04-4.14-minimal-odroid-xu4-20180531.img
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment