File config.sh of Package kiwi-templates-SLES15-JeOS (Revision eecb3a739da7e704f565ae1297229ef6)
Currently displaying revision eecb3a739da7e704f565ae1297229ef6 , Show latest
xxxxxxxxxx
1
2
# Copyright (c) 2015 SUSE LLC
3
#
4
# Permission is hereby granted, free of charge, to any person obtaining a copy
5
# of this software and associated documentation files (the "Software"), to deal
6
# in the Software without restriction, including without limitation the rights
7
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
# copies of the Software, and to permit persons to whom the Software is
9
# furnished to do so, subject to the following conditions:
10
#
11
# The above copyright notice and this permission notice shall be included in
12
# all copies or substantial portions of the Software.
13
#
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
# SOFTWARE.
21
#
22
#======================================
23
# Functions...
24
#--------------------------------------
25
test -f /.kconfig && . /.kconfig
26
test -f /.profile && . /.profile
27
28
# mkdir /var/lib/named
29
# mkdir /var/lib/pgsql
30
# mkdir /var/lib/mailman
31
# mkdir /boot/grub2/i386-pc
32
33
mkdir /var/lib/misc/reconfig_system
34
35
#======================================
36
# Greeting...
37
#--------------------------------------
38
echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..."
39
40
#======================================
41
# add missing fonts
42
#--------------------------------------
43
CONSOLE_FONT="eurlatgr.psfu"
44
45
#======================================
46
# prepare for setting root pw, timezone
47
#--------------------------------------
48
echo ** "reset machine settings"
49
sed -i 's/^root:[^:]*:/root:*:/' /etc/shadow
50
rm /etc/machine-id
51
rm /etc/localtime
52
rm /var/lib/zypp/AnonymousUniqueId
53
rm /var/lib/systemd/random-seed
54
55
#======================================
56
# SuSEconfig
57
#--------------------------------------
58
echo "** Running suseConfig..."
59
suseConfig
60
61
echo "** Running ldconfig..."
62
/sbin/ldconfig
63
64
#======================================
65
# Setup baseproduct link
66
#--------------------------------------
67
suseSetupProduct
68
69
#======================================
70
# Specify default runlevel
71
#--------------------------------------
72
baseSetRunlevel 3
73
74
#======================================
75
# Add missing gpg keys to rpm
76
#--------------------------------------
77
suseImportBuildKey
78
79
#======================================
80
# Enable DHCP on eth0
81
#--------------------------------------
82
cat >/etc/sysconfig/network/ifcfg-eth0 <<EOF
83
BOOTPROTO='dhcp'
84
MTU=''
85
REMOTE_IPADDR=''
86
STARTMODE='auto'
87
ETHTOOL_OPTIONS=''
88
USERCONTROL='no'
89
EOF
90
91
#======================================
92
# Firewall Configuration
93
#--------------------------------------
94
echo '** Configuring firewall...'
95
chkconfig firewalld on
96
97
#======================================
98
# Enable sshd
99
#--------------------------------------
100
chkconfig sshd on
101
102
#======================================
103
# Remove doc files
104
#--------------------------------------
105
baseStripDocs
106
107
#======================================
108
# remove rpms defined in config.xml in the image type=delete section
109
#--------------------------------------
110
baseStripRPM
111
112
#======================================
113
# Sysconfig Update
114
#--------------------------------------
115
echo '** Update sysconfig entries...'
116
# baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
117
if [ "${kiwi_profiles}" != "OpenStack-Cloud" ]; then
118
baseUpdateSysConfig /etc/sysconfig/network/dhcp DHCLIENT_SET_HOSTNAME yes
119
fi
120
121
# Systemd controls the console font now
122
echo FONT="$CONSOLE_FONT" >> /etc/vconsole.conf
123
124
#======================================
125
# SSL Certificates Configuration
126
#--------------------------------------
127
echo '** Rehashing SSL Certificates...'
128
update-ca-certificates
129
130
if [ ! -s /var/log/zypper.log ]; then
131
> /var/log/zypper.log
132
fi
133
134
#======================================
135
# Import trusted rpm keys
136
#--------------------------------------
137
for i in /usr/lib/rpm/gnupg/keys/gpg-pubkey*asc; do
138
# importing can fail if it already exists
139
rpm --import $i || true
140
done
141
142
# only for debugging
143
#systemctl enable debug-shell.service
144
145
#=====================================
146
# Configure snapper
147
#-------------------------------------
148
if [ "$kiwi_btrfs_root_is_snapshot" = 'true' ]; then
149
echo "creating initial snapper config ..."
150
# we can't call snapper here as the .snapshots subvolume
151
# already exists and snapper create-config doens't like
152
# that.
153
cp /etc/snapper/config-templates/default /etc/snapper/configs/root
154
# Change configuration to match SLES12-SP1 values
155
sed -i -e '/^TIMELINE_CREATE=/s/yes/no/' /etc/snapper/configs/root
156
sed -i -e '/^NUMBER_LIMIT=/s/50/10/' /etc/snapper/configs/root
157
158
baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
159
fi
160
161
#=====================================
162
# Enable chrony if installed
163
#-------------------------------------
164
if [ -f /etc/chrony.conf ]; then
165
suseInsertService chronyd
166
for i in 0 1 2 3; do
167
echo "server $i.opensuse.pool.ntp.org iburst"
168
done > /etc/chrony.d/opensuse.conf
169
fi
170
171
#======================================
172
# Configure system for IceWM usage
173
#--------------------------------------
174
# XXX remove explicit RPi mentioning
175
if [[ "$kiwi_profiles" == *"X11"* ]] || [[ "$kiwi_profiles" == *"RaspberryPi"* ]]; then
176
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER xdm
177
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER_STARTS_XSERVER yes
178
baseUpdateSysConfig /etc/sysconfig/windowmanager DEFAULT_WM icewm
179
180
# We want to start in gfx mode
181
baseSetRunlevel 5
182
suseConfig
183
fi
184
185
#======================================
186
# Disable recommends on virtual images (keep hardware supplements, see bsc#1089498)
187
#--------------------------------------
188
if [[ "$kiwi_profiles" != *"RaspberryPi"* ]]; then
189
sed -i 's/.*solver.onlyRequires.*/solver.onlyRequires = true/g' /etc/zypp/zypp.conf
190
fi
191
192
#======================================
193
# Disable installing documentation
194
#--------------------------------------
195
sed -i 's/.*rpm.install.excludedocs.*/rpm.install.excludedocs = yes/g' /etc/zypp/zypp.conf
196
197
#======================================
198
# Configure Raspberry Pi specifics
199
#--------------------------------------
200
if [[ "$kiwi_profiles" == *"RaspberryPi"* ]]; then
201
# Add necessary kernel modules to initrd (will disappear with bsc#1084272)
202
echo 'add_drivers+=" bcm2835_dma dwc2 "' > /etc/dracut.conf.d/raspberrypi_modules.conf
203
204
# Work around HDMI connector bug and network issues
205
cat > /etc/modprobe.d/50-rpi3.conf <<-EOF
206
# No HDMI hotplug available
207
options drm_kms_helper poll=0
208
# Prevent too many page allocations (bsc#1012449)
209
options smsc95xx turbo_mode=N
210
EOF
211
212
cat > /usr/lib/sysctl.d/50-rpi3.conf <<-EOF
213
# Avoid running out of DMA pages for smsc95xx (bsc#1012449)
214
vm.min_free_kbytes = 2048
215
EOF
216
217
# Do network configuration via yast2-firstboot
218
rm -f /etc/sysconfig/network/ifcfg-eth0
219
220
# Make sure the netconfig md5 files are correct
221
netconfig update -f
222
fi
223
224
##
225
baseCleanMount
226
227
exit 0
228