Avoid Icons Overwrite After Firmware Update

Discussion in 'Question & Answers' started by mttrss5, Dec 18, 2015.

  1. mttrss5

    mttrss5Members

    Sep 6, 2012
    11
    0
    11
    Male
    Student
    Italy
    Hi everyone, I've created some custom icons to overwrite Default theme icons (or missing ones).

    The problem is that every time I update the firmware, the theme icons are overwritten. How can I avoid this behavior?

    I put Every icon in the system/media/theme/mod_icons folder.

    Ty

    Sent from my MI NOTE LTE
     
  2. Saman

    SamanMembers

    Oct 7, 2015
    17
    0
    11
    Male
    this is my problem too
    i think we have to make a flashable zip for our icons. but i dont know how
     
  3. mttrss5

    mttrss5Members

    Sep 6, 2012
    11
    0
    11
    Male
    Student
    Italy
    Hold on, I'm writing a simple Shell script to move automatically the custom icons back to the theme folder and fix any icon file permission issue

    Sent from my MI NOTE LTE
     
  4. mttrss5

    mttrss5Members

    Sep 6, 2012
    11
    0
    11
    Male
    Student
    Italy
    Ok @Saman I've written this simple script to fix icons overwrite, just follow this steps:

    1. Make sure you've root access
    2. Make sure you're on the Default theme (I didn't test with others)
    3. Create a directory with custom icons in it (e.g. in /sdcard/miui_mod_icons)
    4. Save the following script into the root of /sdcard and name it themefixer.sh

    Code:
    #!/system/bin/sh
    mount -o rw,remount /system
    if [ $? == 0 ]
    then echo Mounted RW system
    else exit
    fi
    # copy all files to destination directory
    cd /
    cp -f $1/* /system/media/theme/miui_mod_icons
    if [ $? == 0 ]
    then echo Icons successfully moved to theme directory
    else
        echo Cannot move icons to destination. Restore RO system
        mount -o ro,remount /system
        exit
    fi
    # set correct permission to icons
    chmod 644 /system/media/theme/miui_mod_icons/*
    if [ $? == 0 ]
    then echo Setting 644 permissions
    else
        echo Set permission aborted. Restore RO system
        mount -o ro,remount /system
        exit
    fi
    # Mount RO system
    mount -o ro,remount /system
    if [ $? == 0 ]
    then echo Completed. Please reapply your theme
    else
        echo Error reverting RO system
        exit
    fi
    exit

    5. Open terminal emulator (or similar) and type the following

    Code:
    $ su
    $ sh /sdcard/themefixer.sh <path/to/custom_icons>
    NOTE:

    1. $ is the shell input, you don't have to copy it
    2. <path/to/custom_icons> according to previous instruction is something like /sdcard/miui_mod_icons (don't need to add slash at the end of che path)
    3. Every icon or file in the /sdcard/miui_mod_icons will be copied into theme's custom icons folder.
    4. You have to repeat only steps from 5 on and add new icons to /sdcard/miui_mod_icons folder
     

Share Our Site