View Single Post
Old 04-23-2012, 05:40 PM   #41
mSSM
Connoisseur? Addict!
mSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with othersmSSM plays well with others
 
Posts: 136
Karma: 2720
Join Date: Aug 2010
Location: Germany
Device: Onyx M92
Quote:
Originally Posted by kodomo View Post
Hrm - basically got things working, now... but adding the scripts to startup is troublesome: both adding it to appstart.sh and rc.config resulted in boot freezes which had to be solved by reflashing... did anyone successfully added stuff to the boot sequence?

Another thing I stumbled upon has me a little worried... looking at watchdog.sh, I see a check for free space on /root:
Code:
        remain_cap=`df | grep mmcblk0p2 | awk '{print $4}'`
        if [ $remain_cap -ge 1024 ]; then
        ...
...and an action to take, if internal memory's full:

Code:
root_files="web_browser.db notes_template notes"
    for i in $root_files
    do  
    ...
        rm -rf /root/$i
...They really intend to delete the user's notes to free up space!?!

Update: ok... so root is not 'the' internal memory... but then again, I think that /root is not the safe place to put the notes
Apart from the fact that they don't seem to have a clue how to use the Linux file system - the coding style is horrible.

a) Why would you 'grep' the output of 'df' when you can just pass it the path to the file system directly?
b) Why would you _still_ use backticks for command substitution? That is just terrible, terrible style! Somebody tell them to use $() instead.
c) How can you not quote your variables?
d) Why would you loop over, essentially, a string, if you could (should!) use an array?? That is simply retarded.
e) Why would you use an old test [ if there is the simpler [[ ? (Okay, this one is not a biggy...)

Except for e), all of the above are really bad mistakes. Is somebody honestly earning money writing that crap?
mSSM is offline   Reply With Quote