From 9ad30869b86dd827fbbf56a67122d662a51514f5 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Mon, 12 Oct 2020 09:28:37 -0400 Subject: xduoox3ii/x20: Work around a nasty OF interaction bug ...that can result in your sd card getting wiped at startup Change-Id: I19fc9836b321adbb1df3fc741bc2593965c624f6 --- tools/hiby_patcher.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/hiby_patcher.pl b/tools/hiby_patcher.pl index 86b8ad3d3f..af98cfdafc 100755 --- a/tools/hiby_patcher.pl +++ b/tools/hiby_patcher.pl @@ -140,7 +140,7 @@ print FILE $bootloader_sh; close FILE; chmod 0755, "$rootfsdir/usr/bin/hiby_player.sh"; -# Auto mount/unmount external USB drives +# Auto mount/unmount external USB drives and SD card open FILE, ">>$rootfsdir/etc/mdev.conf" || die ("can't access mdev conf!"); print FILE "sd[a-z][0-9]+ 0:0 664 @ /etc/rb_inserting.sh\n"; print FILE "mmcblk[0-9]p[0-9] 0:0 664 @ /etc/rb_inserting.sh\n"; @@ -154,16 +154,16 @@ my $insert_sh = ' # $MDEV is the device case $MDEV in - mmc*) + mmc*) MNT_POINT=/mnt/sd_0 ;; - sd*) + sd*) MNT_POINT=/mnt/sd_0/USB ;; esac if [ ! -d $MNT_POINT ];then - mkdir $MNT_POINT + mkdir $MNT_POINT fi mount $MDEV $MNT_POINT @@ -186,6 +186,9 @@ print FILE $remove_sh; close FILE; chmod 0755, "$rootfsdir/etc/rb_removing.sh"; +# Deal with a nasty race condition in automount scripts +system("perl -pni -e 's/rm -rf/#rm -Rf/;' $rootfsdir/etc/init.d/S50sys_server"); + # Copy bootloader over @sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename"); system(@sysargs); -- cgit v1.2.3