2006-12-19 00:15:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# post.sh - to be done after extraction
|
|
|
|
#
|
2010-11-16 17:17:45 +01:00
|
|
|
# Copyright (c) 2010 SuSE Linux AG Nuernberg, Germany.
|
|
|
|
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# Run this script in C-Locale, or some tools will fail.
|
|
|
|
export LC_ALL=C
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
# to make sure, /var/lib/YaST/bin/bootsetup runs fine, delete
|
|
|
|
# /usr/lib/YaST/.configured2
|
|
|
|
test -e /usr/lib/YaST/.configured2 && rm -f /usr/lib/YaST/.configured2
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
|
|
|
# there are some installation with an etc/psdevtab, which is only readable
|
|
|
|
# for root - this slows ps for any other user. starting ps as root, creates
|
|
|
|
# it, when it doesn't exist (readable). So simply delete it.
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
test -e /etc/psdevtab && rm -f /etc/psdevtab
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
|
|
|
# if the old nsswitch.conf contains dns6, replace it with dns
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
test -f /etc/nsswitch.conf.rpmnew && grep dns6 /etc/nsswitch.conf >/dev/null 2>&1 && {
|
|
|
|
sed -i -e "s|dns6|dns|g" /etc/nsswitch.conf
|
2006-12-19 00:15:02 +01:00
|
|
|
}
|
|
|
|
# GMT might already be in sysconfig/clock
|
2010-09-10 15:43:26 +02:00
|
|
|
%{rename_sysconfig_variable -f /etc/sysconfig/clock GMT HWCLOCK}
|
2006-12-19 00:15:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Initialize runlevel links
|
|
|
|
#
|
2008-08-21 18:02:44 +02:00
|
|
|
%{fillup_and_insserv -y boot.proc boot.localfs boot.swap boot.clock boot.ldconfig boot.ipconfig boot.klog boot.localnet halt random reboot single}
|
2010-09-10 15:43:26 +02:00
|
|
|
%{insserv_force_if_yast /etc/init.d/boot.loadmodules /etc/init.d/boot.cleanup /etc/init.d/boot.rootfsck}
|
2006-12-19 00:15:02 +01:00
|
|
|
## powerfail probably needs empty header ...
|
|
|
|
|
|
|
|
# add Kill-links in boot.d if needed:
|
2010-03-08 18:09:43 +01:00
|
|
|
for i in proc localfs swap clock ldconfig ipconfig klog localnet loadmodules ; do
|
2006-12-19 00:15:02 +01:00
|
|
|
if [ -f /etc/init.d/boot.d/S??boot.$i -a ! -f /etc/init.d/boot.d/K??boot.$i ] ; then
|
|
|
|
%{insserv_force_if_yast boot.$i}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
%{remove_and_set -n security CONSOLE_SHUTDOWN}
|
|
|
|
%{remove_and_set -n suseconfig CHECK_INITTAB}
|
|
|
|
%{remove_and_set -n suseconfig HALT_SOUND}
|
|
|
|
|
2010-09-10 15:43:26 +02:00
|
|
|
if ! [ -d /etc/sysconfig ] ; then
|
|
|
|
mkdir -p /etc/sysconfig
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
|
|
|
for i in language backup boot kernel \
|
2007-05-31 20:44:28 +02:00
|
|
|
suseconfig clock proxy windowmanager sysctl \
|
2007-10-10 00:02:00 +02:00
|
|
|
cron news shutdown ; do
|
2006-12-19 00:15:02 +01:00
|
|
|
%{fillup_only -n $i}
|
|
|
|
done
|
|
|
|
# migrate HALT_SOUND value if set before
|
|
|
|
if [ -n "$HALT_SOUND" -a "$HALT_SOUND" != "no" ] ; then
|
2010-09-10 15:43:26 +02:00
|
|
|
sed -i -e "s|^HALT_SOUND=.*|HALT_SOUND=\"$HALT_SOUND\"|" /etc/sysconfig/shutdown
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
|
|
|
# fix sysconfig backup dir
|
2010-09-10 15:43:26 +02:00
|
|
|
if grep -q RCCONFIG_BACKUP_DIR../var/adm/backup/rpmdb /etc/sysconfig/backup; then
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e "s|^RCCONFIG_BACKUP_DIR=.*|RCCONFIG_BACKUP_DIR=\"/var/adm/backup/sysconfig\"|" \
|
2010-09-10 15:43:26 +02:00
|
|
|
/etc/sysconfig/backup
|
2006-12-19 00:15:02 +01:00
|
|
|
mkdir -p /var/adm/backup/sysconfig
|
|
|
|
mv /var/adm/backup/rpmdb/sysconfig[-_]* /var/adm/backup/sysconfig 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
2010-09-10 15:43:26 +02:00
|
|
|
if grep -q "SEND_OUTPUT_ON_NO_ERROR=\"yes\"" /etc/sysconfig/cron ; then
|
|
|
|
if test ! -f /var/adm/bnc_622203_fixed ; then
|
|
|
|
sed -i -e "s|^SEND_OUTPUT_ON_NO_ERROR=\"yes\"|SEND_OUTPUT_ON_NO_ERROR=\"no\"|" \
|
|
|
|
/etc/sysconfig/cron
|
|
|
|
touch /var/adm/bnc_622203_fixed
|
2010-08-27 22:57:24 +02:00
|
|
|
fi
|
|
|
|
fi
|
2006-12-19 00:15:02 +01:00
|
|
|
|
|
|
|
# clear old install settings of MODULES_LOADED_ON_BOOT
|
2010-09-10 15:43:26 +02:00
|
|
|
eval `grep "^MODULES_LOADED_ON_BOOT" /etc/sysconfig/kernel`
|
2006-12-19 00:15:02 +01:00
|
|
|
MLOB_NEW=""
|
|
|
|
for i in $MODULES_LOADED_ON_BOOT ; do
|
|
|
|
case $i in
|
|
|
|
capability|raw1394|video1394) continue ;;
|
|
|
|
esac
|
|
|
|
MLOB_NEW="$MLOB_NEW${MLOB_NEW:+ }$i"
|
|
|
|
done
|
|
|
|
if test "$MODULES_LOADED_ON_BOOT" != "$MLOB_NEW" ; then
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e "s|^MODULES_LOADED_ON_BOOT=.*|MODULES_LOADED_ON_BOOT=\"$MLOB_NEW\"|" \
|
2010-09-10 15:43:26 +02:00
|
|
|
/etc/sysconfig/kernel
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Backup gshadow file and remove it (merge passwords into
|
|
|
|
# /etc/group before).
|
|
|
|
#
|
|
|
|
if [ -f /etc/gshadow -a -x /usr/sbin/grpunconv ]; then
|
|
|
|
cp -p /etc/gshadow /etc/gshadow-`date "+%Y%m%d"`
|
|
|
|
chmod 600 /etc/gshadow-`date "+%Y%m%d"`
|
|
|
|
/usr/sbin/grpunconv
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# handle password files
|
|
|
|
#
|
|
|
|
for i in passwd group shadow ; do
|
2010-09-10 15:43:26 +02:00
|
|
|
test -e /var/adm/fillup-templates/$i.aaa_base || continue
|
2006-12-19 00:15:02 +01:00
|
|
|
echo -n "Updating etc/$i..."
|
2010-09-10 15:43:26 +02:00
|
|
|
if test -f /etc/$i ; then
|
|
|
|
cp /etc/$i /etc/$i.tmp
|
|
|
|
rm -f /etc/$i.add
|
|
|
|
sort -k 1,1 -t: -u /etc/$i /var/adm/fillup-templates/$i.aaa_base \
|
|
|
|
| sort -k 1,1 -t: /etc/$i - | uniq -u > /etc/$i.add
|
|
|
|
cat /etc/$i.add >> /etc/$i
|
|
|
|
rm -f /etc/$i.add
|
|
|
|
if cmp -s /etc/$i /etc/$i.tmp ; then
|
2006-12-19 00:15:02 +01:00
|
|
|
echo "unchanged"
|
|
|
|
else
|
|
|
|
echo "modified"
|
|
|
|
fi
|
2010-09-10 15:43:26 +02:00
|
|
|
rm -f /etc/$i.tmp
|
2006-12-19 00:15:02 +01:00
|
|
|
# If we have a NIS system, we have to make sure, that "^+" is at the end
|
2010-09-10 15:43:26 +02:00
|
|
|
grep -v "^+" /etc/$i > /etc/$i.tmp || :
|
|
|
|
grep "^+" /etc/$i >> /etc/$i.tmp || :
|
|
|
|
test -s /etc/$i.tmp && cat /etc/$i.tmp > /etc/$i
|
|
|
|
rm -f /etc/$i.tmp
|
2006-12-19 00:15:02 +01:00
|
|
|
else
|
2010-09-10 15:43:26 +02:00
|
|
|
cat /var/adm/fillup-templates/$i.aaa_base > /etc/$i
|
2006-12-19 00:15:02 +01:00
|
|
|
echo "new"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
# check/fix owner and permission of shadow files
|
2010-09-10 15:43:26 +02:00
|
|
|
for i in /etc/shadow ; do
|
2006-12-19 00:15:02 +01:00
|
|
|
chmod 640 $i
|
|
|
|
chgrp shadow $i
|
|
|
|
done
|
|
|
|
#
|
|
|
|
# Change primary group of nobody to nobody
|
|
|
|
#
|
|
|
|
if [ -x /usr/sbin/usermod ]; then
|
|
|
|
/usr/sbin/usermod -g nobody nobody 2> /dev/null ||:
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# create mtab if it does not exist
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
touch /etc/mtab
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
|
|
|
# make sure that several log files exist
|
|
|
|
#
|
2010-09-10 15:43:26 +02:00
|
|
|
if test ! -d /var/log ; then
|
|
|
|
mkdir -p /var/log
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
2010-11-18 13:49:58 +01:00
|
|
|
|
|
|
|
while read file owner mode; do
|
|
|
|
test -e "$file" || touch "$file"
|
|
|
|
chmod "$mode" "$file"
|
|
|
|
chown "$owner" "$file"
|
|
|
|
done <<EOT
|
|
|
|
/root/.bash_history root:root 600
|
|
|
|
/var/log/lastlog root:root 644
|
|
|
|
/var/log/faillog root:root 600
|
|
|
|
/var/log/wtmp root:utmp 664
|
|
|
|
/var/log/btmp root:root 600
|
|
|
|
/var/run/utmp root:utmp 664
|
|
|
|
EOT
|
2010-11-16 17:17:45 +01:00
|
|
|
|
2010-09-10 15:43:26 +02:00
|
|
|
if test -e /usr/sbin/usrdel.local -a ! -e /usr/sbin/userdel.local ; then
|
|
|
|
cp /usr/sbin/usrdel.local /usr/sbin/userdel.local
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
2010-09-10 15:43:26 +02:00
|
|
|
if test ! -e /usr/sbin/userdel.local ; then
|
|
|
|
mkdir -p /usr/sbin
|
|
|
|
cat << EOT > /usr/sbin/userdel.local
|
2006-12-19 00:15:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Here you can add your own stuff, that should be done for every user who
|
|
|
|
# will be deleted.
|
|
|
|
#
|
|
|
|
# When you delete a user with YaST, this script will be called
|
|
|
|
# with the login name as parameter. The rest of data can be taken
|
|
|
|
# from /etc/passwd.
|
|
|
|
#
|
|
|
|
EOT
|
2010-09-10 15:43:26 +02:00
|
|
|
chmod 744 /usr/sbin/userdel.local
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# change all /media mounts (subfs) to noauto
|
|
|
|
if test -f /etc/fstab ; then
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e '/^[[:space:]]*#/{p;d}' -e '/[[:space:]]subfs.*noauto/{p;d}' -e '/\/media.*fs=\(cdfss\|floppyfss\)/s/\([[:space:]]subfs[[:space:]][[:space:]]*\)/\1noauto,/' /etc/fstab
|
2006-12-19 00:15:02 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# IA64 Altix update hook
|
|
|
|
if test -d /proc/sgi_sn ; then
|
|
|
|
if grep -q "console=ttyS0" /etc/elilo.conf ; then
|
|
|
|
echo "replacing ttyS0 by ttySG0 in elilo.conf, inittab and securetty files"
|
|
|
|
#
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e "s/console=ttyS0/console=ttySG0/g" /etc/elilo.conf
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e "s/getty\(.*\)ttyS0/getty\1ttySG0/g" /etc/inittab
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
2009-07-30 17:51:56 +02:00
|
|
|
sed -i -e "s/ttyS0/ttySG0/g" /etc/securetty
|
2006-12-19 00:15:02 +01:00
|
|
|
#
|
|
|
|
if grep -q /boot/efi /proc/mounts ; then
|
|
|
|
echo "calling elilo to update"
|
|
|
|
/sbin/elilo || true
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|