5 # NOTE: we nowadays get exec'd by the initrd's PID 1, so we're the new PID 1
11 # shellcheck disable=SC2013 # per word splitting is wanted here
12 for par
in $
(cat /proc
/cmdline
); do
32 iso_dev
=$
(awk '/ iso9660 / {print $1}' /proc
/mounts
)
34 for try
in 5 4 3 2 1; do
36 if umount
-v -a --types iso9660
; then
40 echo "unmount failed - trying again in 5 seconds"
45 if [ -n "$iso_dev" ]; then
46 eject
"$iso_dev" || true
# cannot really work currently, don't care
51 echo "rebooting - please remove the ISO boot media"
55 echo "trigger reset system request"
56 # we do not expect the reboot above to fail, so rather to avoid kpanic when pid 1 exits
57 echo b
> /proc
/sysrq-trigger
64 if [[ -x /etc
/init.d
/networking
]]; then
65 /etc
/init.d
/networking stop
68 # stop udev (release file handles)
71 swap
=$
(awk '/^\/dev\// { print $1 }' /proc
/swaps
);
72 if [ -n "$swap" ]; then
73 echo -n "Deactivating swap..."
81 umount
-l -n /target
>/dev
/null
2>&1
85 [ -d /sys
/firmware
/efi
/efivars
] && umount
-l -n /sys
/firmware
/efi
/efivars
87 # do not unmount proc and sys for now, at least /proc is still required to trigger the actual
88 # reboot, and both are virtual FS only anyway
90 echo "Terminate all remaining processes"
91 kill -s TERM
-1 # TERMinate all but current init (our self) PID 1
93 echo "Kill any remaining processes"
94 kill -s KILL
-1 # KILL all but current init (our self) PID 1
99 exit 0 # shouldn't be reached, kernel will panic in that case
103 printf "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)\n"
108 # NOTE: dbus must be launched before this, else iwd cannot work
109 # FIXME: very crude, still needs to actually copy over any iwd config to target
112 for iface
in /sys
/class
/net
/*; do
113 if [ -d "$iface/wireless" ]; then
117 if [ -z $wireless_found ]; then
121 if [ -x /usr
/libexec
/iwd
]; then
122 echo "wireless device(s) found, starting iwd; use 'iwctl' to manage connections (experimental)"
125 echo "wireless device found but iwd not available, ignoring"
129 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
:/usr
/X11R
6/bin
131 echo "Starting Proxmox installation"
133 # ensure udev doesn't ignores our request; FIXME: not required anymore, as we use switch_root now
134 export SYSTEMD_IGNORE_CHROOT
=1
136 mount
-n -t proc proc
/proc
137 mount
-n -t sysfs sysfs
/sys
138 if [ -d /sys
/firmware
/efi
]; then
139 echo "EFI boot mode detected, mounting efivars filesystem"
140 mount
-n -t efivarfs efivarfs
/sys
/firmware
/efi
/efivars
142 mount
-n -t tmpfs tmpfs
/run
143 mkdir
-p /run
/proxmox-installer
147 # always load most common input drivers
148 modprobe
-q psmouse || true
149 modprobe
-q sermouse || true
150 modprobe
-q usbhid || true
152 # load device mapper - used by lilo
153 modprobe
-q dm_mod || true
155 echo "Installing additional hardware drivers"
158 /etc
/init.d
/udev start
161 mount
-t tmpfs tmpfs
/dev
/shm
163 # allow pseudo terminals for debuggin in X
165 mount
-vt devpts devpts
/dev
/pts
-o gid
=5,mode
=620
167 # shellcheck disable=SC2207
168 console_dim
=($
(IFS
=' ' stty size
)) # [height, width]
170 if (("${console_dim[0]}" > 100)) && (("${console_dim[1]}" > 400)); then
171 # heuristic only, high resolution can still mean normal/low DPI if it's a really big screen
172 # FIXME: use `edid-decode` as it can contain physical dimensions to calculate actual dpi?
173 echo "detected huge console, setting bigger font/dpi"
176 setfont
/usr
/share
/consolefonts
/Uni2-Terminus32x16.psf.gz
182 if command -v dbus-daemon
; then
183 echo "starting D-Bus daemon"
185 dbus-daemon
--system --syslog-only
187 if [ $proxdebug -ne 0 ]; then # FIXME: better intergration, e.g., use iwgtk?
188 handle_wireless
# no-op if not wireless dev is found
192 # we use a trimmed down debootstrap so make busybox tools available to compensate that
193 busybox
--install -s || true
195 setupcon ||
echo "setupcon failed, TUI rendering might be garbled - $?"
197 if [ $proxdebug -ne 0 ]; then
198 /sbin
/agetty
-o '-p -- \\u' --noclear tty9
&
199 printf "\nDropping in debug shell before starting installation\n"
200 echo "type 'exit' or press CTRL + D to continue and start the installation wizard"
204 # try to get ip config with dhcp
205 echo -n "Attempting to get DHCP leases... "
209 echo "Starting chrony for opportunistic time-sync... "
210 chronyd ||
echo "starting chrony failed ($?)"
212 echo "Starting a root shell on tty3."
213 setsid
/sbin
/agetty
-a root
--noclear tty3
&
215 /usr
/bin
/proxmox-low-level-installer dump-env
217 if [ $proxtui -ne 0 ]; then
218 if [ "$serial" -ne 0 ]; then
219 echo "Setting terminal size to 80x24 for serial install"
220 stty columns
80 rows
25
223 echo "Starting the TUI installer"
224 /usr
/bin
/proxmox-tui-installer
2>/dev
/tty2
226 echo "Starting the installer GUI - see tty2 (CTRL+ALT+F2) for any errors..."
227 xinit
-- -dpi "$DPI" -s 0 >/dev
/tty2
2>&1
230 # just to be sure everything is on disk
233 if [ $proxdebug -ne 0 ]; then
234 printf "\nDebug shell after installation exited (type exit or CTRL-D to reboot)\n"
238 echo "Installation done, rebooting... "