Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Multiple boot videos?

    Reply
    Page 12 of 13 | Prev | 2   10     11   12   13   | Next
    b666m | # 111 | 2010-02-21, 07:32 | Report

    ehm... this line is ONLY for generating a RANDOM number (because $RANDOM doesn't seem to work).

    it makes a copy (dd) of /dev/urandom but only of the first block (count 1) and deletes the rest (2> /dev/null).
    because urandom doesn't only consists of numbers - but we want a number/integer - you have to change this using the checksum (cksum).
    but this checksum is way too long so we are cutting (cut) it off. (:

    i'm only searching for another way of getting randomness in my script on startup.
    i tried it with rn=$(date +%S) which saves only the seconds of the current timestamp in rn... but on startup date-command only counts up and doesn't show the actual time
    so i'm only getting 1 and 2... -.-

    i've been searching google for the last few hours... but i can't find anything useful...

    btw: i'm awake for over 40 hours... my eyes are bloody-red... so i'll go in my bed now ^^

    if somebody knows a solution for getting a random number at startup... please post

    good night. (:

    Edit | Forward | Quote | Quick Reply | Thanks

     
    tuminoid | # 112 | 2010-02-21, 07:44 | Report

    Originally Posted by b666m View Post
    i tried to launch the script on shutdown with "start on shutdown" but this doesn't work.
    I think it should be
    Code:
    start on starting shutdown
    as you can see from other event.d scripts:
    Code:
    grep shutdown /etc/event.d/*

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to tuminoid For This Useful Post:
    b666m, rolan900d

     
    rolan900d | # 113 | 2010-02-21, 10:49 | Report

    Editing the first line in rvid to :

    "start on starting shutdown"

    made it run 3 diff. for now....

    I have to go but try one more...
    Look all right to me now!

    Loop went like this:

    1

    2

    5

    1

    2

    5



    Only 3 loops now

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by rolan900d; 2010-02-21 at 11:06.

     
    b666m | # 114 | 2010-02-21, 16:19 | Report

    as far as i understand /dev/urandom gets seeded with noise from drivers during operations from the user.
    so if you just startup and shutdown there are very small chances that there are any differences.

    unfortunately i don't know when the entropy pool gets seeded exactly. it could be when you open any app. but it could be that it's only seeded when special things happen.

    so my suggestion would be a "longer" testing of this:
    1. edit /etc/event.d/rvid and change the line "start on startup" to "start on starting shutdown" and then do "chmod 777 /etc/event.d/rvid"
    2. but don't startup and then shutdown your phone immediatly.
    3. after startup maybe you want to open different apps. for example: surf the web with browser and things you would also do normally.
    (hopefully by doing so the pool gets seeded)

    if this doesn't bring any improvements i could write some additional code which saves some blocks of on shutdown /dev/urandom to a file and then seeds /dev/urandom on startup first before doing my random number generation.
    (that would be a very freaky solution ^^)

    one other thing you can do when you have changed to "start on starting shutdown":
    open /etc/event.d/rvid and comment out the line "rn=$(dd ... )". make a new line right under this one and type "rn=$(date +%s)".
    Originally Posted by
    seconds since 00:00:00, Jan 1, 1970 (a GNU extension)
    Note that this value is defined by the localtime system
    call.
    ok... it's not 100% random but hey... chances are nearly equal for all of the x.conf to get loaded.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by b666m; 2010-02-21 at 16:32.

     
    b666m | # 115 | 2010-02-21, 16:41 | Report

    blubb... working... the bootvideo gets set on shutdown... here's the code:

    Code:
    start on starting shutdown
    
    script
    
      cd /etc/hildon-welcome.d/dconfs/
    
      if [ -f 1.conf ]; then
    
        # check which file is currently used
        if [ -f *.lock ]; then
          cuf=$(ls *.lock)
          ruf=$cuf
          rm *.lock
        else
          cuf="1.lock"
          ruf=$cuf
        fi
    
        # determine number of files in /dconfs
        nof=$(ls *.conf | wc -l)
    
        while [ "$ruf" = "$cuf" ]; do
    
          # get "random" number lol
          rn=$(date +%s)
    
          # in range of 1 - nof
          let "rr = $rn % $nof + 1"
    
          # choose random conf
          ruf="$rr.lock"
          rf="$rr.conf"
     
        done
     
        # set file for checking which file is in use
        rb="$rr.lock"
        echo "rb $rb - rf $rf"
    
        # copy it over to default.conf
        cp $rf ../default.conf
        touch $rb
    
      fi
    
    end script
    will update the instructions with a this new file. thanks for testing again!

    edit: instructions and attachment on page 4 updated.
    and i attached the file here too. (but you could also copy & paste the code from this post ^^)

    how it works:

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Images
     
    Attached Files
    File Type: zip rvid.zip (469 Bytes, 73 views)

    Last edited by b666m; 2010-02-21 at 16:59.

     
    rolan900d | # 116 | 2010-02-21, 16:42 | Report

    It did indeed.
    I forgot to chmod 777 the file

    All is good over here...

    Thanx 2 Tuminoid as well

    Buddy. where you have updated it?

    On page 4 it is stated that the last update was done yesterday

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by rolan900d; 2010-02-21 at 16:45.

     
    b666m | # 117 | 2010-02-21, 16:45 | Report

    i would take "rn=$(date +%s)" instead of random number generation out of /dev/urandom.

    we just need something which is different every time we look at it and it don't have to be something for strong cryptography. (:

    Edit | Forward | Quote | Quick Reply | Thanks

     
    b666m | # 118 | 2010-02-21, 16:53 | Report

    Originally Posted by rolan900d View Post
    Buddy. where you have updated it?

    On page 4 it is stated that the last update was done yesterday
    the attachment of page 4 is updated now.
    but i posted the code above.
    so you could just make a new file and copy & paste it. *G*

    edit:
    sorry... but i have to say it... /dev/urandom is a b*tch !!! ^^

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by b666m; 2010-02-21 at 16:57.
    The Following User Says Thank You to b666m For This Useful Post:
    rolan900d

     
    rolan900d | # 119 | 2010-02-21, 17:06 | Report

    Got it!

    Cheers

    Edit | Forward | Quote | Quick Reply | Thanks

     
    b666m | # 120 | 2010-02-21, 17:08 | Report

    wow... that was really tricky... but like hatebreed would shout it:

    a lesson lived is a lesson learned

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 12 of 13 | Prev | 2   10     11   12   13   | Next
vBulletin® Version 3.8.8
Normal Logout