Author Topic: How To Find Memory Occupied By Installed *.ipk  (Read 8457 times)

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
How To Find Memory Occupied By Installed *.ipk
« Reply #15 on: June 13, 2005, 01:20:40 pm »
Hi again. You made some good suggestions in you last post, thanks. Those and the output your 'ipkg-files file' made me realize what the problem might be. The version of ipkg that is used in OZ doesn't return directory names, just file names, whereas it seems the one in the sharp rom returns everything. And while directories & symlinks themselves do take up space, that's negligable compared to the files, so I've tweaked the script a bit to take this into account. As well, I discovered another potential problem depending on what directory you're in at the time the script is run, so I've fixed that too.

Try out the latest version & let me know how it goes. This copy won't spit out the debugging output, so if it still doesn't work (cross our fingers), uncomment the TESTING line & attach the output. thks
GROG!

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
How To Find Memory Occupied By Installed *.ipk
« Reply #16 on: June 13, 2005, 02:35:52 pm »
Hi grog,

Seems you attached the wrong script - there're no changes compared to previous one.

suruaZ
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
How To Find Memory Occupied By Installed *.ipk
« Reply #17 on: June 13, 2005, 03:47:59 pm »
oops. Here here's the new one.
GROG!

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
How To Find Memory Occupied By Installed *.ipk
« Reply #18 on: June 14, 2005, 07:33:31 am »
Unfortunately no luck  
 
Nearly the same debug output as before and failed on the same line:
/home/QtPalmtop/bin/ipkg-size: arith: syntax error: "TOTALSIZE+224"

224 is the first echo - size of /

suruaZ
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
How To Find Memory Occupied By Installed *.ipk
« Reply #19 on: June 14, 2005, 11:02:52 am »
Ok, I don't know what I may have been imbidding to much of yesterday, but I *still* gave you the wrong version of the script. Here's the right one. Give'er another go. haveAhappy
GROG!

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
How To Find Memory Occupied By Installed *.ipk
« Reply #20 on: June 15, 2005, 02:06:42 am »
No echos for a folders now but still for a links.
Unfortunately again it stopped on "TOTALSIZE=$((TOTALSIZE+$line))" line.
I believe something wrong with syntax here.

suruaZ
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
How To Find Memory Occupied By Installed *.ipk
« Reply #21 on: June 15, 2005, 11:03:07 am »
Quote
No echos for a folders now but still for a links.
Shouldn't be a problem. Like I said before, directories & links on a unix filesystem are still just special files that take up space, albeit a small amount compared to other 'regular' files.

Quote
Unfortunately again it stopped on "TOTALSIZE=$((TOTALSIZE+$line))" line.
I believe something wrong with syntax here.[div align=\"right\"][a href=\"index.php?act=findpost&pid=84296\"][{POST_SNAPBACK}][/a][/div]
The syntax is correct for all modern bourne- & korn-based shells I'm aware of, which includes the version of sh provided by busybox, but let's see. What's the exact output of these commands on your Z?

Code: [Select]
root@grond[~]# N=4
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 4
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 8
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 12
There's another way the math can be done, using a utility called bc. See if you can find a package that's installable on your Z (search elsi if necessary) & depending on your output of the above commands & that I'll make another mod & see if that'll make a difference.
GROG!

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
How To Find Memory Occupied By Installed *.ipk
« Reply #22 on: June 16, 2005, 07:22:19 am »
Quote
Shouldn't be a problem. Like I said before, directories & links on a unix filesystem are still just special files that take up space, albeit a small amount compared to other 'regular' files.

Yes I agree with you. I just thought this could be the cause of error.

Quote
The syntax is correct for all modern bourne- & korn-based shells I'm aware of, which includes the version of sh provided by busybox, but let's see. What's the exact output of these commands on your Z?

Code: [Select]
root@grond[~]# N=4
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 4
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 8
root@grond[~]# T=$((T+N))
root@grond[~]# echo $N $T
4 12

Here is the error!!!
If I typed this in my default shell (/bin/bash) I got the same output as you.
But if I first typed:
/usr/bin/env sh

and after switched to the shell environment typed:

$ N=4
$ T=$((T+N))

the error returned:

arith: syntax error: "T+N"

I dodn't know in which shell I went after "/usr/bin/env sh" but after I have changed in your script the first line to the "/bin/bash" everything start to work and I found that my file.ipkg has installed size 966kb  

Thank you grog for your time and the nice script  

suruaZ
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
How To Find Memory Occupied By Installed *.ipk
« Reply #23 on: June 16, 2005, 11:10:29 am »
Quote
Quote
What's the exact output of these commands on your Z?
Here is the error!!!
I dodn't know in which shell I went after "/usr/bin/env sh" but after I have changed in your script the first line to the "/bin/bash" everything start to work
kewl. I figured it wa a shell problem. The sharp rom must come with an older version of busybox that doesn't have emulation for integer math calculation. It's good that you had bash so you could figure that out.

FYI, you could have changed the '/usr/bin/env sh' to '/usr/bin/env bash' & it would have worked as well (that convention works even if bash wasn't installed under /usr/bin, as it searches your path. That's why I use it.).

Quote
Thank you grog for your time and the nice script  [div align=\"right\"][a href=\"index.php?act=findpost&pid=84498\"][{POST_SNAPBACK}][/a][/div]
I'm just glad that by working together we managed to finally figure it out.

Thanks for you help in improving my script .
havefun!!
GROG!