FerrochromeApp: Use downloader if ferrochrome image is missing
Brief flow with downloader
- Step 1: If FerrochromeApp has assets, then use it as of now.
- Step 2: Otherwise, try launch ferrochrome downloader via predefined
action.
- Step 3: Ferrochrome downloader returns the downloaded archive
location. This enables downloader to use any locations
and allows to keep CrOS in more secure place.
- Step 4: FerrochromeApp pass the returned downloaded path to
custom_vm_setup.
- Step 5: custom_vm_setup extract files to the predefined paths
- Step 6: FerrochromeApp launches VmLauncherApp.
Bug: 350876313
Test: Locally with downloader
Change-Id: Ieb47e960575226c3eca6b3bacfb4bdb6c82420a9
diff --git a/android/FerrochromeApp/custom_vm_setup.sh b/android/FerrochromeApp/custom_vm_setup.sh
index a5480ff..4dce0c7 100644
--- a/android/FerrochromeApp/custom_vm_setup.sh
+++ b/android/FerrochromeApp/custom_vm_setup.sh
@@ -7,13 +7,13 @@
}
function install() {
- user=$(cmd user get-main-user)
- src_dir=/data/media/${user}/ferrochrome/
+ src_dir=$(getprop debug.custom_vm_setup.path)
+ src_dir=${src_dir/#\/storage\/emulated\//\/data\/media\/}
dst_dir=/data/local/tmp/
cat $(find ${src_dir} -name "images.tar.gz*" | sort) | tar xz -C ${dst_dir}
- cp -u ${src_dir}vm_config.json ${dst_dir}
- chmod 666 ${dst_dir}*
+ cp -u ${src_dir}/vm_config.json ${dst_dir}
+ chmod 666 ${dst_dir}/*
# increase the size of state.img to the multiple of 4096
num_blocks=$(du -b -K ${dst_dir}state.img | cut -f 1)
@@ -21,8 +21,8 @@
additional_blocks=$((( ${required_num_blocks} - ${num_blocks} )))
dd if=/dev/zero bs=512 count=${additional_blocks} >> ${dst_dir}state.img
- rm ${src_dir}images.tar.gz*
- rm ${src_dir}vm_config.json
+ rm ${src_dir}/images.tar.gz*
+ rm ${src_dir}/vm_config.json
}
setprop debug.custom_vm_setup.done false