Resize /system in boot

Is it really safe?
Tested on Allview V3 Viper and Huawei Mate 9
This commit is contained in:
Pierre-Hugues Husson 2018-04-03 00:13:48 +02:00
parent 1e27cc1157
commit 25d7b4c539
5 changed files with 22 additions and 0 deletions

View File

@ -43,5 +43,8 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \
device/phh/treble/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf
PRODUCT_COPY_FILES += \
device/phh/treble/resize-system.sh:system/bin/resize-system.sh
PRODUCT_PACKAGES += \
treble-environ-rc

11
resize-system.sh Normal file
View File

@ -0,0 +1,11 @@
#!/system/bin/sh
set -e
if [ "grep ' /system ' /proc/mounts |cut -d ' ' -f 1 |wc -l" -ne 1 ];then
exit 0
fi
mount -o remount,rw /system
resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1)
mount -o remount,ro /system

View File

@ -1,3 +1,4 @@
/system/bin/phh-su u:object_r:phhsu_exec:s0
/system/bin/vndk-detect u:object_r:vndk_detect_exec:s0
/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0
/system/bin/resize-system.sh u:object_r:update_engine_exec:s0

6
sepolicy/resize.te Normal file
View File

@ -0,0 +1,6 @@
allow update_engine { toolbox_exec system_file }:file rx_file_perms;
allow update_engine labeledfs:filesystem remount;
allow update_engine sysfs_fs_ext4_features:dir r_dir_perms;
allow update_engine sysfs_fs_ext4_features:file r_file_perms;
allow update_engine self:capability { sys_resource };

View File

@ -1,4 +1,5 @@
on post-fs
exec - root -- /system/bin/vndk-detect
exec - root -- /system/bin/resize-system.sh
mount none /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml bind
export LD_CONFIG_FILE /system/etc/ld.config.${persist.sys.vndk}.txt