Merge lp:~tai271828/curtinator/mr-support-cosmic into lp:~roadmr/curtinator/trunk

Proposed by Taihsiang Ho
Status: Merged
Approved by: Daniel Manrique
Approved revision: 12
Merged at revision: 11
Proposed branch: lp:~tai271828/curtinator/mr-support-cosmic
Merge into: lp:~roadmr/curtinator/trunk
Diff against target: 74 lines (+27/-5)
2 files modified
data/preseed.txt (+3/-4)
scripts/curtinator (+24/-1)
To merge this branch: bzr merge lp:~tai271828/curtinator/mr-support-cosmic
Reviewer Review Type Date Requested Status
Daniel Manrique Approve
Review via email: mp+359231@code.launchpad.net

Description of the change

Add support for Cosmic. This merge request is composed of two parts:
1. Handling the initrd. The initrd archive is created in different format from the previous releases.
2. Fix the incorrect parameter expansion of network configuration.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

+1

review: Approve
Revision history for this message
Taihsiang Ho (tai271828) wrote :

Thanks for the comments and approval!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/preseed.txt'
--- data/preseed.txt 2018-05-02 08:10:56 +0000
+++ data/preseed.txt 2018-11-23 09:38:38 +0000
@@ -54,10 +54,9 @@
54 in-target apt-get clean; \54 in-target apt-get clean; \
55 cp /cdrom/README.diskdefines /target; \55 cp /cdrom/README.diskdefines /target; \
56 (cd /target/ && \56 (cd /target/ && \
57 eni=etc/network/interfaces; enid="$eni.d"; \57 [ -f etc/network/interfaces ] || exit 0; \
58 [ -f $eni ] || exit 0; \58 grep -q "source.*/etc/network/interfaces.d" etc/network/interfaces && exit 0; \
59 grep -q "source.*/${enid}" "$eni" && exit 0; \59 { echo; echo "#curtinator added"; echo "source /etc/network/interfaces.d/*.cfg"; } >> etc/network/interfaces; \
60 { echo; echo "#curtinator added"; echo "source /$enid/*.cfg"; } >> "$eni" \
61 ); \60 ); \
62 umount /target/sys; \61 umount /target/sys; \
63 umount /target/media/cdrom; \62 umount /target/media/cdrom; \
6463
=== modified file 'scripts/curtinator'
--- scripts/curtinator 2018-05-02 08:10:56 +0000
+++ scripts/curtinator 2018-11-23 09:38:38 +0000
@@ -121,6 +121,27 @@
121 package_file $url example-preseed | gunzip -c -121 package_file $url example-preseed | gunzip -c -
122}122}
123123
124function decompress_rfs_from_mixed_initrd() {
125 local initrd=$1
126 local initrd_decompressed_rfs_cpio=$2
127
128 # magic number from binwalk output of cosmic initrd
129 dd if=$initrd bs=1605632 skip=1 | unlzma -c > $initrd_decompressed_rfs_cpio
130}
131
132function compress_rfs_into_mixed_initrd() {
133 local initrd_decompressed_rfs_cpio=$1
134 local initrd=$2
135
136 local temp_rfs=$(mktemp)
137 lzma -c $initrd_decompressed_rfs_cpio > $temp_rfs
138 # extract microcode binaries
139 local temp_microcode=$(mktemp)
140 dd if=$initrd of=$temp bs=512 count=3136
141
142 cat $temp $temp_rfs > $initrd
143}
144
124function patch_initrd() {145function patch_initrd() {
125 local initrd=$1; shift146 local initrd=$1; shift
126 local files=$@147 local files=$@
@@ -130,6 +151,7 @@
130 case $initrd in151 case $initrd in
131 *.gz) gunzip -c $initrd > $temp;;152 *.gz) gunzip -c $initrd > $temp;;
132 *.lz) unlzma -c -S .lz $initrd > $temp;;153 *.lz) unlzma -c -S .lz $initrd > $temp;;
154 *) decompress_rfs_from_mixed_initrd $initrd $temp;;
133 esac155 esac
134156
135 echo $files | cpio --quiet -o -H newc -A -F $temp157 echo $files | cpio --quiet -o -H newc -A -F $temp
@@ -137,6 +159,7 @@
137 case $initrd in159 case $initrd in
138 *.gz) gzip -9 -c $temp > $initrd;;160 *.gz) gzip -9 -c $temp > $initrd;;
139 *.lz) lzma -c $temp > $initrd;;161 *.lz) lzma -c $temp > $initrd;;
162 *) compress_rfs_into_mixed_initrd $temp $initrd;;
140 esac163 esac
141164
142 rm -f $temp165 rm -f $temp
@@ -194,7 +217,7 @@
194217
195# Extract the needed files from the ISO image.218# Extract the needed files from the ISO image.
196DISK_INFO="/.disk/info"219DISK_INFO="/.disk/info"
197INITRD='*/initrd.*'220INITRD='*/initrd*'
198KERNEL='*/vmlinuz*'221KERNEL='*/vmlinuz*'
199PRESEED='/preseed/*'222PRESEED='/preseed/*'
200echo "Extracting $ISO to $DIRECTORY"223echo "Extracting $ISO to $DIRECTORY"

Subscribers

People subscribed via source and target branches

to all changes: