I modified update-binary script from SuperSU v2.82 update ZIP to work on Linux. This script mount system.img image and placing all needed files from SuperSU update ZIP. This script can work on system.img of Android version up to 6.0. I tested it on system.img of Android versions 4.0.3, 4.4.2, 5.1. I am run it on Ubuntu 14.04, other Linux versions should be OK. All you need is usual Linux tools and unzip.
Also this script deleting /system/recovery-from-boot.p - this file restoring original recovery in some firmwares.
makeroot.sh system.img UpdateSuperSU.zip
- system.img Should be in ext4 file system format.
system.img may be in another file system format that linux "mount" cmd can mount
- UpdateSuperSU.zip - TWRP / CWM / FlashFire installable SuperSU ZIP
- MUST be run by root user, f.e:
sudo makeroot.sh system.img UpdateSuperSU.zip
Look at makeroot-0.1.sh.zip in attachment.