]>
Commit | Line | Data |
---|---|---|
89a12446 DM |
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() { | |
16ff00ec | 21 | /bin/bash |
89a12446 DM |
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 | ||
89a12446 | 41 | umount -l -n /target >/dev/null 2>&1 |
37a88382 | 42 | umount -l -n /dev |
89a12446 | 43 | umount -l -n /sys |
e89d1aef | 44 | umount -l -n /proc |
89a12446 DM |
45 | |
46 | exit 0 | |
47 | } | |
48 | ||
49 | err_reboot() { | |
50 | ||
51 | echo "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)" | |
52 | debugsh | |
53 | real_reboot | |
54 | } | |
55 | ||
56 | echo "Starting Proxmox installation" | |
57 | ||
58 | PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin | |
59 | ||
194d737a TL |
60 | # ensure udev isn't snippy and ignores our request |
61 | export SYSTEMD_IGNORE_CHROOT=1 | |
62 | ||
89a12446 | 63 | mount -n -t proc proc /proc |
89a12446 DM |
64 | mount -n -t sysfs sysfs /sys |
65 | ||
66 | parse_cmdline | |
67 | ||
68 | # always load most common input drivers | |
69 | modprobe -q psmouse || /bin/true | |
70 | modprobe -q sermouse || /bin/true | |
71 | modprobe -q usbhid || /bin/true | |
72 | ||
73 | # load device mapper - used by lilo | |
74 | modprobe -q dm_mod || /bin/true | |
75 | ||
76 | echo "Installing additional hardware drivers" | |
77 | export RUNLEVEL=S | |
78 | export PREVLEVEL=N | |
79 | /etc/init.d/udev start | |
80 | ||
89a12446 DM |
81 | # set the hostname |
82 | hostname proxmox | |
83 | ||
89a12446 | 84 | # try to get ip config with dhcp |
01e402f0 FG |
85 | echo -n "Attempting to get DHCP leases... " |
86 | dhclient -v | |
89a12446 DM |
87 | echo "done" |
88 | ||
89 | xinit -- -dpi 96 >/dev/tty2 2>&1 | |
90 | ||
b0c4afcc DM |
91 | # just to be sure everything is on disk |
92 | sync | |
93 | ||
89a12446 DM |
94 | if [ $proxdebug -ne 0 ]; then |
95 | echo "Debugging mode (type exit or CTRL-D to reboot)" | |
96 | debugsh | |
97 | fi | |
98 | ||
99 | echo "Installation done, rebooting... " | |
100 | #mdadm -S /dev/md0 >/dev/tty2 2>&1 | |
cd1964db | 101 | kill $(pidof dhclient) 2>&1 > /dev/null |
89a12446 DM |
102 | real_reboot |
103 | ||
104 | # never reached | |
105 | exit 0 |