Fix image creation issue
authorEd Bartosh <eduard.bartosh@intel.com>
Wed, 7 May 2014 16:22:02 +0000 (19:22 +0300)
committerLin A Yang <lin.a.yang@intel.com>
Thu, 8 May 2014 02:52:24 +0000 (05:52 +0300)
job_prerelease_obs strips all lines of .ks file. This breaks patches in
%post section and results in non-functional images.

Example: this stripped patch
patch -p1 -d/ <<'EOF'
diff -urN bad/etc/pam.d/systemd-user good/etc/pam.d/systemd-user
--- bad/etc/pam.d/systemd-user 2014-03-20 10:01:36.657843073 +0100
+++ good/etc/pam.d/systemd-user 2014-03-20 10:06:51.586121696 +0100
@@ -4,5 +4,6 @@

account include system-auth
session include system-auth
+session required pam_systemd.so
auth required pam_deny.so
password required pam_deny.so
EOF

causes this message in the log:
Applying configurations ...
Running scripts ...
patching file etc/pam.d/systemd-user
patch: **** malformed patch at line 6: account include system-auth

and the image doesn't boot to UI because of broken systemd configuration.

Change-Id: Id4e8d391036b67ba2a62a18766e9f369106ea4af
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
job_pre_release_obs.py

index 3d64f53..766cc7b 100755 (executable)
@@ -53,7 +53,7 @@ def update_ks(imagedata, snapshot_id, pkg_urls):
                                  line)
                 if match:
                     line = re.sub(r'@BUILD_ID@', snapshot_id, line)
-            new_ks_lines.append(line.strip())
+            new_ks_lines.append(line)
 
         new_ks_lines.insert(new_ks_lines.index('%packages')-1, repo_line)
         # Update the ks files in imagedata