Commit 2e2d88a6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit last changes

parent eed34442
Check https://github.com/bup/bup
https://wiki.thingsandstuff.org/Backup
rename to eterpack
Предел размера файла архива. Также начинать вести новый, если много инкрементов.
Хранить на gluster в garbage. Файлы брать с nun (там и проводить операции).
Шифровать с помощью encfs.
......@@ -10,6 +15,8 @@
Возможно, можно просто удалять ненужные? Проверить, как работает удаление файлов
при добавлении архив.
Удалять просто сравнением списков каталогов?
Нужен тест для zpaq.
Нужен тест для архиватора, что он всё помещает, а потом восстанавливает.
......@@ -18,6 +25,12 @@
Сохранять контрольные суммы по архивам, проверять целостность.
Проблемы с сохранением owner/group и других свойств файла. Автор пишет, что добавить не сложно, но не знаю.
Отдельно сохранять структуру? Это будет двойной просмотр.
Для режима, когда локально архив не сохраняется
zpaq: If the index is present but part 1 is not, then it is assumed that all of the parts have been moved. The number of versions in the index is counted and a new part is created using the next available version number, and the index is updated.
rsnapshot - можно ли приспособить для локальных копий?
Должен быть только read-only доступ с места бэкапа.
......
......@@ -22,6 +22,21 @@ STN="???"
DESCR="eterbackup version 0.1 (c) Etersoft 2015"
print_message()
{
local DESC="$1"
shift
echo "$DESC in $(basename $0): $@"
}
# Print error message and stop the program
fatal()
{
print_message Error "$@" >&2
exit 1
}
list_dirs()
{
#echo "List dirs from $BACKUPDIR, with $EXCLUDEDIR exclude."
......@@ -54,7 +69,7 @@ while read subdir ; do
# /var/log/long/something -> long/something
reldir="${subdir/$BACKUPDIR\//}"
bdir=$(basename "$reldir")
bdir="$(basename "$reldir")"
# TODO: improve
if [ "$bdir" = "$EXCLUDEDIR" ] ; then
......@@ -69,7 +84,7 @@ while read subdir ; do
mkdir -p "$DUMPDIR/$reldir"
# workaround for correct internal path
cd $BACKUPDIR/$reldir/.. || exit
cd "$BACKUPDIR/$reldir/.." || exit
# packing
echo
echo "Packing $bdir..."
......@@ -80,18 +95,20 @@ done
repack_dump()
{
fatal "Do not realized jet!"
# Получаем список каталогов, которые мы хотим превратить в файлы
find $BACKUPDIR -depth -maxdepth $DEPTH -mindepth $DEPTH -type d | \
find "$BACKUPDIR" -depth -maxdepth $DEPTH -mindepth $DEPTH -type d | \
while read subdir ; do
# TODO: не забыть файлы в основном каталоге
# TODO: неизвестно, как сделать нерекурсивным
# /var/log/long/something -> long/something
reldir="${subdir/$BACKUPDIR\//}"
bdir=$(basename "$reldir")
bdir="$(basename "$reldir")"
# TODO: improve
if [ "$bdir" = "$EXCLUDEDIR" ] ; then
echo
echo "Skip excluded $bdir"
continue
fi
......@@ -106,18 +123,18 @@ while read subdir ; do
# TODO: выделить в отдельную функцию
# TODO: check it
zpaq purge "$DUMPDIR/$reldir/$bdir.$STN.zpaq" -to "$DUMPDIR/$reldir/../$bdir.$STZ.zpaq" || exit
rm -f $DUMPDIR/$reldir/$bdir.$STN.zpaq
mv $DUMPDIR/$reldir/../$bdir.$STZ.zpaq $DUMPDIR/$reldir/$bdir.$STZ.zpaq
rm -f "$DUMPDIR/$reldir/$bdir.$STN.zpaq"
mv "$DUMPDIR/$reldir/../$bdir.$STZ.zpaq" "$DUMPDIR/$reldir/$bdir.$STZ.zpaq"
done
}
extract_dump()
{
# CHECKME: always exists 000?
find $DUMPDIR -type f -name "*.$STZ.zpaq" | \
find "$DUMPDIR" -type f -name "*.$STZ.zpaq" | \
while read paqfile ; do
relfile="${paqfile/$DUMPDIR\//}"
reldir=$(dirname "$relfile")
reldir="$(dirname "$relfile")"
# FIXME: copy dir permissions
# TODO: хранить структуру каталогов отдельно, сразу и проверка?
mkdir -p "$DESTDIR/$reldir" || exit
......@@ -147,28 +164,29 @@ fi
case $COMMAND in
update)
# from
BACKUPDIR=$(realpath -e "$1") || exit
BACKUPDIR="$(realpath -e "$1")" || exit
# to
DUMPDIR=$(realpath -m "$2")
DUMPDIR="$(realpath -m "$2")"
update_dump
;;
repack)
# from
BACKUPDIR=$(realpath -e "$1") || exit
BACKUPDIR="$(realpath -e "$1")" || exit
# to
DUMPDIR=$(realpath -m "$2")
DUMPDIR="$(realpath -m "$2")"
repack_dump
;;
list)
# from
BACKUPDIR=$(realpath -e "$1") || exit
BACKUPDIR="$(realpath -e "$1")" || exit
list_dirs
;;
extract)
DUMPDIR=$(realpath -e "$1") || exit
DESTDIR=$(realpath -m "$2")/$(basename $DUMPDIR)
DUMPDIR="$(realpath -e "$1")" || exit
DESTDIR=
[ -n "$2" ] && DESTDIR="$(realpath -m "$2")/$(basename $DUMPDIR)"
extract_dump
;;
-h|--help)
......
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