Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

Addon.d script for Xposed to survive CM13 dirtyFlashes!! thnx to @adlx.xda

472 posts
Thanks Meter: 231
 
Post Reply Email Thread
14th February 2016, 08:32 PM |#21  
Senior Member
Thanks Meter: 322
 
More
Quote:
Originally Posted by X-Lucky-Messi-X

Where' s the script?

It's attached to OP, opening post / oroginal post
The Following User Says Thank You to piskor For This Useful Post: [ View ] Gift piskor Ad-Free
 
 
14th February 2016, 08:59 PM |#22  
X-Lucky-Messi-X's Avatar
Member
Thanks Meter: 3
 
More
Quote:
Originally Posted by piskor

It's attached to OP, opening post / oroginal post

What? Where?

---------- Post added at 07:59 PM ---------- Previous post was at 07:38 PM ----------

Quote:
Originally Posted by objr

/system/addon.d/ is a folder in CM ROMs where the user (and sometimes apps) can put scripts that will be run when you flash a new version of the ROM.

Tipically those scripts are used to backup system apps, and their files, so that they can survive a format and reFlash.

For example, this is how you would keep SuperSU (root), Avast Agent,...

I made the script below so that @rovo89's Xposed for Marshmallow will survive (that is keep it installed) when I flash a new CM13 nightly.

Tested on my phone #MotoG #Falcon (32bits), just flashed latest CM13 nightly, wiped cache and dalvik-cache and the phone rebooted fine (and Xposed was still working). Tested on latest TWRP might not work with other recovery.

Warning: It's for Xposed for Marsshmallow only. It work as of today. It might not work later with new future versions of Xposed. Also not sure it would work for 64bits.

If you use superSu or you have root permitions, you can put this file under "/system/addon.d" and give it the right permitions as the other files in the folder:
81-Xposed.sh

Or just flash the zip attached!!

Haven't tested it on 64bit but It should work, please try and report back!!

this was possible thanks to @adlx.xda so just go over his thread and grab him a beer!! Thank him as well!!

👍👍Thank me if you appreciate👍👍

I think I don' t have that folder. But I flashed the .zip file. Does that mean that I can now flash a new CM 13 nightly and xposed will still be installed?
14th February 2016, 09:23 PM |#23  
Senior Member
Thanks Meter: 322
 
More
Quote:
Originally Posted by X-Lucky-Messi-X

What? Where?[COLOR="Silver"]

Script you are looking for.
In OP, opening post / original post / first post of thread
14th February 2016, 09:28 PM |#24  
X-Lucky-Messi-X's Avatar
Member
Thanks Meter: 3
 
More
Quote:
Originally Posted by piskor

Script you are looking for.
In OP, opening post / original post / first post of thread

I mean, I looked in the orginal post, the only attachment is the .zip file. That' s why I' m asking where cause I can' t find it in this thread.
14th February 2016, 09:56 PM |#25  
Senior Member
Thanks Meter: 322
 
More
Quote:
Originally Posted by X-Lucky-Messi-X

I mean, I looked in the orginal post, the only attachment is the .zip file. That' s why I' m asking where cause I can' t find it in this thread.

You didn't read OP carefully
Quote:

If you use superSu or you have root permitions, you can put this file under "/system/addon.d" and give it the right permitions as the other files in the folder:
81-Xposed.sh

Or just flash the zip attached!!

The Following 3 Users Say Thank You to piskor For This Useful Post: [ View ] Gift piskor Ad-Free
16th March 2016, 09:24 AM |#26  
Dead-neM's Avatar
Senior Member
Flag France
Thanks Meter: 579
 
Donate to Me
More
Quote:
Originally Posted by maxfame

Thanks you!
Can you make a script to survive SuperSU and ViperFX too? After every nightly I (and probably many other peoples) must flash it again.

ViperFX survive flashing update... During installation it put a script in addon.d

SuperSU can't survive a flashing update because it reinstall the boot.img and SuperSU need to patch it... So just use the queue flashing zip in TWRP to flash cm-supersu-customkernel
24th March 2016, 05:33 PM |#27  
Senior Member
Flag Bogotá D.C.
Thanks Meter: 70
 
More
Thanks.
I can report that this works fine in a Zenfone 2 Laser (x64bits) with CM13.
The Following User Says Thank You to pedrazadixon For This Useful Post: [ View ] Gift pedrazadixon Ad-Free
19th April 2016, 06:10 PM |#28  
Senior Member
Thanks Meter: 40
 
More
This does not appear to work with an encrypted data partition that doesn't get mounted. on the g3. twrp is unable to mount the data partition once it is encrypted.
this is a twrp issue not your script.
cache mounts fine. does it get wiped in a dirty flash or just dalvik cache
sd card mounts just fine and is not encrypted. i know its not wiped


I am not sure what line needs to change to change the backup destination
i think here is a hint. i need to pass C to the function backup_file
maybe i just need to redefine C and export the value so it public to the exisitng function
ore replace backup_file wiht an alternate backup_file2 function that will accept the destination


http://forum.xda-developers.com/gala...posed-t2756909
Code:
#
# Functions for backuptool.sh
#

export C=/tmp/backup
export S=/system
export V=what you want

backup_file() {
  if [ -e "$1" ]; then
    local F=`basename "$1"`
    local D=`dirname "$1"`
    # dont backup any apps that have odex files, they are useless
    if ( echo "$F" | grep -q "\.apk$" ) && [ -e `echo "$1" | sed -e 's/\.apk$/\.odex/'` ]; then
      echo "Skipping odexed apk $1";
    else
      mkdir -p "$C/$D"
      cp -p $1 "$C/$D/$F"
    fi
  fi
}

restore_file() {
  local FILE=`basename "$1"`
  local DIR=`dirname "$1"`
  if [ -e "$C/$DIR/$FILE" ]; then
    if [ ! -d "$DIR" ]; then
      mkdir -p "$DIR";
    fi
    cp -p "$C/$DIR/$FILE" "$1";
    if [ -n "$2" ]; then
      echo "Deleting obsolete file $2"
      rm "$2";
    fi
  fi
}

the gapps script does this if it needs more space. if i can’t mount data it must be the same as not having space in the blue text
so it may be as simple as if the blue text returns 0 ( or fails) then change C ( red text)
clearly the size of exposed is almost always the same size so there would be no need to get that size.

Code:
# Backup/Restore using /sdcard if the installed GApps size plus a buffer for other addon.d backups (204800=200MB) is larger than /tmp
installed_gapps_size_kb=$(grep "^installed_gapps_size_kb" /tmp/gapps.prop | cut -d= -f2)
if [ ! "$installed_gapps_size_kb" ]; then
  installed_gapps_size_kb=$(cd /system; du -ak $(list_files) | awk '{ i+=$1 } END { print i }')
  echo "installed_gapps_size_kb=$installed_gapps_size_kb" >> /tmp/gapps.prop
fi

free_tmp_size_kb=$(grep "^free_tmp_size_kb" /tmp/gapps.prop | cut -d= -f2)
if [ ! "$free_tmp_size_kb" ]; then
  free_tmp_size_kb=$(df -k /tmp | tail -n 1 | awk '{ print $4 }')
  echo "free_tmp_size_kb=$free_tmp_size_kb" >> /tmp/gapps.prop
fi

buffer_size_kb=204800
if [ $((installed_gapps_size_kb + buffer_size_kb)) -ge "$free_tmp_size_kb" ]; then
  C=/sdcard/tmp-gapps
fi

like this
Code:
free_tmp_size_kb=$(df -k /tmp | tail -n 1 | awk '{ print $4 }')
buffer_size_kb=204800
if [ $( buffer_size_kb) -ge "$free_tmp_size_kb" ]; then
  C=/sdcard/tmp-xposed
fi
ill let you know if it works
19th April 2016, 07:33 PM |#29  
Senior Member
Thanks Meter: 40
 
More
Quote:
Originally Posted by dcooterfrog

This does not appear to work with an encrypted data partition that doesn't get mounted. on the g3. twrp is unable to mount the data partition once it is encrypted.
this is a twrp issue not your script.
sd card mounts just fine and is not encrypted. i know its not wiped

Code:
free_tmp_size_kb=$(df -k /tmp | tail -n 1 | awk '{ print $4 }')
buffer_size_kb=5000
if [ $( buffer_size_kb) -ge "$free_tmp_size_kb" ]; then
  C=/sdcard/tmp-xposed
fi
ill let you know if it works

I added this to the script and it works perfectly buffer_size_kb=204800 (from gapps) is probably the wrong number for xposed, too big so i use 5000, my xposed flashable is 4,741k
this is only for 32 bit.. if someone cool would add the 64 bit it would be great.
then if a super rockstar could get it added to the official flashable zips for xposed...
27th April 2016, 06:14 AM |#30  
Senior Member
Flag Bangalore
Thanks Meter: 23
 
More
Can we install this zip file after installing the latest xposed v83..
13th May 2016, 11:24 AM |#31  
sunny1234590's Avatar
Senior Member
Flag Greater Noida
Thanks Meter: 670
 
More
Quote:
Originally Posted by karthikkh20

Can we install this zip file after installing the latest xposed v83..

Even I have the same questions. Has anyone tried it yet?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes