#!/bin/bash
#script for Ubuntu 18.04
# download any Chrome OS bin
#put them in /home/user/z
#folder with OS.bin
cd /home/user/z
extract_sfs()
{
sudo kpartx -av $1
mkdir /home/user/c
mkdir /home/user/img
#loopX - number is the result of kpartx. 3 must be fixed.
sudo mount -t ext2 /dev/mapper/loop8p3 -o ro /home/user/c
ls /home/user/c
sudo mount /home/user/c/opt/google/containers/android/vendor.raw.img /home/user/img
ls /home/user/img
#read -p "Press [Enter] key ..."
/home/user/img/bin/houdini --version > /home/user/houdini_version
rm /home/user/$1.sfs
mksquashfs /home/user/img/lib/arm/* /home/user/img/lib/libhoudini.so /home/user/img/bin/houdini /home/user/houdini_version /home/user/$1.sfs -no-progress
sudo umount -l /home/user/img
sudo umount -l /home/user/c
sudo kpartx -dv $1
cp -f /home/user/$1.sfs /home/user/z/$1.sfs
}
for f in *.bin
do
extract_sfs $f
done