]> git.proxmox.com Git - pve-installer.git/blob - unconfigured.sh
Add libpve-common-perl to Build-Depends
[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 /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 /target >/dev/null 2>&1
42 umount -l -n /dev
43 umount -l -n /sys
44 umount -l -n /proc
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
60 mount -n -t proc proc /proc
61 mount -n -t sysfs sysfs /sys
62
63 parse_cmdline
64
65 # always load most common input drivers
66 modprobe -q psmouse || /bin/true
67 modprobe -q sermouse || /bin/true
68 modprobe -q usbhid || /bin/true
69
70 # load device mapper - used by lilo
71 modprobe -q dm_mod || /bin/true
72
73 echo "Installing additional hardware drivers"
74 export RUNLEVEL=S
75 export PREVLEVEL=N
76 /etc/init.d/udev start
77
78 # set the hostname
79 hostname proxmox
80
81 # try to get ip config with dhcp
82 echo -n "Attempting to get DHCP leases... "
83 dhclient -v
84 echo "done"
85
86 xinit -- -dpi 96 >/dev/tty2 2>&1
87
88 # just to be sure everything is on disk
89 sync
90
91 if [ $proxdebug -ne 0 ]; then
92 echo "Debugging mode (type exit or CTRL-D to reboot)"
93 debugsh
94 fi
95
96 echo "Installation done, rebooting... "
97 #mdadm -S /dev/md0 >/dev/tty2 2>&1
98 kill $(pidof dhclient) 2>&1 > /dev/null
99 real_reboot
100
101 # never reached
102 exit 0