forked from pool/aaa_base
Accepting request 64548 from Base:System
Accepted submit request 64548 from user elvigia OBS-URL: https://build.opensuse.org/request/show/64548 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/aaa_base?expand=0&rev=277
This commit is contained in:
parent
036d27e646
commit
a6e86f7d1e
@ -1,8 +1,18 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 17 16:21:06 UTC 2011 - lnussel@suse.de
|
||||
|
||||
- add scripts to make tarball
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 11 12:14:00 CET 2011 - werner@suse.de
|
||||
|
||||
- Avoid to trap into execute escapes (bnc#678827)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 9 15:49:56 UTC 2011 - lnussel@suse.de
|
||||
|
||||
- sources are maintained in git now. Adopt package accordingly.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 7 12:27:48 CET 2011 - ro@suse.de
|
||||
|
||||
|
209
aaa_base.post
209
aaa_base.post
@ -1,209 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# post.sh - to be done after extraction
|
||||
#
|
||||
# Copyright (c) 2010 SuSE Linux AG Nuernberg, Germany.
|
||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
#
|
||||
# Run this script in C-Locale, or some tools will fail.
|
||||
export LC_ALL=C
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
test -e /etc/psdevtab && rm -f /etc/psdevtab
|
||||
#
|
||||
# if the old nsswitch.conf contains dns6, replace it with dns
|
||||
#
|
||||
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
|
||||
}
|
||||
# GMT might already be in sysconfig/clock
|
||||
%{rename_sysconfig_variable -f /etc/sysconfig/clock GMT HWCLOCK}
|
||||
|
||||
#
|
||||
# Initialize runlevel links
|
||||
#
|
||||
%{fillup_and_insserv -y boot.proc boot.localfs boot.swap boot.clock boot.ldconfig boot.ipconfig boot.klog boot.localnet halt random reboot single}
|
||||
%{insserv_force_if_yast /etc/init.d/boot.loadmodules /etc/init.d/boot.cleanup /etc/init.d/boot.rootfsck}
|
||||
## powerfail probably needs empty header ...
|
||||
|
||||
# add Kill-links in boot.d if needed:
|
||||
for i in proc localfs swap clock ldconfig ipconfig klog localnet loadmodules ; do
|
||||
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}
|
||||
|
||||
if ! [ -d /etc/sysconfig ] ; then
|
||||
mkdir -p /etc/sysconfig
|
||||
fi
|
||||
for i in language backup boot kernel \
|
||||
suseconfig clock proxy windowmanager sysctl \
|
||||
cron news shutdown ; do
|
||||
%{fillup_only -n $i}
|
||||
done
|
||||
# migrate HALT_SOUND value if set before
|
||||
if [ -n "$HALT_SOUND" -a "$HALT_SOUND" != "no" ] ; then
|
||||
sed -i -e "s|^HALT_SOUND=.*|HALT_SOUND=\"$HALT_SOUND\"|" /etc/sysconfig/shutdown
|
||||
fi
|
||||
# fix sysconfig backup dir
|
||||
if grep -q RCCONFIG_BACKUP_DIR../var/adm/backup/rpmdb /etc/sysconfig/backup; then
|
||||
sed -i -e "s|^RCCONFIG_BACKUP_DIR=.*|RCCONFIG_BACKUP_DIR=\"/var/adm/backup/sysconfig\"|" \
|
||||
/etc/sysconfig/backup
|
||||
mkdir -p /var/adm/backup/sysconfig
|
||||
mv /var/adm/backup/rpmdb/sysconfig[-_]* /var/adm/backup/sysconfig 2>/dev/null
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
# clear old install settings of MODULES_LOADED_ON_BOOT
|
||||
eval `grep "^MODULES_LOADED_ON_BOOT" /etc/sysconfig/kernel`
|
||||
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
|
||||
sed -i -e "s|^MODULES_LOADED_ON_BOOT=.*|MODULES_LOADED_ON_BOOT=\"$MLOB_NEW\"|" \
|
||||
/etc/sysconfig/kernel
|
||||
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
|
||||
test -e /var/adm/fillup-templates/$i.aaa_base || continue
|
||||
echo -n "Updating etc/$i..."
|
||||
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
|
||||
echo "unchanged"
|
||||
else
|
||||
echo "modified"
|
||||
fi
|
||||
rm -f /etc/$i.tmp
|
||||
# If we have a NIS system, we have to make sure, that "^+" is at the end
|
||||
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
|
||||
else
|
||||
cat /var/adm/fillup-templates/$i.aaa_base > /etc/$i
|
||||
echo "new"
|
||||
fi
|
||||
done
|
||||
# check/fix owner and permission of shadow files
|
||||
for i in /etc/shadow ; do
|
||||
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
|
||||
#
|
||||
if test ! -e /etc/mtab; then
|
||||
ln -sf /proc/self/mounts /etc/mtab
|
||||
fi
|
||||
#
|
||||
# make sure that several log files exist
|
||||
#
|
||||
if test ! -d /var/log ; then
|
||||
mkdir -p /var/log
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
if test -e /usr/sbin/usrdel.local -a ! -e /usr/sbin/userdel.local ; then
|
||||
cp /usr/sbin/usrdel.local /usr/sbin/userdel.local
|
||||
fi
|
||||
if test ! -e /usr/sbin/userdel.local ; then
|
||||
mkdir -p /usr/sbin
|
||||
cat << EOT > /usr/sbin/userdel.local
|
||||
#!/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
|
||||
chmod 744 /usr/sbin/userdel.local
|
||||
fi
|
||||
|
||||
# change all /media mounts (subfs) to noauto
|
||||
if test -f /etc/fstab ; then
|
||||
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
|
||||
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"
|
||||
#
|
||||
sed -i -e "s/console=ttyS0/console=ttySG0/g" /etc/elilo.conf
|
||||
#
|
||||
sed -i -e "s/getty\(.*\)ttyS0/getty\1ttySG0/g" /etc/inittab
|
||||
#
|
||||
sed -i -e "s/ttyS0/ttySG0/g" /etc/securetty
|
||||
#
|
||||
if grep -q /boot/efi /proc/mounts ; then
|
||||
echo "calling elilo to update"
|
||||
/sbin/elilo || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
239
aaa_base.pre
239
aaa_base.pre
@ -1,239 +0,0 @@
|
||||
#!/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
|
@ -24,6 +24,7 @@ Version: 11.5
|
||||
Release: 2
|
||||
License: GPLv2+
|
||||
Group: System/Fhs
|
||||
Url: http://gitorious.org/opensuse/aaa_base
|
||||
Provides: bin bootutls etc skeleng skelger
|
||||
Provides: aaa_skel = %{version}-%{release}
|
||||
Obsoletes: aaa_skel < %{version}
|
||||
@ -33,13 +34,9 @@ PreReq: /usr/bin/sed /usr/bin/grep /bin/mv /bin/cat /bin/ls /bin/date /u
|
||||
AutoReqProv: on
|
||||
Summary: SUSE Linux Base Package
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
# run make package in checkout out git repo to recreate
|
||||
Source: aaa_base.tar.bz2
|
||||
Source5: arch_special.tar.bz2
|
||||
Source7: sysconfig_parts.tar.bz2
|
||||
Source8: get_kernel_version.c
|
||||
Source20: aaa_base-rpmlintrc
|
||||
Source21: aaa_base.pre
|
||||
Source22: aaa_base.post
|
||||
Source99: aaa_base-rpmlintrc
|
||||
|
||||
%description
|
||||
This package installs several important configuration files. Central
|
||||
@ -58,50 +55,30 @@ strictly required to run a system. (Shell aliases, bash completions
|
||||
and convenience hacks).
|
||||
|
||||
%prep
|
||||
%setup -n aaa_base -b 5 -b 7
|
||||
|
||||
cd ..
|
||||
mkdir -p scripts
|
||||
cp -v %{SOURCE21} scripts
|
||||
cp -v %{SOURCE22} scripts
|
||||
|
||||
cd $RPM_SOURCE_DIR
|
||||
%setup -n aaa_base
|
||||
|
||||
%build
|
||||
gcc -Wl,-z,relro,-z,now $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 $RPM_SOURCE_DIR/get_kernel_version.c -o $RPM_SOURCE_DIR/get_kernel_version
|
||||
make CFLAGS="$RPM_OPT_FLAGS"
|
||||
if test -d patches/$RPM_ARCH; then
|
||||
pushd files
|
||||
for file in ../patches/$RPM_ARCH/*; do
|
||||
patch -p0 --input=$file
|
||||
done
|
||||
find -name "*.orig" | xargs -r rm
|
||||
popd
|
||||
fi
|
||||
|
||||
%install
|
||||
install -d -m 700 root
|
||||
#
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
#
|
||||
# make sure it does not creep in again
|
||||
test -d ../aaa_base/root/.gnupg && exit 1
|
||||
cp -a ../aaa_base/* $RPM_BUILD_ROOT
|
||||
test -d $RPM_BUILD_ROOT/root/.gnupg && exit 1
|
||||
#
|
||||
# for the release
|
||||
%if !%{with aaa_base_malloc_debug}
|
||||
rm $RPM_BUILD_ROOT/etc/profile.d/malloc-debug.*
|
||||
%endif
|
||||
cp $RPM_SOURCE_DIR/get_kernel_version $RPM_BUILD_ROOT/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
|
||||
for i in $RPM_BUILD_DIR/sysconfig_parts/sysconfig.* ; do
|
||||
cp $i $RPM_BUILD_ROOT/var/adm/fillup-templates/
|
||||
done
|
||||
#
|
||||
## do arch specific patches BEGIN
|
||||
#
|
||||
pushd $RPM_BUILD_ROOT
|
||||
test -d $RPM_BUILD_DIR/arch_special/$RPM_ARCH && \
|
||||
{
|
||||
for file in $RPM_BUILD_DIR/arch_special/$RPM_ARCH/* ; do
|
||||
patch -p0 --input=$file
|
||||
done
|
||||
}
|
||||
#
|
||||
# delete .orig files
|
||||
#
|
||||
find $RPM_BUILD_ROOT -name "*.orig" | xargs -r rm
|
||||
popd
|
||||
#
|
||||
## do arch specific patches END
|
||||
#
|
||||
#
|
||||
# mark these as ghost
|
||||
for i in passwd group shadow gshadow ; do
|
||||
@ -111,9 +88,9 @@ done
|
||||
# loop module auto loading bnc#661715
|
||||
mkdir -p $RPM_BUILD_ROOT/lib/udev/devices
|
||||
|
||||
%pre -f ../scripts/aaa_base.pre
|
||||
%pre -f aaa_base.pre
|
||||
|
||||
%post -f ../scripts/aaa_base.post
|
||||
%post -f aaa_base.post
|
||||
|
||||
%postun
|
||||
%insserv_cleanup
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:49bef2ba91c8488afe314ba6d5fb2f0be86efe703a6c8a5f14ceb06cb5523221
|
||||
size 82436
|
||||
oid sha256:c82764a4f4499a7afc53f3decf85cb650eea39ad4d093f5421651f212f2c735f
|
||||
size 94119
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f2aff04f7283a5cf3c314098170bc03979b4bb8eaec86a20b795b42ae179239f
|
||||
size 1403
|
@ -1,192 +0,0 @@
|
||||
/* Copyright (C) 2000-2002 SuSE Linux AG, Nuremberg.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static inline int my_is_alnum_punct(char c)
|
||||
{
|
||||
return isdigit(c) || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
||||
|| c == '.' || c == ',' || c == '-' || c == '_' || c == '+';
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
#define MAX_VERSION_LENGTH 80
|
||||
char buffer[4096 + MAX_VERSION_LENGTH]; /* buffer + sizeof ("Linux version .....") */
|
||||
char command[512] = "";
|
||||
int found = 0;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
char msg[] = "usage: get_kernel_version <kernel_image>\n";
|
||||
write (2, msg, sizeof (msg));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* check if file exist and is compressed */
|
||||
{
|
||||
unsigned char buf [2];
|
||||
int fd = open (argv[1], O_RDONLY | O_CLOEXEC);
|
||||
if (fd == -1)
|
||||
{
|
||||
fprintf (stderr, "Cannot open kernel image \"%s\"\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (read (fd, buf, 2) != 2)
|
||||
{
|
||||
fprintf (stderr, "Short read\n");
|
||||
close (fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (buf [0] == 037 && (buf [1] == 0213 || buf [1] == 0236))
|
||||
{
|
||||
snprintf (command, sizeof (command), "/bin/gzip -dc %s 2>/dev/null", argv[1]);
|
||||
fp = popen (command, "re");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: faild\n", command);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fopen (argv[1],"re");
|
||||
}
|
||||
close (fd);
|
||||
}
|
||||
|
||||
memset (buffer, 0, sizeof (buffer));
|
||||
|
||||
|
||||
while (!found)
|
||||
{
|
||||
ssize_t in;
|
||||
int i;
|
||||
|
||||
in = fread (&buffer[MAX_VERSION_LENGTH],
|
||||
1, sizeof (buffer) - MAX_VERSION_LENGTH, fp);
|
||||
|
||||
if (in <= 0)
|
||||
break;
|
||||
for (i = 0; i < in; i++)
|
||||
if (buffer[i] == 'L' && buffer[i+1] == 'i' &&
|
||||
buffer[i+2] == 'n' && buffer[i+3] == 'u' &&
|
||||
buffer[i+4] == 'x' && buffer[i+5] == ' ' &&
|
||||
buffer[i+6] == 'v' && buffer[i+7] == 'e' &&
|
||||
buffer[i+8] == 'r' && buffer[i+9] == 's' &&
|
||||
buffer[i+10] == 'i' && buffer[i+11] == 'o' &&
|
||||
buffer[i+12] == 'n' && buffer[i+13] == ' ')
|
||||
{
|
||||
int j = i+14;
|
||||
int invalid_char = 0;
|
||||
int number_dots = 0;
|
||||
|
||||
/* check if we really found a version */
|
||||
for (j = j+1; buffer[j] != ' '; j++)
|
||||
{
|
||||
char c = buffer[j];
|
||||
|
||||
if (c == '.') {
|
||||
number_dots++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((number_dots < 2) && !isdigit(c)) ||
|
||||
((number_dots >= 2) && !my_is_alnum_punct(c)))
|
||||
{
|
||||
//invalid_char = 1;
|
||||
printf("invalid=1 for %c\n", c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!invalid_char)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
int j;
|
||||
for (j = i+14; buffer[j] != ' '; j++);
|
||||
buffer[j] = '\0';
|
||||
printf ("%s\n", &buffer[i+14]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in < (ssize_t)(sizeof (buffer) - MAX_VERSION_LENGTH))
|
||||
break;
|
||||
memcpy (&buffer[0], &buffer[sizeof (buffer) - MAX_VERSION_LENGTH],
|
||||
MAX_VERSION_LENGTH);
|
||||
memset (&buffer[MAX_VERSION_LENGTH], 0,
|
||||
sizeof (buffer) - MAX_VERSION_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
/* ia32 kernel */
|
||||
if(
|
||||
!fseek(fp, 0x202, SEEK_SET) &&
|
||||
fread(buffer, 1, 4, fp) == 4 &&
|
||||
buffer[0] == 0x48 && buffer[1] == 0x64 &&
|
||||
buffer[2] == 0x72 && buffer[3] == 0x53 &&
|
||||
!fseek(fp, 0x20e, SEEK_SET) &&
|
||||
fread(buffer, 1, 2, fp) == 2
|
||||
) {
|
||||
unsigned ofs = 0x200 + ((unsigned char *) buffer)[0] + (((unsigned char *) buffer)[1] << 8);
|
||||
|
||||
if(
|
||||
!fseek(fp, ofs, SEEK_SET) &&
|
||||
fread(buffer, 1, MAX_VERSION_LENGTH, fp) == MAX_VERSION_LENGTH
|
||||
) {
|
||||
char *s = buffer;
|
||||
|
||||
for(s[MAX_VERSION_LENGTH] = 0; *s; s++) if(*s == ' ') { *s = 0; break; }
|
||||
if(*buffer) {
|
||||
found = 1;
|
||||
printf("%s\n", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command[0] != '\0')
|
||||
pclose (fp);
|
||||
else
|
||||
fclose (fp);
|
||||
|
||||
if (found)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set sw=4 ts=8 sts=4 noet: */
|
@ -1 +0,0 @@
|
||||
echo ${BUILD_DISTRIBUTION_VERSION%-*}
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6bc78f13e916ac41daa8c7e1121e7771dee36eddf0d60ccbee5882a1f82bea91
|
||||
size 7090
|
Loading…
Reference in New Issue
Block a user