scripts/src/clean-md5-cache

41 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# This file is part of scripts.
# scripts 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, version 3.
# scripts 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 scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
# Clean md5-cache from the overlay directory
trap 'exit 128' INT
export PATH
cache="$(git rev-parse --show-cdup)metadata/md5-cache"
if [ -d "${cache}" ]
then
if ! rm -fr "${cache}"
then
su root -c "rm -fr ${cache}" || exit 1
fi
else
printf "%s\n" "No pre-generated md5-cache found in ${cache}" >> /dev/stderr
fi