Created
September 1, 2018 10:56
-
-
Save stawidy/18afe2c9dd57aa149f24140486f353c0 to your computer and use it in GitHub Desktop.
Fix Xiaomi.eu MIUI10 (based on Nougat) FEB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/sh | |
tmp=/tmp/eufix-force-fbe | |
if [ "$3" ]; then | |
zip=$3 | |
console=/proc/$$/fd/$2 | |
# write the location of the console buffer to /tmp/console for other scripts to use | |
echo "$console" > /tmp/console | |
else | |
console=$(cat /tmp/console) | |
[ "$console" ] || console=/proc/$$/fd/1 | |
fi | |
print() { | |
if [ "$1" ]; then | |
echo "ui_print $1" > "$console" | |
else | |
echo "ui_print " > "$console" | |
fi | |
echo | |
} | |
abort() { | |
[ "$1" ] && { | |
print "Error: $1" | |
print "Aborting..." | |
} | |
cleanup | |
print "Failed to install xiaomi.eu rom fix!" | |
exit 1 | |
} | |
cleanup() { | |
[ "$zip" ] && rm /tmp/console | |
[ -d "$tmp" ] && rm -rf "$tmp" | |
} | |
setperm() { | |
find "$3" -type d -exec chmod "$1" {} \; | |
find "$3" -type f -exec chmod "$2" {} \; | |
} | |
force_encrypt_nougat() { | |
fstab=/fstab.qcom | |
if ! [ -f "$fstab" ]; then | |
print "No fstab.qcom in vendor, skipping..." | |
else | |
sed -i " | |
s/\b\(encryptable\)=/fileencryption=/g | |
" "$fstab" | |
if ! grep -q '=ice,quota' "$fstab"; then | |
sed -i "s/=footer/=ice,quota/g" "$fstab" | |
fi | |
echo "Enabled force encryption for /data" | |
fi | |
} | |
print "*******************************" | |
print "* MIUI 9/10 xiaomi.eu Rom Fix *" | |
print "* Force Encryption Workaround *" | |
print "*******************************" | |
print "by @Stawidy" | |
print "Mounting filesystems..." | |
mount /system | |
if mount | grep ro | grep -q /system; then | |
mount -o remount,rw /system || print "Failed to mount read-write!" | |
print 'Remount as read-write...' | |
fi | |
print "Enabling force encryption for Nougat..." | |
force_encrypt_nougat | |
umount /system | |
cleanup | |
print "Finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment