Debian Codegraph @

lang/core/embedded/provisioner/files/kickstart.ks.tmpl

raw
1 {{ if .comment -}}
2 #
3 # {{ .comment }}
4 #
5 {{- end }}
6 #
7 # readme
8 #
9 # All of this is based on reading docs, experimentation, and the kickstarts repo
10 # at: https://pagure.io/fedora-kickstarts which I am not an expert at reading.
11 # If you have recommendations for improvements, please let us know! Thanks.
12 #
13 # flavour: {{ .flavour }}
14 # part: {{ .part }}
15 # bios: {{ .bios }}
16
17 #
18 # system
19 #
20 text # text based install (not graphical)
21 {{ if .lang -}}
22 {{- $length_minus1 := math_minus1 (len .lang | printf "%d" | golang_strconv_atoi ) -}}
23 lang {{ index .lang 0 }}
24 {{- if gt (len .lang) 1 }} --addsupport=
25 {{- range $i, $x := .lang -}}
26 {{ if eq $i 0 }}{{ continue }}{{ end }}
27 {{- $x -}}
28 {{- if lt $i $length_minus1 -}},{{- end -}}
29 {{- end -}}
30 {{- end -}}
31 {{- end }}
32 keyboard us
33 {{ if .timezone -}}
34 # System timezone
35 timezone {{ .timezone }} --isUtc
36 {{- if .ntp_servers }} --ntpservers={{ golang_strings_join .ntp_servers "," }}{{ end -}}
37 {{- end }}
38
39 #
40 # security
41 #
42 {{ if .password -}}
43 # password can be crypted with:
44 # python3 -c 'import crypt; print(crypt.crypt("password", crypt.mksalt(crypt.METHOD_SHA512)))'
45 # or
46 # openssl passwd -6 -salt <YOUR_SALT> (salt can be omitted to generate one)
47 rootpw --iscrypted --allow-ssh {{ .password }}
48 {{ else }}
49 rootpw --iscrypted --lock
50 {{- end }}
51 selinux --enforcing
52 services --enabled=sshd,NetworkManager,chronyd
53 {{ if .sshkeys -}}
54 # TODO: sort in a deterministic order
55 {{ range $user, $pubkey := .sshkeys -}}
56 sshkey --username {{ $user }} "{{ $pubkey }}"
57 {{- end -}}
58 {{- end }}
59
60 #
61 # networking
62 #
63 # --device=link
64 # specifies the first interface with its link in the up state
65 # --activate
66 # any matching devices beyond the first will also be activated
67 #
68 network --bootproto=dhcp --device=link --activate
69
70 firewall --enabled --service=mdns
71
72 #
73 # partitioning
74 #
75 # TODO: add more magic partitioning schemes
76 zerombr
77 clearpart --all --initlabel --disklabel={{ if .bios }}msdos{{ else }}gpt{{ end }}
78 {{ if eq .part "btrfs" -}}
79 autopart --type=btrfs --noswap
80 {{- else if eq .part "plain" -}}
81 autopart --type=plain
82 {{- else -}}
83 autopart --type=plain
84 {{- end }}
85
86 #
87 # repositories
88 #
89 {{ if .url -}}
90 url --url="{{ .url }}"
91 {{- end }}
92
93 {{ if .repos -}}
94 # TODO: sort in a deterministic order
95 {{- range $name, $baseurl := .repos }}
96 repo --name="{{ $name }}" --baseurl="{{ $baseurl }}"
97 {{- end }}
98 {{- end }}
99
100 #
101 # packages
102 #
103 %packages
104 @core
105 @standard
106 @hardware-support
107 {{ if eq .flavour "Workstation" -}}
108 # Packages for Workstation:
109 -initial-setup
110 -initial-setup-gui
111 gnome-initial-setup
112 #anaconda-webui
113 @base-x
114 @fonts
115 @input-methods
116 @multimedia
117 @printing
118 -@guest-desktop-agents
119 #initial-setup-gui
120 glibc-all-langpacks
121 -@dial-up
122 -@input-methods
123 -@standard
124 # Install workstation-product-environment to resolve RhBug:1891500
125 @^workstation-product-environment
126 # Exclude unwanted packages from @anaconda-tools group
127 -gfs2-utils
128 -reiserfs-utils
129 {{- else if eq .flavour "Server" -}}
130 # Packages for Server:
131 fedora-release-server
132 # install the default groups for the server environment since installing the environment is not working
133 @server-product
134 @headless-management
135 @networkmanager-submodules
136 @container-management
137 @domain-client
138 @guest-agents
139 @server-hardware-support
140 -initial-setup-gui
141 -generic-release*
142 {{- end }}
143 # User packages:
144 {{ range $i, $x := .packages -}}
145 {{ $x }}
146 {{ end -}}
147 %end
148
149 #
150 # misc
151 #
152 bootloader --timeout=1
153
154 # make sure that initial-setup runs and lets us do all the configuration bits
155 firstboot --reconfig
156
157 #
158 # flavour
159 #
160 {{ if eq .flavour "Workstation" -}}
161 %post
162 # Explicitly set graphical.target as default as this is how initial-setup detects which version to run
163 systemctl set-default graphical.target
164 %end
165 {{ else if eq .flavour "Server" -}}
166 %post
167 # setup systemd to boot to the right runlevel
168 echo -n "Setting default runlevel to multiuser text mode"
169 systemctl set-default multi-user.target
170 echo .
171 %end
172 {{ end -}}
173
174 #
175 # post
176 #
177 %post
178 {{ range $i, $x := .post -}}
179 {{ $x }}
180 {{ end -}}
181 %end
182
183 #
184 # reboot after installation
185 #
186 reboot