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
102 # reachable through the ERR trap
103 # shellcheck disable=SC2317
105 printf "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)\n"
110 # NOTE: dbus must be launched before this, else iwd cannot work
111 # FIXME: very crude, still needs to actually copy over any iwd config to target
114 for iface
in /sys
/class
/net
/*; do
115 if [ -d "$iface/wireless" ]; then
119 if [ -z $wireless_found ]; then
123 if [ -x /usr
/libexec
/iwd
]; then
124 echo "wireless device(s) found, starting iwd; use 'iwctl' to manage connections (experimental)"
127 echo "wireless device found but iwd not available, ignoring"
131 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
:/usr
/X11R
6/bin
133 echo "Starting Proxmox installation"
135 # ensure udev doesn't ignores our request; FIXME: not required anymore, as we use switch_root now
136 export SYSTEMD_IGNORE_CHROOT
=1
138 mount
-n -t proc proc
/proc
139 mount
-n -t sysfs sysfs
/sys
140 if [ -d /sys
/firmware
/efi
]; then
141 echo "EFI boot mode detected, mounting efivars filesystem"
142 mount
-n -t efivarfs efivarfs
/sys
/firmware
/efi
/efivars
144 mount
-n -t tmpfs tmpfs
/run
145 mkdir
-p /run
/proxmox-installer
149 # always load most common input drivers
150 modprobe
-q psmouse || true
151 modprobe
-q sermouse || true
152 modprobe
-q usbhid || true
154 # load device mapper - used by lilo
155 modprobe
-q dm_mod || true
157 echo "Installing additional hardware drivers"
160 /etc
/init.d
/udev start
163 mount
-t tmpfs tmpfs
/dev
/shm
165 # allow pseudo terminals for debuggin in X
167 mount
-vt devpts devpts
/dev
/pts
-o gid
=5,mode
=620
169 # shellcheck disable=SC2207
170 console_dim
=($
(IFS
=' ' stty size
)) # [height, width]
172 if (("${console_dim[0]}" > 100)) && (("${console_dim[1]}" > 400)); then
173 # heuristic only, high resolution can still mean normal/low DPI if it's a really big screen
174 # FIXME: use `edid-decode` as it can contain physical dimensions to calculate actual dpi?
175 echo "detected huge console, setting bigger font/dpi"
178 setfont
/usr
/share
/consolefonts
/Uni2-Terminus32x16.psf.gz
184 if command -v dbus-daemon
; then
185 echo "starting D-Bus daemon"
187 dbus-daemon
--system --syslog-only
189 if [ $proxdebug -ne 0 ]; then # FIXME: better intergration, e.g., use iwgtk?
190 handle_wireless
# no-op if not wireless dev is found
194 # we use a trimmed down debootstrap so make busybox tools available to compensate that
195 busybox
--install -s || true
197 setupcon ||
echo "setupcon failed, TUI rendering might be garbled - $?"
199 if [ "$serial" -ne 0 ]; then
200 echo "Setting terminal size to 80x24 for serial install"
201 stty columns
80 rows
24
204 if [ $proxdebug -ne 0 ]; then
205 /sbin
/agetty
-o '-p -- \\u' --noclear tty9
&
206 printf "\nDropping in debug shell before starting installation\n"
207 echo "type 'exit' or press CTRL + D to continue and start the installation wizard"
211 # try to get ip config with dhcp
212 echo -n "Attempting to get DHCP leases... "
216 echo "Starting chrony for opportunistic time-sync... "
217 chronyd ||
echo "starting chrony failed ($?)"
219 echo "Starting a root shell on tty3."
220 setsid
/sbin
/agetty
-a root
--noclear tty3
&
222 /usr
/bin
/proxmox-low-level-installer dump-env
224 if [ $proxtui -ne 0 ]; then
225 echo "Starting the TUI installer"
226 /usr
/bin
/proxmox-tui-installer
2>/dev
/tty2
228 echo "Starting the installer GUI - see tty2 (CTRL+ALT+F2) for any errors..."
229 xinit
-- -dpi "$DPI" -s 0 >/dev
/tty2
2>&1
232 # just to be sure everything is on disk
235 if [ $proxdebug -ne 0 ]; then
236 printf "\nDebug shell after installation exited (type exit or CTRL-D to reboot)\n"
240 echo "Installation done, rebooting... "
247 # shellcheck disable=SC2317