3
# Copyright (c) 2005 Floris Bruynooghe
4
# This file is copylefted under the GPL
6
# Backups all files generated by the autotools. When called with the '-r'
7
# option it restores these files.
8
# This is achieved by copying the files into a $BACDIR directory
9
# and moving them back.
11
# The directory used for the backup
12
bacdir=debian/atbackup
14
# This variable controls which files are backed up.
15
autofiles="acconfig.h aclocal.m4 config.guess config.sub config.h.in \
16
configure install-sh ltconfig ltmain.sh missing \
17
mkinstalldirs stamp-h.in INSTALL info/texinfo.tex \
19
$(find -name Makefile.in ! -regex '.*debian/atbackup.*')"
22
if [ "$1" = "" ]; then
23
if [ -d ${bacdir} ]; then
24
echo "$0: ERROR: backup direcotry exitst!"
25
echo "$0: ERROR: run '$0 -r' first"
29
echo "$0: backing up upstreams autotooled files"
30
for file in ${autofiles}; do
31
if [ X$DH_VERBOSE = X1 ]; then
32
echo "$0: moving ${file}"
34
mkdir -p ${bacdir}/$(dirname ${file})
35
mv "${file}" "${bacdir}/${file}"
37
elif [ "$1" = "-r" ]; then
38
if [ ! -d ${bacdir} ]; then
39
echo "$0: ERROR: no backup available!"
42
echo "$0: attempting to revert to upstreams autotooled files"
43
for file in ${autofiles}; do
44
if [ -f "${bacdir}/${file}" ]; then
45
if [ X$DH_VERBOSE = X1 ]; then
46
echo "$0: reverting ${file}"
48
mv "${bacdir}/${file}" "${file}"
50
echo "$0: WARNING: ${file} was not in backup directory!"
51
echo "$0: WARNING: left ${file} untouched"
54
if [ -n "$(find ${bacdir} ! -type d)" ]; then
55
echo "$0: ERROR: some backed up files where not restored"
56
echo "$0: ERROR: you may want to check ${bacdir} manually"