View Single Post
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#26
script:
Code:
#!/bin/bash

cd /etc/hildon-welcome.d/dconfs/

if [ -f 1.conf ]; then

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

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

if [ $rna -ge $rnb ]; then
let "rn = $rna - $rnb"
else
let "rn = $rnb - $rna"
fi

# 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

fi

# exit
exit 0
(added check if "1.conf" exists. yes: run the script and exit 0. no: quit with exit 0.)
(edit: for some reason there was 5:1 chance of 2.conf to 1.conf... so i added some more randomness by creating two random numbers and substract the smaller number from the greater one.)
(edit2: i could add some lines which force the bootvideo to change. in the current version the default could be replaced by the same file and the bootvideo would still be the same. good idea? bad idea?!)

desktop:
Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=rvid
Exec=/bin/busybox sh -c 'echo sh /etc/hildon-welcome.d/rvid.sh | sudo gainroot'
Icon=terminal
#X-Window-Icon=
X-Window-Icon=     
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Last edited by b666m; 2010-02-20 at 00:01.
 

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