View Single Post
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#34
first things first ^^

new script which will check the currently used video so that it's always another video on bootup

(ok... if you run it for the first time it may be not changing the video because my check-file doesn't exist in this moment but it will be created then ^^)

Code:
blablabla... same as in the code under this code.. blablabla

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

    blablabla... the same again... blablabla
EDIT: i kicked the /dev/urandom number generation because the entropy pool is sparely seeded. so i'll use the seconds since 00:00:00, Jan 1, 1970 ^^

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
how it works:
Attached Images
 

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

The Following User Says Thank You to b666m For This Useful Post: