-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
rcboot.sh
executable file
·40 lines (27 loc) · 890 Bytes
/
rcboot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
umask 0077
set -e
if [ "$1" != "stop" ]; then
# cleanup
# (delete /tmp etc)
rm -rf /tmp/* /tmp/.[!.]* /tmp/..?*
# empty utmp, create needed directories
: > /var/run/utmp
mkdir -m og-w /var/run/dbus
# Configure random number generator
if [ -e /var/state/random-seed ]; then
cat /var/state/random-seed > /dev/urandom;
fi
# Configure network
/sbin/ifconfig lo 127.0.0.1
# You can put other static configuration here:
#/sbin/ifconfig eth0 192.168.1.38 netmask 255.255.255.0 broadcast 192.168.1.255
echo "myhost" > /proc/sys/kernel/hostname
# /usr/sbin/alsactl restore
else
# The system is being shut down
# echo "Saving random number seed..."
POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
dd if=/dev/urandom of=/var/state/random-seed bs="$POOLSIZE" count=1 2> /dev/null
fi;