commit 113f3594d413c35e639b792d70e91142d39815f8
parent bc7c1b2b360b2ca63845092283b61edc2b247231
Author: sin <sin@2f30.org>
Date: Thu, 18 Apr 2019 13:18:51 +0100
Implement dup-migrate(1)
Diffstat:
3 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -3,13 +3,15 @@ include config.mk
VERSION = 1.0
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man
-TARGET = dup-check dup-info dup-init dup-list dup-pack dup-unpack
+BIN = dup-check dup-info dup-init dup-list dup-pack dup-unpack
+SCRIPTS = dup-migrate
MAN = \
dup-check.1 \
dup-info.1 \
dup-init.1 \
dup-list.1 \
+ dup-migrate.1 \
dup-pack.1 \
dup-unpack.1 \
@@ -91,21 +93,22 @@ CPPFLAGS = -I/usr/local/include -D_FILE_OFFSET_BITS=64
LDFLAGS = -L/usr/local/lib
LDLIBS = -llz4 -lsnappy $(OPENMPLDLIBS)
-all: $(TARGET)
+all: $(BIN)
$(DCHECKOBJ) $(DINFOOBJ) $(DINITOBJ) $(DLISTOBJ) $(DPACKOBJ) $(DUNPACKOBJ): $(HDR)
clean:
- rm -f $(DCHECKOBJ) $(DINFOOBJ) $(DINITOBJ) $(DLISTOBJ) $(DPACKOBJ) $(DUNPACKOBJ) $(TARGET) dedup-$(VERSION).tar.gz
+ rm -f $(DCHECKOBJ) $(DINFOOBJ) $(DINITOBJ) $(DLISTOBJ) $(DPACKOBJ) $(DUNPACKOBJ) $(BIN) dedup-$(VERSION).tar.gz
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
- cp -f $(TARGET) $(DESTDIR)$(PREFIX)/bin
+ cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
+ cp -f $(SCRIPTS) $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp -f $(MAN) $(DESTDIR)$(MANPREFIX)/man1
uninstall:
- cd $(DESTDIR)$(PREFIX)/bin && rm -f $(TARGET)
+ cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN) $(SCRIPTS)
cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
dist:
diff --git a/dup-migrate b/dup-migrate
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Migrate an old dedup repo to a new one.
+# This is useful when there is an ABI break
+# in the deduplication repository file format.
+
+set -e
+
+usage()
+{
+ echo usage: dmigrate old-repo new-repo >&2
+ exit 1
+}
+
+if [ ! "$#" -eq 2 ]
+then
+ usage
+fi
+
+oldrepo="$1"
+newrepo="$2"
+
+dup-init "$newrepo"
+dup-list "$oldrepo" | while read id
+do
+ dup-unpack "$id" "$oldrepo" | dup-pack "$newrepo"
+done
diff --git a/dup-migrate.1 b/dup-migrate.1
@@ -0,0 +1,21 @@
+.Dd April 18, 2019
+.Dt DUP-MIGRATE 1
+.Os
+.Sh NAME
+.Nm dup-migrate
+.Nd Migrate a deduplication repository
+.Sh SYNOPSIS
+.Nm dup-migrate
+.Ar old-repo
+.Ar new-repo
+.Sh DESCRIPTION
+.Nm
+migrates the
+.Ar old-repo
+to the
+.Ar new-repo .
+This is useful when there is an ABI break
+in the deduplication repository file format.
+.Sh AUTHORS
+.An Dimitris Papastamos Aq Mt sin@2f30.org ,
+.An z3bra Aq Mt contactatz3bradotorg .