Reply
Thread Tools
Ammar Hamdan's Avatar
Posts: 34 | Thanked: 12 times | Joined on Apr 2012 @ Damascus/Syria
#1
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
Attached Files
File Type: zip miroroot.zip (766 Bytes, 117 views)
 
Posts: 617 | Thanked: 338 times | Joined on Mar 2011
#2
So what's the problem ?

1. That script deleted some system files ?
or
2. That script didn't delete all system files ?
__________________
N9 and N900 , the beauty and the beast
 
Ammar Hamdan's Avatar
Posts: 34 | Thanked: 12 times | Joined on Apr 2012 @ Damascus/Syria
#3
actually I think the script has deleted some unimportant system files & moved large files to this directory :

Code:
home/user/miroroot/
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#4
@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.
 

The Following 8 Users Say Thank You to reinob For This Useful Post:
sifo's Avatar
Posts: 1,359 | Thanked: 1,292 times | Joined on Oct 2011 @ Tartus.Syria
#5
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
Attached Images
 
__________________
[ N900-Crack ] [ The Purge ] [ New Smiles ] [ New icons ] [ ? ]
" Hey ! I've just met you and this is crazy, so install cssu maybe ? "
Please help out keeping Maemo.org alive, and consider donating.
https://www.facebook.com/ZoRk7

Last edited by sifo; 2012-10-13 at 16:06.
 

The Following User Says Thank You to sifo For This Useful Post:
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#6
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.
 

The Following 6 Users Say Thank You to reinob For This Useful Post:
Ammar Hamdan's Avatar
Posts: 34 | Thanked: 12 times | Joined on Apr 2012 @ Damascus/Syria
#7
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
 
Posts: 539 | Thanked: 518 times | Joined on May 2010 @ nanaurbusiness
#8
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.


__________________

N900 ~ $ make me a sandwich
-bash: no, make it yourself
N900 ~ $ sudo make me a sandwich
-bash: ok then...
 

The Following 3 Users Say Thank You to J4ZZ For This Useful Post:
Ammar Hamdan's Avatar
Posts: 34 | Thanked: 12 times | Joined on Apr 2012 @ Damascus/Syria
#9
@J4ZZ

I have a noob question :

how to delete created symlinks ??
 
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#10
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.
 

The Following 2 Users Say Thank You to pichlo For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 10:33.