maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Design (https://talk.maemo.org/forumdisplay.php?f=46)
-   -   Multiple boot videos? (https://talk.maemo.org/showthread.php?t=43840)

rolan900d 2010-02-20 14:53

Re: Multiple boot videos?
 
Changed the default.conf to this:

[hildon-welcome]
filename=Hands-v32-h264.avi


Also didn't help

b666m 2010-02-20 14:55

Re: Multiple boot videos?
 
so i guess "N900_2.avi" isn't nokia hands, right?

so my script is working (:

check if rvide is in /etc/event.d -> it should be /etc/event.d/rvide

1. open xterm
2. type "sudo gainroot"
3. type "chmod 777 /usr/bin/rvid"
4. type "chmod 777 /etc/event.d/rvide"

then reboot and watch xD

rolan900d 2010-02-20 15:05

Re: Multiple boot videos?
 
Sorry, messed up on that default.conf

Did the last thing and rvide was in there

Did the chmod commands, rebooted several times but still only the Nokia hands

I am really sorry for spending your precious time...

I have had enough of it...

maybe I will try to reflash it and start from scrath,

That really long string from this site and thread:

http://tuxrunner.com/tech/optify-your-n900-boot-videos/

And this string I performed:

for i in /opt/bootvideos/*; do ln -s $i /usr/share/hildon-welcome/media/$(echo $i | awk ‘BEGIN { FS=”/” } ; { print $4 }’); done


Might messed it all up...

b666m 2010-02-20 15:08

Re: Multiple boot videos?
 
i will restore my folders to default again and then follow my instructions to see if everything is understandable and working. (:

rolan900d 2010-02-20 15:09

Re: Multiple boot videos?
 
You have as much patience like me...
Good thing, but without a wireless router is a pain!

b666m 2010-02-20 15:39

Re: Multiple boot videos?
 
don't know what's going wrong... o.O

i did it mostly like he does:
http://talk.maemo.org/showthread.php...t.d#post512874

maybe you could try "chmod a+x" instead of "chmod 777" although it should do the same.

you could also try to move the file from /usr/bin/rvid to /usr/local/bin/rvid and edit the "rvide" file. (you have to edit the path in this file)

i'll take some hours off... i'll continue trying different things the next few days... and hopefully there is a solution which works for everyone (:

rolan900d 2010-02-20 15:52

Re: Multiple boot videos?
 
I only got in this thread when I saw your solution...

But after I edited the rvide file for the rvid path, I saw something stated about a script...

I haven't got that script in here right?

wasn't it in the solution you posted are in another post somewhere...

That could be it then?

b666m 2010-02-20 16:05

Re: Multiple boot videos?
 
"script" and "end script" are only the tags which must be used in a file which is placed and executed in/by event.d ;)

maybe it would work by deleting rvid from /usr/bin/
and editing /etc/event.d/rvide to following:

Code:

start on startup

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
      rn=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

      # 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


rolan900d 2010-02-20 16:14

Re: Multiple boot videos?
 
But I never did put a script any where!!!!

b666m 2010-02-20 16:14

Re: Multiple boot videos?
 
THIS IS WORKING 100% :-D

YEAH BABY xD

i'll update my instructions and files here: ;)
http://talk.maemo.org/showpost.php?p...5&postcount=35

b666m 2010-02-20 16:15

Re: Multiple boot videos?
 
Quote:

Originally Posted by rolan900d (Post 538605)
But I never did put a script any where!!!!

omg ^^
"rvid" and "rvide" ARE scripts ;)
but just wait for my instruction-update :D

b666m 2010-02-20 16:20

Re: Multiple boot videos?
 
updated and working for me :)

-> http://talk.maemo.org/showpost.php?p...5&postcount=35 <-

feedback please ^^

does it work for you too? (:

rolan900d 2010-02-20 16:28

Re: Multiple boot videos?
 
I told you I was a noob but I am getting there....

Tried it with deletion of rvid and edit of rvide file.

Did the cp command and the 777 stuff...

Still only hands 4 me

rolan900d 2010-02-20 16:31

Re: Multiple boot videos?
 
Will start from scratch again from here!

http://talk.maemo.org/showpost.php?p...5&postcount=35

b666m 2010-02-20 16:36

Re: Multiple boot videos?
 
thanks for being patient and testing my rubbish *hahaha* :D

i'm off for the next few hours ;)

(edit: if it doesn't work with "chmod 777" then use "chmod a+x" and try again ^^)

rolan900d 2010-02-20 16:42

Re: Multiple boot videos?
 
We have lift off!

You did it mate!


That latest tweak worked 4 me!



Hallelujah!

rolan900d 2010-02-20 16:45

Re: Multiple boot videos?
 
Quote:

Originally Posted by b666m (Post 538624)
thanks for being patient and testing my rubbish *hahaha* :D

i'm off for the next few hours ;)

(edit: if it doesn't work with "chmod 777" then use "chmod a+x" and try again ^^)

Like i said above...

All good now!

Thanks for helping me!
This way you did a better job also!

b666m 2010-02-20 17:12

Re: Multiple boot videos?
 
hehe :)

good to have someone who reads the things i wrote and point on some smaller errors (:

hope you enjoy your random video each time you boot up your device ;D *hehe*

rolan900d 2010-02-20 17:17

Re: Multiple boot videos?
 
I do and all copied it over at maemo-freak (symbian-freak) and give credits...

I think it is better to create a new thread with just your last version.

This thread is a pain to go through now!

Thanks again

Now an app for this!

:rolleyes:

b666m 2010-02-20 17:34

Re: Multiple boot videos?
 
Quote:

Originally Posted by rolan900d (Post 538670)
This thread is a pain to go through now!

this is real development xD :p :D

Schturman 2010-02-20 17:40

Re: Multiple boot videos?
 
Quote:

Originally Posted by b666m (Post 537905)
and...
YEAH BABY!!! :D

got it replaced automatically... even before the video is loaded ^^ *hrhr*

instructions:

1. download the zip-file and place file "rvid" in ~/MyDocs/ranvid/ (for example)
2. open xterm
3. type "sudo gainroot"
4. type "cp MyDocs/ranvid/rvid /etc/event.d/"
5. type "chmod 777 /etc/event.d/rvid"

if you haven't done it yet:
8. type "mkdir /etc/hildon-welcome.d/dconfs"
9. place your default.conf files there BUT rename them in 1.conf, 2.conf, 3.conf and so on.

so the contents should be:
/etc/hildon-welcome.d/default.conf
and
/etc/hildon-welcome.d/dconfs/1.conf
/etc/hildon-welcome.d/dconfs/2.conf
/etc/hildon-welcome.d/dconfs/3.conf
... and so on.

ehm yeah... have fun ;)

edit: forgot to mention... this one is the code which will always replace the current bootvideo with any other bootvideo out of the x.conf files (:

Thanks !!
Something strange...
I use the winSCP. I put the rvid file to the /etc/event.d and reboot the phone 4 times !
It's work, but it's change only between 2 videos from 4 I have :(
Why ?

rolan900d 2010-02-20 19:08

Re: Multiple boot videos?
 
Better start from scratch as the rvid has been re-written

rolan900d 2010-02-20 19:34

Re: Multiple boot videos?
 
Well, I am checking as well and indeed from the 7 videos I have, only the ones that are called 1.conf and 2.conf are shuffled!
Others won't do it....

I guess I was overexicited to see something diff. than those hands all the time..


Checked 15 times....

Only loops 1 and 2.conf files...

Schturman 2010-02-20 19:50

Re: Multiple boot videos?
 
I get this :-)
Now it's play 3 videos from 4....
I check the dconfs folder and I found the file named 1.lock. I deleted this file and reboot again 4 times. Now it's play 3 videos from 4....
I check again the dconfs folder and I found the file named 4.lock... :cool:
I think, maybe I have put some simple video5 + 5.conf + 5.lock. Maybe this option lock the video number 5 and it's play only 4 videos :)
I'll try it's now...

Schturman 2010-02-20 20:30

Re: Multiple boot videos?
 
Does not work ...
It's lock file created automatically, all time I reboot the phone...
I see again only 2 videos :cool:

rolan900d 2010-02-20 20:32

Re: Multiple boot videos?
 
Must be a script issue...

Let's hope out German friend comes online soon...

Schturman 2010-02-20 20:49

Re: Multiple boot videos?
 
Yep.... If random video not work, maybe it's better change the script to loopble for play 1,2,3,4.... and again 1,2,3,4...

b666m 2010-02-21 04:16

Re: Multiple boot videos?
 
1 Attachment(s)
hey guys ;)

don't worry... the *.lock files are my way to check which default.conf is used at the moment... because i don't want to replace the file with the same file and _maybe_ get the same bootvideo over and over again.

i have tested my shellscript with 5 x.conf files.
you can see the output in the image i attached.
my script is doing what it is supposed to do.
maybe there is an issue with generating random numbers out of /dev/urandom on startup?!
http://en.wikipedia.org/wiki//dev/random

edit:
GOD DAMN IT!
my random number generating line only produces two different numbers. that's because /dev/urandom is based on drivers' noise and (that would be my explanation) gets flushed at power on. so the noise the drivers are producing is always the same at the same time. -.-

i need to find another way to get a random number :/
($RANDOM didn't work for me...)

b666m 2010-02-21 05:18

Re: Multiple boot videos?
 
any suggestions for generating a REAL random number on startup?

i tried to launch the script on shutdown with "start on shutdown" but this doesn't work.
edit: "start on runlevel 0" doesn't work too. :(
would be nice if there would be any chance of running the a script in event.d on shutdown.
especially if it depends on a good entropy pool like generating a random number out of /dev/urandom. ^^

if anyone is interested in why my script doesn't work properly on startup... take a look here:
http://linux.about.com/library/cmd/blcmdl4_urandom.htm :)

Schturman 2010-02-21 07:11

Re: Multiple boot videos?
 
Maybe we need write numbers of our videos here:

Code:

# get random number
      rn=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

to something:


Code:

# get random number
      rn=$(dd if=/dev/urandom count=1 7> /dev/null | cksum | cut -f1 -d" ")

7 - this is a number of videos your have ?

b666m 2010-02-21 07:32

Re: Multiple boot videos?
 
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. (:

tuminoid 2010-02-21 07:44

Re: Multiple boot videos?
 
Quote:

Originally Posted by b666m (Post 539305)
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/*

rolan900d 2010-02-21 10:49

Re: Multiple boot videos?
 
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

b666m 2010-02-21 16:19

Re: Multiple boot videos?
 
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)".
Quote:

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.

b666m 2010-02-21 16:41

Re: Multiple boot videos?
 
2 Attachment(s)
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:

rolan900d 2010-02-21 16:42

Re: Multiple boot videos?
 
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

b666m 2010-02-21 16:45

Re: Multiple boot videos?
 
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. (:

b666m 2010-02-21 16:53

Re: Multiple boot videos?
 
Quote:

Originally Posted by rolan900d (Post 539779)
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 !!! ^^

rolan900d 2010-02-21 17:06

Re: Multiple boot videos?
 
Got it!

Cheers

b666m 2010-02-21 17:08

Re: Multiple boot videos?
 
wow... that was really tricky... but like hatebreed would shout it:

a lesson lived is a lesson learned :p


All times are GMT. The time now is 21:22.

vBulletin® Version 3.8.8