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-21 17:35

Re: Multiple boot videos?
 
Hahahaha, indeed mate.

Schturman 2010-02-21 18:29

Re: Multiple boot videos?
 
b666m, you are king !!!
Thank you !!!

b666m 2010-02-21 18:51

Re: Multiple boot videos?
 
it's fascinating to see how such a project evolves :)

from:
Code:

#!/bin/bash

# determine number of files in /dconfs
cd /etc/hildon-welcome.d/dconfs/
nof=$(ls *.conf | wc -l)

# 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
rf="$rr.conf"
echo "$rr.conf"

# copy it over to default.conf
cp $rf ../default.conf

# exit
exit 0

to:
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"

    # copy it over to default.conf
    cp $rf ../default.conf
    touch $rb

  fi

end script

btw:
this is why i love the n900. try to run such a script on any other phone. it won't be that easy (if it's possible at all... ^^)

b666m 2010-02-21 21:41

Re: Multiple boot videos?
 
btw: i found something REALLY nerdy:

a hourglass random number generator ^^

take a look:
http://blog.makezine.com/archive/200...r_generat.html

rolan900d 2010-02-21 23:57

Re: Multiple boot videos?
 
Hahahaha, some guys have all the fun!

b666m 2010-02-22 04:10

Re: Multiple boot videos?
 
a summation in the end:

if you like having a single script and aren't afraid of using some xterm:
http://talk.maemo.org/showpost.php?p...5&postcount=35

if you want a gui and eyecandy:
http://talk.maemo.org/showpost.php?p...8&postcount=69

my work is done here. :p

rolan900d 2010-02-22 08:36

Re: Multiple boot videos?
 
You did good!


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

vBulletin® Version 3.8.8