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 compress
dateext dateext
maxage 365 maxage 365
...@@ -7,7 +7,5 @@ ...@@ -7,7 +7,5 @@
notifempty notifempty
missingok missingok
copytruncate copytruncate
create 664 www-data www-data
sharedscripts
} }
...@@ -43,12 +43,25 @@ if [ "$1" = "purge" ]; then ...@@ -43,12 +43,25 @@ if [ "$1" = "purge" ]; then
if which ucf >/dev/null 2>&1; then if which ucf >/dev/null 2>&1; then
ucf --purge /etc/obs/api/config/database.yml ucf --purge /etc/obs/api/config/database.yml
fi fi
rm -rf /etc/obs/api
rm -rf /usr/share/obs/api rm -rf /usr/share/obs/api
rm -rf /usr/share/obs/overview rm -rf /usr/share/obs/overview
# Drop the links on obs log. rm -rf /var/cache/obs
if [ -L /var/log/obs ]; then # Remove log files
rm -f /var/log/obs rm -f /var/log/obs/apache_access_log*
fi 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). # Test whether a2dissite is available (and thus also apache2ctl).
if `pathfind a2dissite`; then if `pathfind a2dissite`; then
# Disable the obs site if not already disabled # Disable the obs site if not already disabled
......
...@@ -9,6 +9,7 @@ case "$1" in ...@@ -9,6 +9,7 @@ case "$1" in
. /usr/share/dbconfig-common/dpkg/prerm.mysql . /usr/share/dbconfig-common/dpkg/prerm.mysql
dbc_go obs-api $@ dbc_go obs-api $@
fi fi
invoke-rc.d obsapidelayed stop || true
;; ;;
purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
......
/var/obs/log/*.log {
compress
dateext
rotate 2
daily
missingok
copytruncate
}
#!/bin/sh -e #!/bin/sh -e
if [ "$1" = "purge" ]; then if [ "$1" = "purge" ]; then
# Remove obs data under /srv # Remove obs data under /srv/obs/
rm -rf /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 fi
#DEBHELPER# #DEBHELPER#
...@@ -20,9 +20,4 @@ if [ "$1" = "remove" ]; then ...@@ -20,9 +20,4 @@ if [ "$1" = "remove" ]; then
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true systemctl --system daemon-reload >/dev/null || true
fi fi
# Delete obs users and group
deluser --system --quiet obsrun
deluser --system --quiet obsservicerun
delgroup --system --quiet obsrun
fi 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 #!/bin/sh -e
if [ "$1" = "purge" ]; then if [ "$1" = "remove" ]; then
invoke-rc.d obsworker stop || true invoke-rc.d obsworker stop || true
deluser --system --quiet obsworker
delgroup --system --quiet obsworker
fi fi
#DEBHELPER# #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