Merge pull request #211 from saveriomiroddi/handle_ubiquity_emptying_slash_run

Handle Ubiquity now emptying `/run`
This commit is contained in:
Saverio Miroddi 2021-06-13 11:58:57 +02:00
commit 6db85ef539

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
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"
fi
umount "$c_installed_os_mount_dir"
}