Commit ea62f32f authored by Andrew Lee (李健秋)'s avatar Andrew Lee (李健秋)
Browse files

Fix logrotate, refine postrm, prerm script to ensure config and log files...

Fix logrotate, refine postrm, prerm script to ensure config and log files removed after purged. (Closes:#851356)
parent ac75c33a
/var/log/obs/log/*.log {
/var/log/obs/*log {
compress
dateext
maxage 365
......@@ -7,7 +7,5 @@
notifempty
missingok
copytruncate
create 664 www-data www-data
sharedscripts
}
......@@ -43,12 +43,25 @@ if [ "$1" = "purge" ]; then
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/obs/api/config/database.yml
fi
rm -rf /etc/obs/api
rm -rf /usr/share/obs/api
rm -rf /usr/share/obs/overview
# Drop the links on obs log.
if [ -L /var/log/obs ]; then
rm -f /var/log/obs
fi
rm -rf /var/cache/obs
# Remove log files
rm -f /var/log/obs/apache_access_log*
rm -f /var/log/obs/apache_error_log*
rm -f /var/log/obs/access.log*
rm -f /var/log/obs/backend_access.log*
rm -f /var/log/obs/db_setup.log*
rm -f /var/log/obs/delayed_job.log*
rm -f /var/log/obs/error.log*
rm -f /var/log/obs/lastevents.access.log*
rm -f /var/log/obs/production.log*
rm -f /var/log/obs/production.searchd.log*
rm -f /var/log/obs/production.searchd.query.log*
rm -f /var/log/obs/production.sphinx.pid
rm -f /var/log/obs/clockworkd.clock.output*
rmdir /var/log/obs 2> /dev/null || true
# Test whether a2dissite is available (and thus also apache2ctl).
if `pathfind a2dissite`; then
# Disable the obs site if not already disabled
......
......@@ -9,6 +9,7 @@ case "$1" in
. /usr/share/dbconfig-common/dpkg/prerm.mysql
dbc_go obs-api $@
fi
invoke-rc.d obsapidelayed stop || true
;;
purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
......
/var/obs/log/*.log {
compress
dateext
rotate 2
daily
missingok
copytruncate
}
#!/bin/sh -e
if [ "$1" = "purge" ]; then
# Remove obs data under /srv
rm -rf /srv/obs
# Remove obs data under /srv/obs/
[ -d "/srv/obs/build" ] && rm -rf /srv/obs/build
[ -d "/srv/obs/events" ] && rm -rf /srv/obs/events
[ -d "/srv/obs/info" ] && rm -rf /srv/obs/info
[ -d "/srv/obs/jobs" ] && rm -rf /srv/obs/jobs
[ -d "/srv/obs/projects" ] && rm -rf /srv/obs/projects
[ -d "/srv/obs/repos" ] && rm -rf /srv/obs/repos
[ -d "/srv/obs/run" ] && rm -rf /srv/obs/run
rmdir /srv/obs 2>/dev/null || true
# Delete obs users and group
deluser --system --quiet obsrun
deluser --system --quiet obsservicerun
delgroup --system --quiet obsrun
fi
#DEBHELPER#
......@@ -20,9 +20,4 @@ if [ "$1" = "remove" ]; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
# Delete obs users and group
deluser --system --quiet obsrun
deluser --system --quiet obsservicerun
delgroup --system --quiet obsrun
fi
#!/bin/sh -e
#DEBHELPER#
if [ "$1" = "purge" ]; then
[ -d "/srv/obs/worker" ] && rm -rf /srv/obs/worker
[ -d "/run/obs" ] && rm -rf /run/obs
rmdir /srv/obs 2>/dev/null || true
deluser --system --quiet obsworker || true
delgroup --system --quiet obsworker || true
fi
#!/bin/sh -e
if [ "$1" = "purge" ]; then
if [ "$1" = "remove" ]; then
invoke-rc.d obsworker stop || true
deluser --system --quiet obsworker
delgroup --system --quiet obsworker
fi
#DEBHELPER#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment