2006-12-19 00:15:02 +01:00
|
|
|
#!/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
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
for i in /tmp /var/tmp ; do
|
2006-12-19 00:15:02 +01:00
|
|
|
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
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
mkdir -p /etc
|
|
|
|
mkdir -p /var/adm/fillup-templates
|
2006-12-19 00:15:02 +01:00
|
|
|
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" \
|
2010-09-10 15:43:26 +02:00
|
|
|
> /var/adm/fillup-templates/passwd.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
|
|
|
|
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:
|
2010-03-12 14:42:08 +01:00
|
|
|
lock:x:54:
|
2006-12-19 00:15:02 +01:00
|
|
|
man:x:62:
|
|
|
|
users:x:100:
|
|
|
|
nobody:x:65533:
|
2010-09-10 15:43:26 +02:00
|
|
|
nogroup:x:65534:nobody" > /var/adm/fillup-templates/group.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
|
2010-09-10 15:43:26 +02:00
|
|
|
rm -f /var/adm/fillup-templates/shadow.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
while read LINE ; do
|
|
|
|
case $LINE in
|
|
|
|
root*)
|
|
|
|
echo "root::$(($(date '+%s')/86400))::::::" \
|
2010-09-10 15:43:26 +02:00
|
|
|
>> /var/adm/fillup-templates/shadow.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "${LINE%%%%:*}:*:$(($(date '+%s')/86400))::::::" \
|
2010-09-10 15:43:26 +02:00
|
|
|
>> /var/adm/fillup-templates/shadow.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
;;
|
|
|
|
esac
|
2010-09-10 15:43:26 +02:00
|
|
|
done < /var/adm/fillup-templates/passwd.aaa_base
|
2006-12-19 00:15:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
for file in passwd group ; do
|
2010-09-10 15:43:26 +02:00
|
|
|
if test -f /etc/$file ; then
|
2006-12-19 00:15:02 +01:00
|
|
|
# like fillup, but : is the only separator
|
2010-09-10 15:43:26 +02:00
|
|
|
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
|
2006-12-19 00:15:02 +01:00
|
|
|
# fix permissions if this script is called with strange umask
|
2010-09-10 15:43:26 +02:00
|
|
|
chmod 644 /etc/$file
|
2006-12-19 00:15:02 +01:00
|
|
|
else
|
2010-09-10 15:43:26 +02:00
|
|
|
cat /var/adm/fillup-templates/$file.aaa_base > /etc/$file
|
2006-12-19 00:15:02 +01:00
|
|
|
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.
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
for LOCALFILE in /root/bin/cron.daily.local \
|
|
|
|
/etc/init.d/boot.local \
|
2010-12-16 12:36:30 +01:00
|
|
|
/etc/init.d/after.local \
|
|
|
|
/etc/init.d/before.local \
|
2010-09-10 15:43:26 +02:00
|
|
|
/etc/init.d/halt.local \
|
|
|
|
/usr/sbin/usradd.local \
|
|
|
|
/usr/sbin/usrdel.local \
|
|
|
|
/usr/sbin/userdel.local ; do
|
2006-12-19 00:15:02 +01:00
|
|
|
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
|
2010-09-10 15:43:26 +02:00
|
|
|
mkdir -p /etc/init.d
|
2006-12-19 00:15:02 +01:00
|
|
|
echo "#! /bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
|
|
|
|
#
|
2010-12-16 12:36:30 +01:00
|
|
|
# Author: Werner Fink, 1996
|
2006-12-19 00:15:02 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
" > /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
|
2006-12-19 00:15:02 +01:00
|
|
|
echo "#! /bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
|
|
|
|
#
|
2010-12-16 12:36:30 +01:00
|
|
|
# Author: Werner Fink, 1998
|
2006-12-19 00:15:02 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
" > /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
|
2010-12-16 12:36:30 +01:00
|
|
|
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
|
2010-09-10 15:43:26 +02:00
|
|
|
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
|
2006-12-19 00:15:02 +01:00
|
|
|
if test -L $LINK ; then
|
|
|
|
echo "Found forbidden/oldish Link: $LINK ...deleting"
|
|
|
|
rm -f $LINK
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-01-23 21:53:07 +01:00
|
|
|
if test -f /root/.gnupg/secring.gpg ; then
|
|
|
|
cp -a /root/.gnupg/secring.gpg /root/.gnupg/secring.gpg.aaa_save
|
|
|
|
fi
|