Handle Ubiquity now emptying /run

See comment for detailed description.
This commit is contained in:
Saverio Miroddi 2021-06-13 11:49:30 +02:00
parent 997b18ebfc
commit 4a03a0b360

View File

@ -1256,13 +1256,17 @@ function sync_os_temp_installation_dir_to_rpool {
perl -lane 'BEGIN { $/ = "\r"; $|++ } $F[1] =~ /(\d+)%$/ && print $1' |
whiptail --gauge "Syncing the installed O/S to the root pool FS..." 30 100 0
mkdir "$c_zfs_mount_dir/run"
# Required destination of symlink `/etc/resolv.conf`, present in Ubuntu systems (not Debian).
# Ubiquity used to leave `/target/run`, which included the file symlinked by `/etc/resolv.conf`. At
# some point, it started cleaning it after installation, leaving the symlink broken, which caused
# the jail preparation to fail. For this reason, we now create the dir/file manually.
# As of Jun/2021, it's not clear if there is any O/S leaving the dir/file, but for simplicity, we
# always create them if not existing.
#
if [[ -d $c_installed_os_mount_dir/run/systemd/resolve ]]; then
rsync -av --relative "$c_installed_os_mount_dir/run/./systemd/resolve" "$c_zfs_mount_dir/run"
fi
mkdir -p "$c_installed_os_mount_dir/run/systemd/resolve"
touch "$c_installed_os_mount_dir/run/systemd/resolve/stub-resolv.conf"
mkdir "$c_zfs_mount_dir/run"
rsync -av --relative "$c_installed_os_mount_dir/run/./systemd/resolve" "$c_zfs_mount_dir/run"
umount "$c_installed_os_mount_dir"
}