forked from theforeman/foreman-discovery-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-livecd
executable file
·66 lines (60 loc) · 1.75 KB
/
build-livecd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
[[ -z "$1" ]] && echo "Usage: $0 fdi-name.ks [RELEASE_NUMBER]" && exit 1
VERSION=$(git describe --abbrev=0 --tags)
RELEASE=$(date +%Y%m%d).${2:-1}
KS_INSTALL=fdi-install.ks
KS_TARGET=fdi-image.ks
OVERLAY="/etc/dhcp/dhclient.d/get-zip-server.sh
/etc/profile.d/discovery.sh
/etc/rc.d/rc.local
/etc/systemd/system/discovery-autostart.service
/etc/systemd/system/discovery-register.service
/etc/systemd/system/discovery-setup.path
/etc/systemd/system/discovery-setup.service
/etc/systemd/system/nm-prepare.service
/usr/bin/discovery-autostart
/usr/bin/discovery-debug
/usr/bin/discovery-register
/usr/bin/discovery-setup
/usr/bin/find-largest-rpms
/usr/bin/find-missing-libs
/usr/bin/get-zip-server_config
/usr/bin/nm-prepare
/usr/lib64/ruby/vendor_ruby/discovery.rb
/usr/share/fdi/facts/discovery-facts.rb
/usr/share/fdi/RELEASE
/usr/share/fdi/VERSION"
# prepare version and release files
echo "$VERSION" > root/usr/share/fdi/VERSION
echo "$RELEASE" > root/usr/share/fdi/RELEASE
# generate install overlay
echo "# <generated by build-livecd>" > $KS_INSTALL
for FILE in $OVERLAY; do
cat >> $KS_INSTALL <<EOF
%post
mkdir -p \$(dirname $FILE)
cat > $FILE <<'CODE'
$(cat root$FILE)
CODE
%end
EOF
done
cat >> $KS_INSTALL <<KS
%post
chmod +x \
/etc/dhcp/dhclient.d/get-zip-server.sh \
/etc/rc.d/rc.local \
/usr/bin/discovery-autostart \
/usr/bin/discovery-debug \
/usr/bin/discovery-register \
/usr/bin/discovery-setup \
/usr/bin/find-largest-rpms \
/usr/bin/find-missing-libs \
/usr/bin/get-zip-server_config \
/usr/bin/nm-prepare
%end
KS
echo "# </generated by build-livecd>" >> $KS_INSTALL
# prepare result kickstart
ksflatten -c "$1" -o $KS_TARGET
echo "Now run as root ./build-livecd-root or submit $KS_TARGET into koji"