fuel-mirror/perestroika/functions/cleanup-functions
Dmitry Burmistrov 20d7be4b6e Add new version of package builder scripts
Previous version should be kept for backward compatibility

Change-Id: I8a337f9f2d3e1ec9f2f1cd10592487a385db75d3
Partial-Bug: #1580572
2016-05-11 15:29:50 +03:00

44 lines
1.5 KiB
Bash

#!/bin/bash
#
# needed functions
#
cleanup_mounts()
{
trap EXIT
local ROOT_NAME=%ROOT_NAME%
local TYPE=%TYPE%
local UNAME=%UNAME%
local GNAME=%GNAME%
case ${TYPE} in
mock)
umount -n /srv/tmpfs/cache 2> /dev/null || true
umount -n /var/cache/mock 2> /dev/null || true
umount -n /var/lib/mock/${ROOT_NAME}/root/tmp/ccache 2> /dev/null || true
umount -n /var/lib/mock/${ROOT_NAME}/root/var/cache/yum/ 2> /dev/null || true
umount -n -l /var/lib/mock/${ROOT_NAME}/root/dev/pts 2> /dev/null || true
umount -n -l /var/lib/mock/${ROOT_NAME}/root/dev/shm 2> /dev/null || true
umount -n -l /var/lib/mock/${ROOT_NAME}/root/sys 2> /dev/null || true
umount -n -l /var/lib/mock/${ROOT_NAME}/root/proc 2> /dev/null || true
rm -f /home/abuild/rpmbuild/{build,root,state}.log
chown -R ${UNAME}:${GNAME} /home/abuild
;;
sbuild)
umount -n -l /srv/root/dev/pts 2> /dev/null || true
umount -n -l /srv/root/dev/shm 2> /dev/null || true
umount -n -l /srv/root/sys 2> /dev/null || true
umount -n -l /srv/root/proc 2> /dev/null || true
umount -n -l /srv/root 2> /dev/null || true
schroot -e --all-sessions 2> /dev/null || true
chown -R ${UNAME}:${GNAME} /srv/source /srv/build 2> /dev/null || true
;;
*)
;;
esac
exit 0
}
trap cleanup_mounts EXIT