summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-28 12:58:30 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-28 12:59:44 +0900
commit183160b479ecf4a5d3ab76f0adacf812ea47fab6 (patch)
treea44cf05283bb2e965fd1d6afb81d0e684118908b
parent12aed66e35bdc6148fcaf31219b9fef54dcfd5c9 (diff)
downloadfdupes-sandbox/dh0128.kwak/fdupes-2.1.2-20211025.tar.gz
fdupes-sandbox/dh0128.kwak/fdupes-2.1.2-20211025.tar.bz2
fdupes-sandbox/dh0128.kwak/fdupes-2.1.2-20211025.zip
Change-Id: I5836426a47f9403f948fabd400d09a0c31fddd80 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r--packaging/fdupes.manifest5
-rw-r--r--packaging/fdupes.spec37
-rw-r--r--packaging/macros.fdupes27
3 files changed, 69 insertions, 0 deletions
diff --git a/packaging/fdupes.manifest b/packaging/fdupes.manifest
new file mode 100644
index 0000000..017d22d
--- /dev/null
+++ b/packaging/fdupes.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/fdupes.spec b/packaging/fdupes.spec
new file mode 100644
index 0000000..f27fd57
--- /dev/null
+++ b/packaging/fdupes.spec
@@ -0,0 +1,37 @@
+Name: fdupes
+Version: 2.1.2
+Release: 0
+License: MIT
+Summary: Identifying or deleting duplicate files
+Url: http://premium.caribe.net/~adrian2/fdupes.html
+Group: Base/Compression
+Source0: %{name}-%{version}.tar.bz2
+Source1: macros.fdupes
+Source1001: fdupes.manifest
+
+%description
+FDUPES is a program for identifying or deleting duplicate files
+residing within specified directories
+
+%prep
+%setup -q
+cp %{SOURCE1001} .
+
+%build
+export CFLAGS+=" -fPIC"
+export LDFLAGS+=" -pie"
+%{reconfigure} --without-ncurses
+%{make_build}
+
+%install
+install -D -m755 fdupes %{buildroot}%{_bindir}/fdupes
+install -D -m644 fdupes.1 %{buildroot}%{_mandir}/man1/fdupes.1
+install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.fdupes
+
+%{remove_docs}
+
+%files
+%manifest %{name}.manifest
+%license README
+%{_bindir}/fdupes
+%config %{_sysconfdir}/rpm
diff --git a/packaging/macros.fdupes b/packaging/macros.fdupes
new file mode 100644
index 0000000..9ec8e78
--- /dev/null
+++ b/packaging/macros.fdupes
@@ -0,0 +1,27 @@
+
+%fdupes(s) \
+ _target=""; \
+ _symlinks=0; \
+ _files=(); \
+ %{-s:_symlinks=1;} \
+ fdupes -q -n -r %1 | \
+ while read _file; do \
+ if test -z $_file; then \
+ _sorted_files=($(for i in ${_files[*]}; do echo $i; done | sort)); \
+ _target=${_sorted_files[0]}; \
+ for i in $(seq 1 $((${#_sorted_files[@]}-1))); do \
+ symlink_file=${_sorted_files[$i]}; \
+ rm $symlink_file;\
+ if test "$_symlinks" = 1; then \
+ ln -sf "${_target#%{buildroot}}" "$symlink_file"; \
+ else \
+ ln -f "$_target" "$symlink_file"; \
+ fi ;\
+ done; \
+ _files=(); \
+ else \
+ _files+=($_file); \
+ fi; \
+ done \
+%{nil}
+