5 # NOTE: we nowadays get exec'd by the initrd's PID 1, so we're the new PID 1
10 # shellcheck disable=SC2013 # per word splitting is wanted here
11 for par
in $
(cat /proc
/cmdline
); do
28 iso_dev
=$
(awk '/ iso9660 / {print $1}' /proc
/mounts
)
30 for try
in 5 4 3 2 1; do
32 if umount
-v -a --types iso9660
; then
36 echo "unmount failed - trying again in 5 seconds"
41 if [ -n "$iso_dev" ]; then
42 eject
"$iso_dev" || true
# cannot really work currently, don't care
47 echo "rebooting - please remove the ISO boot media"
51 echo "trigger reset system request"
52 # we do not expect the reboot above to fail, so rather to avoid kpanic when pid 1 exits
53 echo b
> /proc
/sysrq-trigger
60 if [[ -x /etc
/init.d
/networking
]]; then
61 /etc
/init.d
/networking stop
64 # stop udev (release file handles)
67 swap
=$
(awk '/^\/dev\// { print $1 }' /proc
/swaps
);
68 if [ -n "$swap" ]; then
69 echo -n "Deactivating swap..."
77 umount
-l -n /target
>/dev
/null
2>&1
81 [ -d /sys
/firmware
/efi
/efivars
] && umount
-l -n /sys
/firmware
/efi
/efivars
83 # do not unmount proc and sys for now, at least /proc is still required to trigger the actual
84 # reboot, and both are virtual FS only anyway
86 echo "Terminate all remaining processes"
87 kill -s TERM
-1 # TERMinate all but current init (our self) PID 1
89 echo "Kill any remaining processes"
90 kill -s KILL
-1 # KILL all but current init (our self) PID 1
95 exit 0 # shouldn't be reached, kernel will panic in that case
99 printf "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)\n"
104 # NOTE: dbus must be launched before this, else iwd cannot work
105 # FIXME: very crude, still needs to actually copy over any iwd config to target
108 for iface
in /sys
/class
/net
/*; do
109 if [ -d "$iface/wireless" ]; then
113 if [ -z $wireless_found ]; then
117 if [ -x /usr
/libexec
/iwd
]; then
118 echo "wireless device(s) found, starting iwd; use 'iwctl' to manage connections (experimental)"
121 echo "wireless device found but iwd not available, ignoring"
125 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
:/usr
/X11R
6/bin
127 echo "Starting Proxmox installation"
129 # ensure udev doesn't ignores our request; FIXME: not required anymore, as we use switch_root now
130 export SYSTEMD_IGNORE_CHROOT
=1
132 mount
-n -t proc proc
/proc
133 mount
-n -t sysfs sysfs
/sys
134 if [ -d /sys
/firmware
/efi
]; then
135 echo "EFI boot mode detected, mounting efivars filesystem"
136 mount
-n -t efivarfs efivarfs
/sys
/firmware
/efi
/efivars
138 mount
-n -t tmpfs tmpfs
/run
139 mkdir
-p /run
/proxmox-installer
143 # always load most common input drivers
144 modprobe
-q psmouse || true
145 modprobe
-q sermouse || true
146 modprobe
-q usbhid || true
148 # load device mapper - used by lilo
149 modprobe
-q dm_mod || true
151 echo "Installing additional hardware drivers"
154 /etc
/init.d
/udev start
157 mount
-t tmpfs tmpfs
/dev
/shm
159 # allow pseudo terminals for debuggin in X
161 mount
-vt devpts devpts
/dev
/pts
-o gid
=5,mode
=620
163 # shellcheck disable=SC2207
164 console_dim
=($
(IFS
=' ' stty size
)) # [height, width]
166 if (("${console_dim[0]}" > 100)) && (("${console_dim[1]}" > 400)); then
167 # heuristic only, high resolution can still mean normal/low DPI if it's a really big screen
168 # FIXME: use `edid-decode` as it can contain physical dimensions to calculate actual dpi?
169 echo "detected huge console, setting bigger font/dpi"
172 setfont
/usr
/share
/consolefonts
/Uni2-Terminus32x16.psf.gz
178 if command -v dbus-daemon
; then
179 echo "starting D-Bus daemon"
181 dbus-daemon
--system --syslog-only
183 if [ $proxdebug -ne 0 ]; then # FIXME: better intergration, e.g., use iwgtk?
184 handle_wireless
# no-op if not wireless dev is found
188 # we use a trimmed down debootstrap so make busybox tools available to compensate that
189 busybox
--install -s || true
191 setupcon ||
echo "setupcon failed, TUI rendering might be garbled - $?"
193 if [ $proxdebug -ne 0 ]; then
194 /sbin
/agetty
-o '-p -- \\u' --noclear tty9
&
195 printf "\nDropping in debug shell before starting installation\n"
196 echo "type 'exit' or press CTRL + D to continue and start the installation wizard"
200 # try to get ip config with dhcp
201 echo -n "Attempting to get DHCP leases... "
205 echo "Starting chrony for opportunistic time-sync... "
206 chronyd ||
echo "starting chrony failed ($?)"
208 echo "Starting a root shell on tty3."
209 setsid
/sbin
/agetty
-a root
--noclear tty3
&
211 /usr
/bin
/proxmox-low-level-installer dump-env
213 if [ $proxtui -ne 0 ]; then
214 echo "Starting the TUI installer"
215 /usr
/bin
/proxmox-tui-installer
2>/dev
/tty2
217 echo "Starting the installer GUI - see tty2 (CTRL+ALT+F2) for any errors..."
218 xinit
-- -dpi "$DPI" >/dev
/tty2
2>&1
221 # just to be sure everything is on disk
224 if [ $proxdebug -ne 0 ]; then
225 printf "\nDebug shell after installation exited (type exit or CTRL-D to reboot)\n"
229 echo "Installation done, rebooting... "