Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    miroroot.sh a script to clear rootfs has ruined my phone !! :(

    Reply
    Page 1 of 3 | 1   2     3   | Next
    Ammar Hamdan | # 1 | 2012-10-13, 09:16 | Report

    I found this ((((sh)))) script on a website, has codded to clear rootfs, but after using it ... I've noticed some widgets were disappeared .. and there are many bugs !!!

    ps: this script made a folder called miroroot in this directory & contains two folders (var,usr) :

    home/user/miroroot/


    so what should I do to solve this problem

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: zip miroroot.zip (766 Bytes, 120 views)

     
    Dragoss91 | # 2 | 2012-10-13, 09:43 | Report

    So what's the problem ?

    1. That script deleted some system files ?
    or
    2. That script didn't delete all system files ?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Ammar Hamdan | # 3 | 2012-10-13, 10:07 | Report

    actually I think the script has deleted some unimportant system files & moved large files to this directory :

    Code:
    home/user/miroroot/

    Edit | Forward | Quote | Quick Reply | Thanks

     
    reinob | # 4 | 2012-10-13, 13:52 | Report

    @Ammar Hamdan,

    You can either undo what the script has done (can be hard, but it is doable) OR completely reflash.

    In view of your willingness to execute some script you found somewhere, I'd recommend the latter.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 8 Users Say Thank You to reinob For This Useful Post:
    ajack, anthonie, don_falcone, misterc, mr_pingu, nkirk, peterleinchen, sifo

     
    sifo | # 5 | 2012-10-13, 16:03 | Report

    This script edited by Amr.fayz you can find him here in Meecolay thread, anyway this is his script :
    Code:
    #!/bin/sh
    # Miroroot script to safely free space on rootfs
    # by Amr.fayz
    
    if test "`id -u`" -ne 0; then
        echo "Error: This script must be run as root!"
        echo "Please make sure that the package rootsh from extras is installed"
        echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
        exit 1
    fi
    
    echo rootfs before:
    df -h /
    chmod +x /home/Miroroot
    chmod 775 /home/Miroroot
    # move root stuff to /home/Miroroot
    dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/share/microb-engine usr/share/tutorial-applet usr/share/cherry usr/local/lib /usr/include usr/lib/locale usr/lib/microb-engine usr/lib/skyhost /usr/lib/browser/plugins usr/lib/pyshared/python2.5 usr/lib/python2.5/site-packages usr/lib/qt4/imports usr/lib/qt4/plugins usr/lib/debug/usr var/lib/dpkg var/lib/apt"
    #optional: usr/share/themes  var/lib/dpkg
    if test -d /home/var/cache/apt; then
      # keep existing apt cache
      rm -rf /var/cache/apt
      ln -s /home/var/cache/apt /var/cache/apt
    else
      dirs="$dirs var/cache/apt"
    fi
    (cd / && du -sc $dirs)
    for d in $dirs; do
        test -L /$d && continue
        echo moving /$d
        rm -rf /home/Miroroot/$d
        mkdir -p /home/Miroroot/$d
        cp -a /$d /home/Miroroot/$d/..
        mv /$d /$d.old
        ln -s /home/Miroroot/$d /$d
        rm -rf /$d.old
    done
    sync
    echo "success"
    echo "rootfs after (after a reboot the actual free space will be shown):"
    df -h /
    And here is the original copy of the script and i safely used it before (copyrights belongs to Thomas Tanner )
    Code:
    #!/bin/sh
    # N900 script to safely free space on rootfs
    # (c) 2010 by Thomas Tanner <maemo@tannerlab.com>
    # licensed under GPLv3
    # version 0.5 (16. May 2010)
    
    if test "`id -u`" -ne 0; then
        echo "Error: This script must be run as root!"
        echo "Please make sure that the package rootsh from extras is installed"
        echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
        exit 1
    fi
    
    echo rootfs before:
    df -h /
    # move root stuff to /home
    dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/lib/locale var/lib/apt"
    #optional: usr/share/themes  var/lib/dpkg
    if test -d /home/var/cache/apt; then
      # keep existing apt cache
      rm -rf /var/cache/apt
      ln -s /home/var/cache/apt /var/cache/apt
    else
      dirs="$dirs var/cache/apt"
    fi
    (cd / && du -sc $dirs)
    for d in $dirs; do
        test -L /$d && continue
        echo moving /$d
        rm -rf /home/$d
        mkdir -p /home/$d
        cp -a /$d /home/$d/..
        mv /$d /$d.old
        ln -s /home/$d /$d
        rm -rf /$d.old
    done
    sync
    echo "success"
    echo "rootfs after (after a reboot the actual free space will be shown):"
    df -h /
    #!/bin/sh
    # N900 script to safely free space on rootfs
    # (c) 2010 by Thomas Tanner <maemo@tannerlab.com>
    # licensed under GPLv3
    # version 0.5 (16. May 2010)
    
    if test "`id -u`" -ne 0; then
        echo "Error: This script must be run as root!"
        echo "Please make sure that the package rootsh from extras is installed"
        echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
        exit 1
    fi
    
    echo rootfs before:
    df -h /
    # move root stuff to /home
    dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/lib/locale var/lib/apt"
    #optional: usr/share/themes  var/lib/dpkg
    if test -d /home/var/cache/apt; then
      # keep existing apt cache
      rm -rf /var/cache/apt
      ln -s /home/var/cache/apt /var/cache/apt
    else
      dirs="$dirs var/cache/apt"
    fi
    (cd / && du -sc $dirs)
    for d in $dirs; do
        test -L /$d && continue
        echo moving /$d
        rm -rf /home/$d
        mkdir -p /home/$d
        cp -a /$d /home/$d/..
        mv /$d /$d.old
        ln -s /home/$d /$d
        rm -rf /$d.old
    done
    sync
    echo "success"
    echo "rootfs after (after a reboot the actual free space will be shown):"
    df -h /
    ?

    ./sifo

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Images
     

    Last edited by sifo; 2012-10-13 at 16:06.
    The Following User Says Thank You to sifo For This Useful Post:
    reinob

     
    reinob | # 6 | 2012-10-13, 16:55 | Report

    Originally Posted by sifo View Post
    This script edited by Amr.fayz you can find him here in Meecolay thread, anyway this is his script :
    The first script (the one by Amr.fayz) moves and symlinks a lot of directories that are not handled in the original script. That may be the cause of the problem.

    Plus, the "Miroroot" folder is not created at the beginning of the script but the first time mkdir -p is used.

    Nevertheless, the script does chmod +x and chmod 755 (which in itself makes me seriously doubt of the skills of this Amr.fayz) on that folder, before it is even created.

    Don't want to blame anybody without being 100% but looking at the script my first thought would be "HANDS OFF", and *I* can read and write shell scripts and know my way around Unix. An inexperienced user should think "HANDS OFF" before even looking at the script.

    Obviously the damage is reversible. By definition. But at least *I* will not do the hard work of reversing that. So either the original author of the script (Amr.fayz) comes to the rescue, or the OP does a complete reflash.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 6 Users Say Thank You to reinob For This Useful Post:
    Ammar Hamdan, anthonie, don_falcone, misiak, sifo, vi_

     
    Ammar Hamdan | # 7 | 2012-10-15, 15:04 | Report

    thank u all 4 replies ... I doubt the author is alive to come to rescue ... I think he knew his script has bugs & cant find a solution or he's working on a solution to fix the bugs & need some time ... so there is no way except flashing my phone

    Edit | Forward | Quote | Quick Reply | Thanks

     
    J4ZZ | # 8 | 2012-10-16, 06:59 | Report

    I would sort everything via WinSCP.
    Delete created symlinks and move all folders from home/user/miroroot/ (if it's actually present) back to /
    Like reinob said the original script uses /home/ as destination (which is a system folder and already present) but the customized script wants to put everything into home/user/miroroot/ but forgot to create this folder.



    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to J4ZZ For This Useful Post:
    Ammar Hamdan, mr_pingu, reinob

     
    Ammar Hamdan | # 9 | 2012-10-16, 12:35 | Report

    @J4ZZ

    I have a noob question :

    how to delete created symlinks ??

    Edit | Forward | Quote | Quick Reply | Thanks

     
    pichlo | # 10 | 2012-10-17, 11:56 | Report

    Originally Posted by Ammar Hamdan View Post
    how to delete created symlinks ??
    Symlinks are just like ordinary files, you delete them with rm.

    For example, your script did (amongst others)(expanded and simplified from parsing the script):

    Code:
    mv /usr/share/icons /home/Miroroot/usr/share/icons
    ln -s /home/Miroroot/usr/share/icons /usr/share/icons
    What that did was move usr/share/icons from root to /home/Miroroot and then replacing the original with a symlink to the new location. To reverse the change, you need to remove the symlink first and then move the folder back to the original location, like this:

    Code:
    rm /usr/share/icons
    mv /home/Miroroot/usr/share/icons /usr/share/icons
    Doing it for the rest of the moved folders is left as an exercise

    Do not be tempted to use rm -r though. That will delete not just the symlink but also recursively all the files and folders the symlink points to, thus screwing up your phone irreversibly with a reflash the only way back.

    Before embaring on any of this, I strongly suggest to check the folders actually exist under /home/Miroroot. Both J4ZZ and reinob have already warned you about that.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to pichlo For This Useful Post:
    Ammar Hamdan, reinob

     
    Page 1 of 3 | 1   2     3   | Next
vBulletin® Version 3.8.8
Normal Logout