]> git.proxmox.com Git - pve-installer.git/blob - unconfigured.sh
unconfigured: allow pseudo terminals
[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 /run
44 [ -d /sys/firmware/efi/efivars ] && umount -l -n /sys/firmware/efi/efivars
45 umount -l -n /sys
46 umount -l -n /proc
47
48 exit 0
49 }
50
51 err_reboot() {
52
53 echo "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)"
54 debugsh
55 real_reboot
56 }
57
58 echo "Starting Proxmox installation"
59
60 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
61
62 # ensure udev isn't snippy and ignores our request
63 export SYSTEMD_IGNORE_CHROOT=1
64
65 mount -n -t proc proc /proc
66 mount -n -t sysfs sysfs /sys
67 if [ -d /sys/firmware/efi ]; then
68 echo "EFI boot mode detected, mounting efivars filesystem"
69 mount -n -t efivarfs efivarfs /sys/firmware/efi/efivars
70 fi
71 mount -n -t tmpfs tmpfs /run
72
73 parse_cmdline
74
75 # always load most common input drivers
76 modprobe -q psmouse || /bin/true
77 modprobe -q sermouse || /bin/true
78 modprobe -q usbhid || /bin/true
79
80 # load device mapper - used by lilo
81 modprobe -q dm_mod || /bin/true
82
83 echo "Installing additional hardware drivers"
84 export RUNLEVEL=S
85 export PREVLEVEL=N
86 /etc/init.d/udev start
87
88 mkdir -p /dev/shm
89 mount -t tmpfs tmpfs /dev/shm
90
91 # allow pseudo terminals for debuggin in X
92 mkdir -p /dev/pts
93 mount -vt devpts devpts /dev/pts -o gid=5,mode=620
94
95 if [ $proxdebug -ne 0 ]; then
96 echo "Dropping in debug shell inside chroot before starting installation"
97 echo "type exit or CTRL-D to start installation wizard"
98 debugsh
99 fi
100
101 # set the hostname
102 hostname proxmox
103
104 # try to get ip config with dhcp
105 echo -n "Attempting to get DHCP leases... "
106 dhclient -v
107 echo "done"
108
109 xinit -- -dpi 96 >/dev/tty2 2>&1
110
111 # just to be sure everything is on disk
112 sync
113
114 if [ $proxdebug -ne 0 ]; then
115 echo "Debugging mode (type exit or CTRL-D to reboot)"
116 debugsh
117 fi
118
119 echo "Installation done, rebooting... "
120 #mdadm -S /dev/md0 >/dev/tty2 2>&1
121 kill $(pidof dhclient) 2>&1 > /dev/null
122 real_reboot
123
124 # never reached
125 exit 0