[Sony Xperia M4 Aqua] XyLoNaMiyX:
Install script rewrote for Linux

Hey everyone. I rewrote the script to root the phone for Linux (I converted the .bat to .sh). You need to copy all the adb files into the same directory with install.bat, just to make sure. Create a file called install.sh and paste the following:

#!/bin/bash

ADB=${PWD}/adb
echo

echo --- E23xx rootkit 2016/04/20 ---
echo;
echo waiting for device...
"$ADB" wait-for-device

DEVICENAME=$("$ADB" shell getprop ro.build.product)
echo DEVICENAME: $DEVICENAME

DEVICENAMEHEAD=${DEVICENAME:0:3}
if [ "$DEVICENAMEHEAD" != "E23" ]; then
echo;
echo Your device is not supported.
exit 1
fi

BUILDID=$("$ADB" shell getprop ro.build.id)
echo BUILDID: $BUILDID

"$ADB" push ./files/getroot /data/local/tmp/
"$ADB" push ./files/su /data/local/tmp/
"$ADB" push ./files/supolicy /data/local/tmp/
"$ADB" push ./files/libsupol.so /data/local/tmp/
"$ADB" push ./files/Superuser.apk /data/local/tmp/
"$ADB" push ./files/busybox /data/local/tmp/
"$ADB" push ./files/99SuperSUDaemon /data/local/tmp/
"$ADB" push ./files/install-recovery.sh /data/local/tmp/
"$ADB" push ./files/install_tool.sh /data/local/tmp/

"$ADB" shell "chmod 0755 /data/local/tmp/getroot"
"$ADB" shell "chmod 0755 /data/local/tmp/busybox"
"$ADB" shell "chmod 0755 /data/local/tmp/install_tool.sh"

echo;
echo getroot start.
"$ADB" shell "/data/local/tmp/getroot /data/local/tmp/install_tool.sh"

sleep 10

echo;
echo waiting for device...
"$ADB" wait-for-device
sleep 10
"$ADB" wait-for-device

echo;
echo removing temporary files...
"$ADB" shell "rm /data/local/tmp/getroot"
"$ADB" shell "rm /data/local/tmp/su"
"$ADB" shell "rm /data/local/tmp/supolicy"
"$ADB" shell "rm /data/local/tmp/libsupol.so"
"$ADB" shell "rm /data/local/tmp/Superuser.apk"
"$ADB" shell "rm /data/local/tmp/busybox"
"$ADB" shell "rm /data/local/tmp/99SuperSUDaemon"
"$ADB" shell "rm /data/local/tmp/install-recovery.sh"
"$ADB" shell "rm /data/local/tmp/install_tool.sh"

echo;
echo --- all finished ---

Nice job :) Thanks

Edit. I also added the TWRP script for Linux. Follow the same steps. This is it:

#!/bin/bash

ADB=${PWD}/adb

echo --- Xperia M4 Aqua lockedTWRP 0.1 ---
echo;
echo waiting for device...
"$ADB" wait-for-device

echo;
DEVICENAME=$("$ADB" shell getprop ro.build.product)
echo DEVICENAME: %DEVICENAME%
BUILDID=$("$ADB" shell getprop ro.build.id)
echo BUILDID: %BUILDID%

echo;
"$ADB" shell "mkdir /data/local/tmp/lockedtwrp"
"$ADB" shell "chmod 0755 /data/local/tmp/lockedtwrp"
"$ADB" push ./files/install_lockedtwrp.sh /data/local/tmp/lockedtwrp
"$ADB" push ./files/taimport.sh /data/local/tmp/lockedtwrp
"$ADB" push ./files/bootrecovery.sh /data/local/tmp/lockedtwrp
"$ADB" push ./files/ramdisk.cpio.gz /data/local/tmp/lockedtwrp
"$ADB" push ./files/busybox /data/local/tmp/lockedtwrp
"$ADB" push ./files/byeselinux.ko /data/local/tmp/lockedtwrp
"$ADB" push ./files/setdatefromhc /data/local/tmp/lockedtwrp
"$ADB" push ./files/version.txt /data/local/tmp/lockedtwrp

"$ADB" shell "chmod 0755 /data/local/tmp/lockedtwrp/install_lockedtwrp.sh"

echo;
"$ADB" shell "su -c /data/local/tmp/lockedtwrp/install_lockedtwrp.sh"

echo;
echo removing temporary files...
"$ADB" shell "rm -r /data/local/tmp/lockedtwrp"

echo;
echo --- install finished ---