summaryrefslogtreecommitdiff
path: root/data/install-scripts/fedora.xml
blob: 0a5de10c61cd68154cf3cf0d20ed39271c61f20c (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<libosinfo version="0.0.1">
  <!-- JEOS PROFILE -->
  <install-script id='http://fedoraproject.org/scripts/fedora/jeos'>
    <profile>jeos</profile>
    <expected-filename>fedora.ks</expected-filename>
    <config>
      <param name="admin-password" policy="optional"/>
      <param name="l10n-keyboard" policy="optional" value-map="http://libosinfo.fedorahosted.org/x11-keyboard"/>
      <param name="l10n-language" policy="optional"/>
      <param name="l10n-timezone" policy="optional"/>
      <param name="target-disk" policy="optional"/>
      <param name="script-disk" policy="required"/>
    </config>
    <template>
      <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">

        <xsl:output method="text"/>

        <xsl:template name="target-disk">
          <xsl:choose>
            <xsl:when test="config/target-disk != ''">
              <xsl:value-of select="config/target-disk"/>
            </xsl:when>
            <xsl:when test="os/version &gt; 9">
              <!-- virtio -->
              <xsl:text>/dev/vda</xsl:text>
            </xsl:when>
            <xsl:when test="os/version &gt; 6">
              <!-- libata IDE -->
              <xsl:text>/dev/sda</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <!-- IDE -->
              <xsl:text>/dev/hda</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>

        <xsl:template name="script-disk">
          <xsl:variable name="script-disk">
            <xsl:value-of select="config/script-disk"/>
          </xsl:variable>
          <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
        </xsl:template>

	<xsl:template name="rootfs">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 10">
	      <xsl:text>ext4</xsl:text>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:text>ext3</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

	<xsl:template name="bootfs">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 11">
	      <xsl:text>ext4</xsl:text>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:text>ext3</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

	<xsl:template name="keyboard">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 17">
              <xsl:value-of select="config/l10n-keyboard"/>
	    </xsl:when>
	    <xsl:otherwise>
              <!-- FIXME: F17 and older required keyboard layout to be a console
                   layout so we'll need a different datamap for those but
                   currently we only support one datamap per config param per
                   script. -->
	      <xsl:text>us</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

        <xsl:template match="/command-line">
            <xsl:text>ks=hd:</xsl:text>
            <xsl:call-template name="script-disk"/>
            <xsl:text>:/</xsl:text>
            <xsl:value-of select="script/expected-filename"/>
        </xsl:template>

        <xsl:template match="/install-script-config">
# Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
install
cdrom
text
keyboard '<xsl:call-template name="keyboard"/>'
lang <xsl:value-of select="config/l10n-language"/>
<xsl:if test="os/version &lt; 7">
langsupport --default <xsl:value-of select="config/l10n-language"/> <xsl:value-of select="config/l10n-language"/>
mouse generic3ps/2 --device psaux
</xsl:if>
skipx
network --device eth0 --bootproto dhcp
rootpw <xsl:value-of select="config/admin-password"/>
firewall --disabled
authconfig --enableshadow --enablemd5
<xsl:if test="os/version &gt; 1">
selinux --enforcing
</xsl:if>
timezone --utc <xsl:value-of select="config/l10n-timezone"/>
bootloader --location=mbr
zerombr <xsl:if test="os/version &lt; 14">yes</xsl:if>

clearpart --all --drives=<xsl:call-template name="target-disk"/>

<xsl:if test="os/version &gt; 15">
part biosboot --fstype=biosboot --size=1
</xsl:if>
part /boot --fstype <xsl:call-template name="bootfs"/> --size=200 --ondisk=<xsl:call-template name="target-disk"/>
part pv.2 --size=1 --grow --ondisk=<xsl:call-template name="target-disk"/>
volgroup VolGroup00 --pesize=32768 pv.2
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536
logvol / --fstype <xsl:call-template name="rootfs"/> --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
reboot

%packages
<xsl:choose>
  <xsl:when test="os/version &lt; 18">
@base
  </xsl:when>
  <xsl:otherwise>
@standard
  </xsl:otherwise>
</xsl:choose>
@core
<xsl:if test="os/version &gt; 6">
@hardware-support
</xsl:if>

%end
	</xsl:template>
      </xsl:stylesheet>
    </template>
  </install-script>

  <!-- DESKTOP PROFILE -->
  <install-script id='http://fedoraproject.org/scripts/fedora/desktop'>
    <profile>desktop</profile>
    <expected-filename>fedora.ks</expected-filename>
    <config>
        <param name="l10n-keyboard" policy="optional" value-map="http://libosinfo.fedorahosted.org/x11-keyboard"/>
        <param name="l10n-language" policy="optional"/>
        <param name="l10n-timezone" policy="optional"/>
        <param name="hostname" policy="optional"/>
        <param name="user-login" policy="required"/>
        <param name="user-password" policy="required"/>
        <param name="admin-password" policy="required"/>
        <param name="avatar-location" policy="optional"/>
        <param name="avatar-disk" policy="optional"/>
        <param name="target-disk" policy="optional"/>
        <param name="script-disk" policy="required"/>
    </config>
    <avatar-format>
      <mime-type>image/png</mime-type>
    </avatar-format>
    <template>
      <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">

        <xsl:output method="text"/>

        <xsl:template name="target-disk">
          <xsl:choose>
            <xsl:when test="config/target-disk != ''">
              <xsl:value-of select="config/target-disk"/>
            </xsl:when>
            <xsl:when test="os/version &gt; 9">
              <!-- virtio -->
              <xsl:text>/dev/vda</xsl:text>
            </xsl:when>
            <xsl:when test="os/version &gt; 6">
              <!-- libata IDE -->
              <xsl:text>/dev/sda</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <!-- IDE -->
              <xsl:text>/dev/hda</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>

        <xsl:template name="script-disk">
          <xsl:variable name="script-disk">
            <xsl:value-of select="config/script-disk"/>
          </xsl:variable>
          <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
        </xsl:template>

	<xsl:template name="rootfs">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 10">
	      <xsl:text>ext4</xsl:text>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:text>ext3</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

	<xsl:template name="bootfs">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 11">
	      <xsl:text>ext4</xsl:text>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:text>ext3</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

	<xsl:template name="keyboard">
	  <xsl:choose>
	    <xsl:when test="os/version &gt; 17">
              <xsl:value-of select="config/l10n-keyboard"/>
	    </xsl:when>
	    <xsl:otherwise>
              <!-- FIXME: F17 and older required keyboard layout to be a console
                   layout so we'll need a different datamap for those but
                   currently we only support one datamap per config param per
                   script. -->
	      <xsl:text>us</xsl:text>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

        <xsl:template match="/command-line">
            <xsl:text>ks=hd:</xsl:text>
            <xsl:call-template name="script-disk"/>
            <xsl:text>:/</xsl:text>
            <xsl:value-of select="script/expected-filename"/>
        </xsl:template>

        <xsl:template match="/install-script-config">
# Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
install
cdrom
keyboard '<xsl:call-template name="keyboard"/>'
lang <xsl:value-of select="config/l10n-language"/>
network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname=<xsl:value-of select="config/hostname"/>
rootpw dummyPa55w0rd # Actual password set (or unset) in %post below
firewall --disabled
authconfig --enableshadow --enablemd5
timezone --utc <xsl:value-of select="config/l10n-timezone"/>
bootloader --location=mbr
zerombr

clearpart --all --drives=<xsl:call-template name="target-disk"/>

firstboot --disable

part biosboot --fstype=biosboot --size=1
part /boot --fstype <xsl:call-template name="bootfs"/> --recommended --ondisk=<xsl:call-template name="target-disk"/>
part pv.2 --size=1 --grow --ondisk=<xsl:call-template name="target-disk"/>
volgroup VolGroup00 --pesize=32768 pv.2
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536
logvol / --fstype <xsl:call-template name="rootfs"/> --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
reboot

%packages
<xsl:choose>
  <xsl:when test="os/version &lt; 18">
@base
@graphical-internet
@sound-and-video
  </xsl:when>
  <xsl:otherwise>
@standard
@epiphany
@firefox
@multimedia
  </xsl:otherwise>
</xsl:choose>
@core
@hardware-support
@base-x
@gnome-desktop

# QXL driver and SPICE vdagent
xorg-x11-drv-qxl
spice-vdagent

%end

%post --erroronfail

useradd -G wheel <xsl:value-of select="config/user-login"/> # Add user
if test -z <xsl:value-of select="config/user-password"/>; then
    passwd -d <xsl:value-of select="config/user-login"/> # Make user account passwordless
else
    echo <xsl:value-of select="config/user-password"/> |passwd --stdin <xsl:value-of select="config/user-login"/>
fi

if test -z <xsl:value-of select="config/admin-password"/>; then
    passwd -d root # Make root account passwordless
else
    echo <xsl:value-of select="config/admin-password"/> |passwd --stdin root
fi

# Set user avatar
if test -n <xsl:value-of select="config/avatar-location"/>; then
mkdir /mnt/unattended-media
mount <xsl:value-of select='config/avatar-disk'/> /mnt/unattended-media
cp /mnt/unattended-media<xsl:value-of select="config/avatar-location"/> /var/lib/AccountsService/icons/<xsl:value-of select="config/user-login"/>
umount /mnt/unattended-media
fi

echo "
[User]
Language=
XSession=
Icon=/var/lib/AccountsService/icons/<xsl:value-of select="config/user-login"/>
" >> /var/lib/AccountsService/users/<xsl:value-of select="config/user-login"/>

# Enable autologin
echo "[daemon]
AutomaticLoginEnable=true
AutomaticLogin=<xsl:value-of select="config/user-login"/>

[security]

[xdmcp]

[greeter]

[chooser]

[debug]
" > /etc/gdm/custom.conf

%end
	</xsl:template>
      </xsl:stylesheet>
    </template>
  </install-script>

</libosinfo>