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