|
|
2010-02-20
, 00:51
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#32
|
| The Following User Says Thank You to b666m For This Useful Post: | ||
|
|
2010-02-20
, 04:20
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#33
|
)
|
|
2010-02-20
, 05:39
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#34
|

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
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
| The Following User Says Thank You to b666m For This Useful Post: | ||
|
|
2010-02-20
, 05:53
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#35
|


|
|
2010-02-20
, 06:09
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#36
|
|
|
2010-02-20
, 12:28
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#37
|
|
|
2010-02-20
, 12:32
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#38
|
|
|
2010-02-20
, 12:33
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#39
|
|
|
2010-02-20
, 12:36
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#40
|
ONLY have ONE default.conf in /etc/hildon-welcome.d/
(delete all other defaultx.conf files!)
just let the x.conf files in /etc/hildon-welcome.d/dconfs/
to make it clear. it must look like:
/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.
QUESTION: ^^
#! /bin/sh # /etc/init.d/rvid # Carry out specific functions when asked to by the system case "$1" in start) 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 ;; stop) ;; *) ;; esac exit 0then doing:
Last edited by b666m; 2010-02-20 at 06:21.