Debian Codegraph @

contrib/drivers/k8s_opensuse_v1/image/config.sh

raw
1 #!/bin/bash
2 #================
3 # FILE : config.sh
4 #----------------
5 # PROJECT : openSUSE KIWI Image System
6 # COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
7 # :
8 # AUTHOR : Marcus Schaefer <[email protected]>
9 # :
10 # BELONGS TO : Operating System images
11 # :
12 # DESCRIPTION : configuration script for SUSE based
13 # : operating systems
14 # :
15 # :
16 # STATUS : BETA
17 #----------------
18 #======================================
19 # Functions...
20 #--------------------------------------
21 test -f /.kconfig && . /.kconfig
22 test -f /.profile && . /.profile
23
24 mkdir /var/lib/misc/reconfig_system
25
26 #======================================
27 # Greeting...
28 #--------------------------------------
29 echo "Configure image: [$name]..."
30
31 #======================================
32 # add missing fonts
33 #--------------------------------------
34 CONSOLE_FONT="lat9w-16.psfu"
35
36 #======================================
37 # prepare for setting root pw, timezone
38 #--------------------------------------
39 echo ** "reset machine settings"
40 sed -i 's/^root:[^:]*:/root:*:/' /etc/shadow
41 rm /etc/machine-id
42 rm /etc/localtime
43 rm /var/lib/zypp/AnonymousUniqueId
44 rm /var/lib/systemd/random-seed
45
46 #======================================
47 # SuSEconfig
48 #--------------------------------------
49 echo "** Running suseConfig..."
50 suseConfig
51
52 echo "** Running ldconfig..."
53 /sbin/ldconfig
54
55 #======================================
56 # Setup baseproduct link
57 #--------------------------------------
58 suseSetupProduct
59
60 #======================================
61 # Specify default runlevel
62 #--------------------------------------
63 baseSetRunlevel 3
64
65 #======================================
66 # Add missing gpg keys to rpm
67 #--------------------------------------
68 suseImportBuildKey
69
70 #======================================
71 # Firewall Configuration
72 #--------------------------------------
73 echo '** Configuring firewall...'
74 chkconfig SuSEfirewall2_init on
75 chkconfig SuSEfirewall2_setup on
76
77 #======================================
78 # Enable sshd
79 #--------------------------------------
80 chkconfig sshd on
81
82 #======================================
83 # Remove doc files
84 #--------------------------------------
85 baseStripDocs
86
87 #======================================
88 # remove rpms defined in config.xml in the image type=delete section
89 #--------------------------------------
90 baseStripRPM
91
92 #======================================
93 # Sysconfig Update
94 #--------------------------------------
95 echo '** Update sysconfig entries...'
96 baseUpdateSysConfig /etc/sysconfig/SuSEfirewall2 FW_CONFIGURATIONS_EXT sshd
97 baseUpdateSysConfig /etc/sysconfig/console CONSOLE_FONT "$CONSOLE_FONT"
98 # baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
99 if [[ "${kiwi_iname}" != *"OpenStack"* ]]; then
100 baseUpdateSysConfig /etc/sysconfig/network/dhcp DHCLIENT_SET_HOSTNAME yes
101 fi
102
103 # true
104 #======================================
105 # SSL Certificates Configuration
106 #--------------------------------------
107 echo '** Rehashing SSL Certificates...'
108 update-ca-certificates
109
110 if [ ! -s /var/log/zypper.log ]; then
111 > /var/log/zypper.log
112 fi
113
114 # only for debugging
115 #systemctl enable debug-shell.service
116
117 baseCleanMount
118
119 exit 0