summaryrefslogtreecommitdiff
path: root/i/pc104/initrd/conf/update_initrd.sh
blob: 4a76956b32b54ec45dc1c0c4ab9ac6dd452a12ca (plain)
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
#!/bin/sh
# The purpose of this script is to provide a system to update the PC104 in
# autonomous mode via the network.
# It is called by the linuxrc and should not be called by hand.

# PATH is not correctly set...
PATH=$PATH:/usr/sbin/
# Bring eth0 up
ifconfig eth0 up 
# Get the configuration of the network via dhcp
udhcpc -i eth0 -s /etc/udhcpc.script
# Wait here for a connection. I do not know if it is a feature or a bug, but
# when nc receive a connection, it is end here. Maybe it is because of the
# missing library (warmed by gcc at compiled time)
nc -l -p 1234

# Mount the real system
mount /mnt/localsys
# Pivot root to the new_root.
# XXX It is a good idea to pivot_root ? Chroot is better ?
cd /mnt/localsys
pivot_root . old_root
# FIXME: I do not sure this is the good solution... Why make a exec and a
# chroot ? I am not sure it is a good idea...
exec chroot . sh -c '/etc/init.d/mountvirtfs; /etc/init.d/ssh start;' \
<dev/console >dev/console 2>&1
# This part sux : what's about the old process ?
# Kill them ?
#umount /old_root
# We should call all the script
# TODO : find a better way to call it.
#/etc/init.d/mountvirtfs start
##/etc/init.d/mountall.sh start
#/etc/init.d/networking start
#/etc/init.d/ssh start
# XXX And for the end ?
# The FS has enough errors so do it well ! Umount everything !