]>
git.proxmox.com Git - pve-installer.git/blob - unconfigured.sh
5 # NOTE: we nowadays get exec'd by the initrd's PID 1, so we're the new PID 1
9 # shellcheck disable=SC2013 # per word splitting is wanted here
10 for par
in $
(cat /proc
/cmdline
); do
24 iso_dev
=$
(awk '/ iso9660 / {print $1}' /proc
/mounts
)
26 for try
in 5 4 3 2 1; do
32 echo "unmount failed -trying again in 5 seconds"
37 if [ -n "$iso_dev" ]; then
41 echo "rebooting - please remove the ISO boot media"
43 echo b
> /proc
/sysrq-trigger
50 /etc
/init.d
/networking stop
52 # stop udev (release file handles)
55 echo -n "Deactivating swap..."
56 swap
=$
(awk '/^\/dev\// { print $1 }' /proc
/swaps
);
57 if [ -n "$swap" ]; then
62 umount
-l -n /target
>/dev
/null
2>&1
67 [ -d /sys
/firmware
/efi
/efivars
] && umount
-l -n /sys
/firmware
/efi
/efivars
69 # do not unmount proc and sys for now, at least /proc is still required to trigger the actual
70 # reboot, and both are virtual FS only anyway
72 kill -s KILL
-1 # kill all but current init (our self) PID 1
77 exit 0 # shouldn't be reached, kernel will panic in that case
81 printf "\nInstallation aborted - unable to continue (type exit or CTRL-D to reboot)\n"
86 # NOTE: dbus must be launched before this, else iwd cannot work
87 # FIXME: very crude, still needs to actually copy over any iwd config to target
90 for iface
in /sys
/class
/net
/*; do
91 if [ -d "$iface/wireless" ]; then
95 if [ -z $wireless_found ]; then
99 if [ -x /usr
/libexec
/iwd
]; then
100 echo "wireless device(s) found, starting iwd; use 'iwctl' to manage connections (experimental)"
103 echo "wireless device found but iwd not available, ignoring"
107 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
:/usr
/X11R
6/bin
109 echo "Starting Proxmox installation"
111 # ensure udev doesn't ignores our request; FIXME: not required anymore, as we use switch_root now
112 export SYSTEMD_IGNORE_CHROOT
=1
114 mount
-n -t proc proc
/proc
115 mount
-n -t sysfs sysfs
/sys
116 if [ -d /sys
/firmware
/efi
]; then
117 echo "EFI boot mode detected, mounting efivars filesystem"
118 mount
-n -t efivarfs efivarfs
/sys
/firmware
/efi
/efivars
120 mount
-n -t tmpfs tmpfs
/run
124 # always load most common input drivers
125 modprobe
-q psmouse || true
126 modprobe
-q sermouse || true
127 modprobe
-q usbhid || true
129 # load device mapper - used by lilo
130 modprobe
-q dm_mod || true
132 echo "Installing additional hardware drivers"
135 /etc
/init.d
/udev start
138 mount
-t tmpfs tmpfs
/dev
/shm
140 # allow pseudo terminals for debuggin in X
142 mount
-vt devpts devpts
/dev
/pts
-o gid
=5,mode
=620
147 if command -v dbus-daemon
; then
148 echo "starting D-Bus daemon"
150 dbus-daemon
--system --syslog-only
152 if [ $proxdebug -ne 0 ]; then # FIXME: better intergration, e.g., use iwgtk?
153 handle_wireless
# no-op if not wireless dev is found
157 if [ $proxdebug -ne 0 ]; then
158 /sbin
/agetty
-o '-p -- \\u' --noclear tty9
&
159 printf "\nDropping in debug shell before starting installation\n"
160 echo "type exit or CTRL-D to continue and start the installation wizard"
164 # try to get ip config with dhcp
165 echo -n "Attempting to get DHCP leases... "
169 echo -n "Starting chrony for opportunistic time-sync... "
170 chronyd ||
echo "starting chrony failed ($?)"
172 echo "Starting a root shell on tty3."
173 setsid
/sbin
/agetty
-a root
--noclear tty3
&
175 xinit
-- -dpi 96 >/dev
/tty2
2>&1
177 # just to be sure everything is on disk
180 if [ $proxdebug -ne 0 ]; then
181 printf "\nDebug shell after installation exited (type exit or CTRL-D to reboot)\n"
185 echo "Installation done, rebooting... "