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