From 2cd57fee4d66ab8df06afe089da80a5e20168f25 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 1 Feb 2023 08:26:31 -0800
Subject: [PATCH] Fix the systemd generator for systemd 253 (#2165433)

As Zbyszek explained in
https://bugzilla.redhat.com/show_bug.cgi?id=2165433#c5 ,
generators aren't supposed to write outside the special locations
passed to them as args. Just writing the files into the first
of the provided locations seems to work fine (tested that this
fixes both text install and rescue mode).

Signed-off-by: Adam Williamson <awilliam@redhat.com>

Conflict:https://github.com/rhinstaller/anaconda/commit/2cd57fee4d66ab8df06afe089da80a5e20168f25
Reference:https://github.com/rhinstaller/anaconda/commit/2cd57fee4d66ab8df06afe089da80a5e20168f25

---
 data/systemd/anaconda-generator | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/data/systemd/anaconda-generator b/data/systemd/anaconda-generator
index 5791678609..c9a5230cae 100755
--- a/data/systemd/anaconda-generator
+++ b/data/systemd/anaconda-generator
@@ -11,8 +11,8 @@ fi
 
 # set up dirs
 systemd_dir=/lib/systemd/system
-target_dir=$systemd_dir/anaconda.target.wants
-mkdir -p $target_dir
+target_dir="$1/anaconda.target.wants"
+mkdir -p "$target_dir"
 
 # create symlink anaconda.target.wants/SERVICE@TTY.service
 service_on_tty() {
@@ -41,5 +41,5 @@ for tty in hvc0 hvc1 xvc0 hvsi0 hvsi1 hvsi2; do
     fi
 done
 
-ln -sf $systemd_dir/anaconda-nm-config.service $target_dir/anaconda-nm-config.service
-ln -sf $systemd_dir/anaconda-pre.service $target_dir/anaconda-pre.service
+ln -sf "$systemd_dir/anaconda-nm-config.service" "$target_dir/anaconda-nm-config.service"
+ln -sf "$systemd_dir/anaconda-pre.service" "$target_dir/anaconda-pre.service"
-- 
2.23.0