forked from openSUSE/aaa_base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaa_base.pre
239 lines (233 loc) · 6.7 KB
/
aaa_base.pre
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
#!/bin/bash
#
# Run this script in C-Locale, or some tools will fail.
export LC_ALL=C
# /boot should be the first directory. This increases the probability, that
# lilo stuff lies before 1024 cyl.
mkdir -p boot
#
# make sure, tmp directories do exist
#
for i in /tmp /var/tmp ; do
test -d $i || {
if test -L $i ; then
echo "Error! $i is a dangling symlink."
echo
ls -l $i
echo
echo "To avoid big problems this link has to be deleted and a directory"
echo "will be created. Remember to fix it after installation."
echo
rm -f $i
elif test -f $i ; then
echo "$i is a file. This makes no sense. Moving it to $i.save."
mv -v $i $i.save
fi
mkdir -p $i
}
done
#
# now create a var/adm/fillup-templates/passwd.aaa_base.
# If etc/passwd does not exist, copy
# var/adm/fillup-templates/passwd.aaa_base to etc/passwd.
# deleted db2 groups and users were uids 46,47,48 and gids 46,47,48
#
mkdir -p /etc
mkdir -p /var/adm/fillup-templates
echo "root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash
mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false
news:x:9:13:News system:/etc/news:/bin/bash
uucp:x:10:14:Unix-to-Unix CoPy system:/etc/uucp:/bin/bash
games:x:12:100:Games account:/var/games:/bin/bash
man:x:13:62:Manual pages viewer:/var/cache/man:/bin/bash
wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false
ftp:x:40:49:FTP account:/srv/ftp:/bin/bash
nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash" \
> /var/adm/fillup-templates/passwd.aaa_base
echo "root:x:0:
bin:x:1:daemon
daemon:x:2:
sys:x:3:
tty:x:5:
disk:x:6:
lp:x:7:
www:x:8:
kmem:x:9:
wheel:x:10:
mail:x:12:
news:x:13:
uucp:x:14:
shadow:x:15:
dialout:x:16:
audio:x:17:
floppy:x:19:
cdrom:x:20:
console:x:21:
utmp:x:22:
public:x:32:
video:x:33:
games:x:40:
xok:x:41:
trusted:x:42:
modem:x:43:
ftp:x:49:
lock:x:54:
man:x:62:
users:x:100:
nobody:x:65533:
nogroup:x:65534:nobody" > /var/adm/fillup-templates/group.aaa_base
rm -f /var/adm/fillup-templates/shadow.aaa_base
while read LINE ; do
case $LINE in
root*)
echo "root::$(($(date '+%s')/86400))::::::" \
>> /var/adm/fillup-templates/shadow.aaa_base
;;
*)
echo "${LINE%%%%:*}:*:$(($(date '+%s')/86400))::::::" \
>> /var/adm/fillup-templates/shadow.aaa_base
;;
esac
done < /var/adm/fillup-templates/passwd.aaa_base
for file in passwd group ; do
if test -f /etc/$file ; then
# like fillup, but : is the only separator
rm -f /etc/$file.add
sort -k 1,1 -t: -u /etc/$file /var/adm/fillup-templates/$file.aaa_base \
| sort -k 1,1 -t: /etc/$file - | uniq -u > /etc/$file.add
cat /etc/$file.add >> /etc/$file
rm -f /etc/$file.add
# fix permissions if this script is called with strange umask
chmod 644 /etc/$file
else
cat /var/adm/fillup-templates/$file.aaa_base > /etc/$file
fi
done
#
# we have several local files, that changed over the time. Check the
# existing one, if they contain real data. If not, delete them.
#
for LOCALFILE in /root/bin/cron.daily.local \
/etc/init.d/boot.local \
/etc/init.d/after.local \
/etc/init.d/before.local \
/etc/init.d/halt.local \
/usr/sbin/usradd.local \
/usr/sbin/usrdel.local \
/usr/sbin/userdel.local ; do
test -f $LOCALFILE || continue
LOCALFILE_CONTAINS_DATA=false
while read LINE ; do
case "$LINE" in
"#"*)
;;
"echo "*">"*)
LOCALFILE_CONTAINS_DATA=true
;;
"echo "*)
;;
". /etc/rc.config")
;;
"exit "*)
;;
"")
;;
*)
LOCALFILE_CONTAINS_DATA=true
;;
esac
done < $LOCALFILE
test "$LOCALFILE_CONTAINS_DATA" = false && rm -f $LOCALFILE
done
mkdir -p /etc/init.d
echo "#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
#
# Author: Werner Fink, 1996
# Burchard Steinbild, 1996
#
# /etc/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
# Here you should add things, that should happen directly after booting
# before we're going to the first run level.
#
" > /etc/init.d/boot.local.new
test -e /etc/init.d/boot.local || mv /etc/init.d/boot.local.new /etc/init.d/boot.local
rm -f /etc/init.d/boot.local.new
chmod 744 /etc/init.d/boot.local
echo "#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
#
# Author: Werner Fink, 1998
# Burchard Steinbild, 1998
#
# /etc/init.d/halt.local
#
# script with local commands to be executed from init on system shutdown
#
# Here you should add things, that should happen directly before shuting
# down.
#
" > /etc/init.d/halt.local.new
test -e /etc/init.d/halt.local || mv /etc/init.d/halt.local.new /etc/init.d/halt.local
rm -f /etc/init.d/halt.local.new
chmod 744 /etc/init.d/halt.local
echo "#! /bin/sh
#
# Copyright (c) 2010 SuSE LINUX Products GmbH, Germany. All rights reserved.
#
# Author: Werner Fink, 2010
#
# /etc/init.d/before.local
#
# script with local commands to be executed from init before executing
# any script of a runlevel.
#
# Here you should add things, that should happen directly before entering
# a runlevel. Common environment variables for this are:
# RUNLEVEL -- The current system runlevel.
# PREVLEVEL -- The previous runlevel (useful after a runlevel switch).
#
" > /etc/init.d/before.local.new
test -e /etc/init.d/before.local || mv /etc/init.d/before.local.new /etc/init.d/before.local
rm -f /etc/init.d/before.local.new
chmod 744 /etc/init.d/before.local
echo "#! /bin/sh
#
# Copyright (c) 2010 SuSE LINUX Products GmbH, Germany. All rights reserved.
#
# Author: Werner Fink, 2010
#
# /etc/init.d/after.local
#
# script with local commands to be executed from init after all scripts
# of a runlevel have been executed.
#
# Here you should add things, that should happen directly after
# runlevel has been reached. Common environment
# variables for this are:
# RUNLEVEL -- The current system runlevel.
# PREVLEVEL -- The previous runlevel (useful after a runlevel switch).
#
" > /etc/init.d/after.local.new
test -e /etc/init.d/after.local || mv /etc/init.d/after.local.new /etc/init.d/after.local
rm -f /etc/init.d/after.local.new
chmod 744 /etc/init.d/after.local
mkdir -p /etc
for LINK in /usr/X11R6/lib/X11 /var/X11R6/lib/fonts /usr/lib/mgetty+sendfax \
/usr/man/cat? /usr/X11R6/man/cat? /usr/openwin/man/cat? /usr/lib/news ; do
if test -L $LINK ; then
echo "Found forbidden/oldish Link: $LINK ...deleting"
rm -f $LINK
fi
done
if test -f /root/.gnupg/secring.gpg ; then
cp -a /root/.gnupg/secring.gpg /root/.gnupg/secring.gpg.aaa_save
fi