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