-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfreebsd-kickstart
More file actions
167 lines (140 loc) · 3.8 KB
/
freebsd-kickstart
File metadata and controls
167 lines (140 loc) · 3.8 KB
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
% /stand/cobbler.cfg.tmpl
# The script that fetches this file uses the "% <filename> lines to split the
# file.
#
# It assumes the answer file will contain a "cobbler.cfg.tmpl" file, does some
# substitution for variables it's best placed to know, and then loadConfigs it.
# So the cobbler.cfg.tmpl section is required. The other sections are used by
# cobber.cfg.
#
# Turn on extra debugging.
debug=YES
# Turn off all prompting.
nonInteractive=YES
noWarn=YES
################################
# Figure out our installation media and configure it.
# The all CAPS variables are replaced by the script that fetches this with
# information from DHCP.
netDev=IFACE
defaultrouter=ROUTE
ipaddr=IP
netmask=NM
hostname=$system_name
_httpPath=http://$server/cobbler/ks_mirror/$distro
mediaSetHTTP
# Handle pre-install tasks (talk to cobbler?)
command=/bin/sh /stand/preinstall.sh
system
# Select which distributions we want.
dists=base kernels GENERIC SMP doc catpages
distSetCustom
# Figure out the disk configuration
command=/bin/sh /stand/dodisk.sh
system
configFile=/stand/disk.cfg
loadConfig
# OK, everything is set. Do it!
installCommit
package=perl
packageAdd
package=lsof
packageAdd
package=bash
packageAdd
package=python
packageAdd
package=ruby
packageAdd
package=sudo
packageAdd
package=cdrtools
packageAdd
package=dvd+rw-tools
packageAdd
package=p5-XML-LibXML
packageAdd
# Handle post-install tasks (scripts, fix kernel, etc.)
command=/bin/sh /stand/postinstall.sh
system
# If you generate your own rc.conf in your post install script,
# uncomment this
keeprcconf=1
shutdown
% /stand/dodisk.sh
#!/bin/sh
########### Disk Partitioning script
Fetch variables
disk=`kenv -q install.disk`
swap=`kenv -q install.swap`
# Use the first disk device if one is not specified. Unfortunately at least
# ata disks are not listed in sorted order in kern.disks, so we cannot just
# use the first disk in the list. Instead, we walk the list using a string
# comparison to find the first disk.
if [ -z "\${disk}" ]; then
for d in `sysctl -n kern.disks`; do
if [ -z "\${disk}" -o "\${disk}" '>' "\$d" ]; then
disk=\$d
fi
done
fi
# Default swap to 8G
if [ -z "\${swap}" ]; then
swap="8G"
fi
# Compute swap size in 512-byte blocks
case $swap in
*[gG])
# Gigabytes
swap=\$((\${swap%[gG]} * 2 * 1024 * 1024))
;;
*[mM])
# Megabytes
swap=\$((\${swap%[mM]} * 2 * 1024))
;;
*[kK])
# Kilobytes
swap=\$((\${swap%[kK]} * 2))
esac
# Generate the config for the disk
cat > /stand/disk.cfg <<EOF
disk=\${disk}
partition=all
bootManager=standard
diskPartitionEditor
# 1 GB root
\${disk}s1-1=ufs 2097152 /
# swap
\${disk}s1-2=swap ${swap} none
# 1 GB var
\${disk}s1-3=ufs 2097152 /var 1
# rest to usr
\${disk}s1-4=ufs 0 /usr 1
diskLabelEditor
EOF
% /stand/preinstall.sh
#!/bin/sh
########### Preinstall Script
fetch -o /dev/null http://$server/cblr/svc/op/trig/mode/pre/system/$system_name
% /stand/postinstall.sh
#!/bin/sh
############ Postinstall script
# If we have a script and it is available, run it.
script=`kenv -q install.script`
if [ -n "${script}" ]; then
if [ -r "${script}" ]; then
/bin/sh ${script}
fi
fi
# Environment may be an issue: the install environment has very few
# tools
# Enable sshd
/bin/sh -c 'echo sshd_enable=\"YES\" > /etc/rc.conf'
# Set root passwd
/bin/sh -c 'echo alikeapple |pw mod user root -h 0'
# trigger post scripts
fetch -o /root/cobbler.ks http://$server/cblr/svc/op/ks/system/$system_name
fetch -o /dev/null http://$server/cblr/svc/op/trig/mode/post/system/$system_name
fetch -o /dev/null http://$server/cblr/svc/op/nopxe/system/$system_name
# Give me time to look around
#sleep 3600