forked from tinycorelinux/Core-scripts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit
executable file
·45 lines (36 loc) · 1.19 KB
/
init
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
41
42
43
44
45
#!/bin/sh
mount proc
# Set the initial date
export $(cat /proc/cmdline | tr ' ' '\n' | grep "^jido_builddate=")
if [ ! -z ${jido_builddate-} ]; then
[ "$jido_builddate" -lt `/bin/date +%s` ] || /bin/date +%s -s @${jido_builddate}
fi
# Set the backup_device
export $(cat /proc/cmdline | tr ' ' '\n' | grep "^restore=")
echo "$restore" > /etc/sysconfig/backup_device
# Rename filetool wrapper
mv /usr/bin/filetool.sh /usr/bin/filetool_orig.sh
mv /usr/bin/filetool_wrapper.sh /usr/bin/filetool.sh
# Rename passwd wrapper
mv /usr/bin/passwd /usr/bin/passwd.orig
mv /usr/bin/passwd_wrapper.sh /usr/bin/passwd
# Increase ulimit globally
ulimit -Hn 10000
ulimit -Sn 10000
# Quiet the console kernel messages
sysctl -q -w kernel.printk="2 4 1 7"
grep -qw multivt /proc/cmdline && sed -i s/^#tty/tty/ /etc/inittab
if ! grep -qw noembed /proc/cmdline; then
inodes=`grep MemFree /proc/meminfo | awk '{print $2/3}' | cut -d. -f1`
mount / -o remount,size=90%,nr_inodes=$inodes
umount proc
exec /sbin/init
fi
umount proc
if mount -t tmpfs -o size=90% tmpfs /mnt; then
if tar -C / --exclude=mnt -cf - . | tar -C /mnt/ -xf - ; then
mkdir /mnt/mnt
exec /sbin/switch_root mnt /sbin/init
fi
fi
exec /sbin/init