-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit
More file actions
44 lines (37 loc) · 1019 Bytes
/
Copy pathinit
File metadata and controls
44 lines (37 loc) · 1019 Bytes
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
#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
#FAQ de la catedra
/bin/mount -t proc proc /proc
/bin/mount -o remount,rw /
/bin/mkdir -p /dev/pts /dev/shm
/bin/mount -a
/sbin/swapon -a
/bin/ln -sf /proc/self/fd /dev/fd
/bin/ln -sf /proc/self/fd/0 /dev/stdin
/bin/ln -sf /proc/self/fd/1 /dev/stdout
/bin/ln -sf /proc/self/fd/2 /dev/stderr
/bin/hostname -F /etc/hostname
# Levantar argumentos para montar el filesystem
for i in $(cat /proc/cmdline); do
case $i in
root=*)
DEVICE="${i#*=}"
;;
*)
shift
;;
esac
done
echo "---------------"
echo "DEVICE = ${DEVICE}"
echo "---------------"
mkdir -p /mnt/root
/bin/mount -t ext4 ${DEVICE} /mnt/root
mkdir -p /mnt/root/dev
/bin/mount --move /dev /mnt/root/dev # Si no está, switch_root no encuentra nada en `/dev`
exec switch_root /mnt/root /sbin/init "$@"
#exec /sbin/init "$@"