]> git.proxmox.com Git - pve-installer.git/blob - unconfigured.sh
imported from svn 'pve-installer/pve2'
[pve-installer.git] / unconfigured.sh
1 #!/bin/bash
2
3 trap "err_reboot" ERR
4
5 parse_cmdline() {
6 root=
7 proxdebug=0
8 for par in $(cat /proc/cmdline); do
9 case $par in
10 root=*)
11 root=${par#root=}
12 ;;
13 proxdebug)
14 proxdebug=1
15 ;;
16 esac
17 done;
18 }
19
20 debugsh() {
21 getty 38400 tty1 -i -n -l /bin/bash
22 }
23
24 real_reboot() {
25
26 trap - ERR
27
28 /etc/init.d/networking stop
29
30 # stop udev (release file handles)
31 /etc/init.d/udev stop
32
33 echo -n "Deactivating swap..."
34 swap=$(grep /dev /proc/swaps);
35 if [ -n "$swap" ]; then
36 set $swap
37 swapoff $1
38 fi
39 echo "done."
40
41 umount -l -n /etc/network/run
42
43 umount -l -n /dev/shm
44 umount -l -n /dev/.static/dev
45 umount -l -n /dev
46
47 umount -l -n /target >/dev/null 2>&1
48 umount -l -n /tmp
49 umount -l -n /var/tmp
50 umount -l -n /var/log
51 umount -l -n /var/run
52 umount -l -n /var/lib/xkb
53
54 umount -l -n /proc
55 umount -l -n /sys
56
57 exit 0
58 }
59
60 err_reboot() {
61
62 echo "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)"
63 debugsh
64 real_reboot
65 }
66
67 echo "Starting Proxmox installation"
68
69 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
70
71 mount -n -t proc proc /proc
72 mount -n -t tmpfs tmpfs /tmp
73 mount -n -t tmpfs tmpfs /var/tmp
74 mount -n -t tmpfs tmpfs /var/log
75 mount -n -t tmpfs tmpfs /var/run
76 mount -n -t tmpfs tmpfs /var/lib/xkb
77 mount -n -t sysfs sysfs /sys
78
79 parse_cmdline
80
81 # always load most common input drivers
82 modprobe -q psmouse || /bin/true
83 modprobe -q sermouse || /bin/true
84 modprobe -q usbhid || /bin/true
85
86 # load device mapper - used by lilo
87 modprobe -q dm_mod || /bin/true
88
89 echo "Installing additional hardware drivers"
90 export RUNLEVEL=S
91 export PREVLEVEL=N
92 /etc/init.d/udev start
93
94 # used by if up down scripts
95 mount -t tmpfs none /dev/shm
96 mkdir /dev/shm/network
97 mount -t tmpfs tmpfs /etc/network/run
98
99 # set the hostname
100 hostname proxmox
101
102 #check system time
103 /usr/bin/checktime
104
105 # try to get ip config with dhcp
106 echo -n "Detecting network settings... "
107 /etc/init.d/networking start >/dev/tty2 2>&1
108 echo "done"
109
110 xinit -- -dpi 96 >/dev/tty2 2>&1
111
112 if [ $proxdebug -ne 0 ]; then
113 echo "Debugging mode (type exit or CTRL-D to reboot)"
114 debugsh
115 fi
116
117 echo "Installation done, rebooting... "
118 #mdadm -S /dev/md0 >/dev/tty2 2>&1
119 real_reboot
120
121 # never reached
122 exit 0