[FYT Android Head Units] surfer63:
The lsec_updatesh folder and lsec.sh script

Copied from [URL="https://4pda.ru/forum/index.php?showtopic=936715&st=6120#entry89504996]4pda[/URL] and further extended.

Note: This is something I have never seen in a Joying firmware. I only saw it in a Zhan firmware where a different fyt.prop was used for DSP/DSP-less units.

1) Create the lsec_updatesh folder in the root of the USB-stick.

2) We put in this folder the lsec.sh file, which is a linux shell script (Note: UTF-8 with unix LF line terminators. Not a Windows ISO-8859 or ASCII text file with CRLF line terminators).

3) Copy lsec6521update file in the root of the USB-stick.

Result: at the end of the flashing, the lsec.sh script will be executed. Then the unit will be rebooted.

Notes:

the script is executed with root-rights, the command is issued from the root of the file system ( /);

the PATH variable is set like this: /sbin:/system/bin:/vendor/bin

during the execution of the script, the path to the root of the flash drive is treated as /storage/sdcard1.

before running the script, the main file systems are mounted "read-write" to their regular folders ( /cache, /system, /data, /vendor, /oem, /lsecfs ), so you do not need to write additional mount commands update: It is necessary to mount /system read-write, so as of now I simply remount the file system I need to write to.

in the header of the script you need to specify the interpreter - #!/system/bin/sh (this is the so-called shebang)

setting variables is not supported.

pseudo-variables (for example, $(pwd) , $(mount) , etc.) are supported;

The script can be run only with the lsec6521update, or combined with the main or partial firmware (6521_1.zip, Allapp.pkg). When used combined with 6521_1.zip and/or Allapp.pkg, it will run completely at the end.

Practical applications:

Making patches, an alternative to creating the Allapp.pkg package.

Work on all folders in the unit (which Allapp.pkg cannot do).

Delete unnecessary files or applications (who uses the calculator app?), or overwite files like the fyt.prop or others.

Modify/overwrite config files that are otherwise not modifiable (like bluetooth config?)

Setting properties that normally require root/admin rights.

Creating backups of your partitions using the dd command. This can be handy on a device for which you do not have a firmware yet as backup.

Make a Custom ROM by simply doing all kind of modifications after the "normal" firmware flash.

An example of a script that implements the replacement of the Settings.apk application with an analogue that originally lies in the app folder on a USB flash drive and has a file name different from the original:

#!/system/bin/sh
#
rm -rf /oem/priv-app/Settings
rm -f /data/dalvik-cache/x86_64/oem@priv-app@Settings@Settings.apk@classes.*
mkdir -p /oem/app/NewSettings
cp -rf /storage/sdcard1/app/NewSettings.apk/oem/priv-app/NewSettings/
chown -R 0.0 /oem/priv-app/NewSettings/NewSettings.apk
chmod 0755 /oem/priv -app/NewSettings
chmod 0644 /oem/priv-app/NewSettings/NewSettings.apk

An example of a script that makes a "raw" backup of the boot image and the recovery image to your USB-stick

#!/system/bin/sh
#
dd if=/dev/block/mmcblk0p25 of=/storage/sdcard1/boot.img
dd if=/dev/block/mmcblk0p3 of=/storage/sdcard1/recovery.img

Some pre-build flashable images

(for some reason I can't add these as links. Maybe later. For the time being as attachments)

backup_boot_recovery.zip : Make a "raw" backup of your boot and recovery image

getinfo.zip : Get some deep level info on partitions, file systems, mount points, etc.

expand_hosts_file_20200506.zip : This will copy a "very big" hosts file (367 kb) onto your system that will bock >99% of the ads.

remove_launchers_apps.zip : Removes unnecessary launchers and apps and only leaves launcher3 on your system. This is my personal choice! Check the lsec.sh file yourself in case you want to remove apps from it.

system_backup.zip : This will make a backup of the required partitions in case you do not have a firmware yet for your device. As it makes "raw" backups in total of 2.9GB, you need at least a 4GB flash device. Note: the backup works. The restore, requiring another script, is completely untested! Next to that: It still needs a working u-boot and recovery partition.

Rooting_FYT_sc9853i.zip : This is an alternative way of rooting your FYT SC9853i unit (credits for the script and the readme go to [MENTION=8637033]tchleb[/MENTION] !)

Ringtone.zip : Flash an alternative ringtone to your unit. Create it and name it blink_ring.mp3. Copy it into the lsec_updatesh folder on your USB-stick.

To be updated! I am still examining this.