specfile: remove no longer needed copying from old dump directory to new one.
Related to rhbz#971869. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Acked-by: Jakub Filak <jfilak@redhat.com>
This commit is contained in:
parent
7d9993a382
commit
cb53a4ad19
67
abrt.spec
67
abrt.spec
@ -412,73 +412,6 @@ make check
|
||||
%define abrt_gid_uid 173
|
||||
getent group abrt >/dev/null || groupadd -f -g %{abrt_gid_uid} --system abrt
|
||||
getent passwd abrt >/dev/null || useradd --system -g abrt -u %{abrt_gid_uid} -d /etc/abrt -s /sbin/nologin abrt
|
||||
|
||||
OLD_LOCATION="/var/spool/abrt"
|
||||
NEW_LOCATION="/var/tmp/abrt"
|
||||
# $1 == 1 if install; 2 if upgrade
|
||||
if [ "$1" -eq 2 ]
|
||||
then
|
||||
test -d "$OLD_LOCATION" || exit 0
|
||||
mkdir -p "$NEW_LOCATION"
|
||||
|
||||
#restorecon "$NEW_LOCATION"
|
||||
find "$OLD_LOCATION" -maxdepth 1 -type f -exec cp '{}' "$NEW_LOCATION" \;
|
||||
|
||||
for DD in `find "$OLD_LOCATION" -maxdepth 1 -type d`
|
||||
do
|
||||
# skip dump location self
|
||||
if [ "$DD" == "$OLD_LOCATION" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# skip symlinks
|
||||
if [ -L "$DD" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# check if time element exists, if so then consider a directory as dump
|
||||
# directory and move it to the new location
|
||||
if [ -f "$DD/time" ]; then
|
||||
NEW_DD="$NEW_LOCATION/"`basename $DD`
|
||||
|
||||
# to be sure we do not override anything
|
||||
if [ -d "$NEW_DD" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if cp --recursive -- "$DD" "$NEW_DD"; then
|
||||
# owner of dump dir is identified by his group
|
||||
# so get the owner of dump dir
|
||||
OWNER_GID=`stat -c "%g" "$DD"`
|
||||
|
||||
# use group's user in case where group contains only single user
|
||||
if [ $(getent passwd | cut -f3,4,5 -d: | grep -c ":$OWNER_GID:") -eq 1 ]; then
|
||||
OWNER_UID=`getent passwd | cut -f3,4,5 -d: | grep ":$OWNER_GID:" | cut -f1 -d:`
|
||||
else
|
||||
# otherwise get owner from dd's uid element
|
||||
OWNER_UID=`cat "$NEW_DD/uid"`
|
||||
fi
|
||||
|
||||
getent passwd "$OWNER_UID" >/dev/null || {
|
||||
# if user doesn't exist pass the ownership to root
|
||||
OWNER_UID=0
|
||||
}
|
||||
|
||||
# set new schema of ownership
|
||||
chown --recursive "$OWNER_UID":abrt "$NEW_DD" && {
|
||||
chmod 770 "$NEW_DD"
|
||||
find "$NEW_DD" -type d -exec chmod 770 '{}' \;
|
||||
find "$NEW_DD" -type f -exec chmod 660 '{}' \;
|
||||
}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# doesn't mather if it fails or not for any reason
|
||||
if which restorecon 1>/dev/null 2>&1; then
|
||||
restorecon -R "$NEW_LOCATION" 1>/dev/null 2>&1 || true
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%post
|
||||
|
Loading…
Reference in New Issue
Block a user