Skip to content

Commit 0e7c25f

Browse files
authored
Merge pull request #731 from xcp-ng/isoremaster-improve-samples
iso-remaster: improve samples, show how to add answerfile in ISO
2 parents 269ebd0 + 1ac59c3 commit 0e7c25f

File tree

2 files changed

+51
-65
lines changed

2 files changed

+51
-65
lines changed
Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
#!/bin/sh
2-
set -e
2+
set -ex
3+
4+
#HOME=/data
35

46
# unpacked rootfs to modify
57
INSTALLIMG="$1"
68

7-
## Include a locally-modified version of the installer for testing
8-
#HOSTINSTALLER=$HOME/src/xs/host-installer
9-
## - if 8.2: copies a few files too much until we can "make install", but that's harmless
10-
#cp -rv "$HOSTINSTALLER"/* "$INSTALLIMG/opt/xensource/installer/"
11-
## - if 8.3
12-
#make -C "$HOSTINSTALLER" DESTDIR="$INSTALLIMG" XS_MPATH_CONF="$HOME/src/xapi/sm/multipath/multipath.conf"
9+
# # Include an answerfile (also needs answerfile=file:// in patch-iso.sh)
10+
# cp ~/my/preset.xml "$INSTALLIMG/"
11+
12+
# # Include a locally-modified version of the installer for testing
13+
# HOSTINSTALLER=$HOME/src/xs/host-installer
14+
# if [ -r "$HOSTINSTALLER"/Makefile ]; then
15+
# # >= 8.3
16+
# make -C "$HOSTINSTALLER" DESTDIR="$INSTALLIMG" XS_MPATH_CONF="$HOME/src/xapi/sm/multipath/multipath.conf"
17+
# else
18+
# # if 8.2: Use cp until make install is available. It copies a few unnecessary files, but this is harmless.
19+
# cp -rv "$HOSTINSTALLER"/* "$INSTALLIMG/opt/xensource/installer/"
20+
# fi
1321

14-
## Install extra packages - use `rpm` not `yum`, as we had to use `rpm
15-
## --nodeps` during image creation and `yum` will now go on strike.
16-
## Luckily `yumdownloader` still works.
17-
#
18-
#DLDIR="$(mktemp -d)"
19-
#trap "rm -r '$DLDIR'" EXIT INT
20-
#
21-
#yumdownloader --installroot="$INSTALLIMG" --destdir="$DLDIR" --resolve --enablerepo=epel ndisc6 -y
22-
#fakechroot rpm --root="$INSTALLIMG" --install "$DLDIR/*.rpm"
22+
# # Install extra packages - use `rpm` not `yum`, as we had to use `rpm
23+
# # --nodeps` during image creation and `yum` will now go on strike.
24+
# # Luckily `yumdownloader` still works.
25+
# # FIXME: in its current form, his hackish snippet is only expected to work
26+
# # in the xcp-ng build-env container
27+
#
28+
# DLDIR="$(cd $INSTALLIMG && mktemp -d)"
29+
# trap "rm -r '$INSTALLIMG/$DLDIR'" EXIT INT
30+
#
31+
# yumdownloader --installroot="$INSTALLIMG" --destdir="$INSTALLIMG/$DLDIR" --resolve yum-utils -y
32+
# RPMS=$(cd $INSTALLIMG/$DLDIR && echo *.rpm)
33+
# fakechroot sh -c "cd $INSTALLIMG/$DLDIR && rpm --root='$INSTALLIMG' --install $RPMS"

scripts/iso-remaster/samples/patch-iso.sh

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,37 @@ set -e
33

44
ISODIR="$1"
55

6-
## remove existing repo sig
7-
#rm -fv "$ISODIR/repodata/repomd.xml.asc"
8-
9-
## remove old repo metadata
10-
#rm -r "$ISODIR/repodata/"
11-
6+
# patches to kernel commandline
7+
SED_COMMANDS=()
8+
# harmless no-op substitution in case no other is added
9+
SED_COMMANDS+=(-e "s@^@@")
1210

13-
## example: customize theme
14-
## remove old rpms
15-
#for p in $(cat <<EOF
16-
# xcp-ng-plymouth-theme-1.0.0-7.xcpng8.3.noarch.rpm
17-
# xcp-ng-release-8.3.0-2.x86_64.rpm
18-
# xcp-ng-release-config-8.3.0-2.x86_64.rpm
19-
# xcp-ng-release-presets-8.3.0-2.x86_64.rpm
20-
# xsconsole-10.1.13-1.xcpng8.3.x86_64.rpm
21-
#EOF
22-
# )
23-
#do
24-
# rm "$ISODIR/Packages/$p"
25-
#done
26-
#
27-
## add the new ones
28-
#for p in $(cat <<EOF
29-
# xcp-ng-plymouth-theme-1.0.0-7.xcpng8.3+newtheme1.noarch.rpm
30-
# xcp-ng-release-8.3.0-2+newtheme1.x86_64.rpm
31-
# xcp-ng-release-config-8.3.0-2+newtheme1.x86_64.rpm
32-
# xcp-ng-release-presets-8.3.0-2+newtheme1.x86_64.rpm
33-
# xsconsole-10.1.13-1.xcpng8.3+newtheme2.x86_64.rpm
34-
#EOF
35-
# )
36-
#do
37-
# cp "$HOME/newtheme/$p" "$ISODIR/Packages/"
38-
#done
39-
#
40-
## installer splash
41-
#cp "$HOME/src/xcp/iso/8.3/boot/isolinux/splash.lss" "$ISODIR/boot/isolinux/"
11+
# # update some RPMs:
12+
# # * remove old repo metadata
13+
# rm -r "$ISODIR/repodata/"
14+
# # * replace RPMs
15+
# cp -p ~/my/Packages/*.rpm "$ISODIR/Packages/"
16+
# # * regenerate repo metadata
17+
# createrepo_c "$ISODIR"
18+
# # * add `no-repo-gpgcheck` so a modified repo will be accepted
19+
# SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz no-repo-gpgcheck@")
4220

21+
# # prevent any reboot on installer error to allow investigating
22+
# SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz atexit=shell@")
4323

44-
## regenerate repodata
45-
#createrepo_c "$ISODIR"
24+
# # activate ssh to installer with given password, eg. to collect logs
25+
# SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz network_device=all sshpassword=passw0rd@")
4626

47-
## patches to kernel commandline
48-
SED_COMMANDS=()
49-
# harmless no-op substitution in case no other is added
50-
SED_COMMANDS+=(-e "s@^@@")
27+
# # get an answerfile over the network
28+
# SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz install answerfile=http://pxe/configs/preset.xml@")
5129

52-
# add `no-repo-gpgcheck` so a modified repo will be accepted
53-
#SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz no-repo-gpgcheck@")
54-
#SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz network_device=lacp:members=eth0,eth1@")
55-
#SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz install answerfile=http://pxe/configs/custom/ydi/lacp.xml@")
56-
#SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz atexit=shell@")
30+
# # get an answerfile from the ISO's install.img (also needs to copy preset.xml in patch-installimg.sh)
31+
# SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz install answerfile=file:///preset.xml@")
5732

5833
sed -i "${SED_COMMANDS[@]}" \
5934
"$ISODIR"/*/*/grub*.cfg \
6035
"$ISODIR"/boot/isolinux/isolinux.cfg
6136

62-
## sign with a different key
63-
#gpg1 --armor --detach-sign "$ISODIR/repodata/repomd.xml"
64-
#gpg1 --armor --export > "$ISODIR/RPM-GPG-KEY-xcpng"
37+
# # sign with a different key (needs more work)
38+
# gpg1 --armor --detach-sign "$ISODIR/repodata/repomd.xml"
39+
# gpg1 --armor --export > "$ISODIR/RPM-GPG-KEY-xcpng"

0 commit comments

Comments
 (0)