]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
add to git
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 2 Sep 2012 08:55:08 +0000 (11:55 +0300)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 5 Sep 2015 20:14:02 +0000 (23:14 +0300)
wwwbin/by-group.sh [new file with mode: 0755]

diff --git a/wwwbin/by-group.sh b/wwwbin/by-group.sh
new file mode 100755 (executable)
index 0000000..7107db3
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+dir="$1"
+cd $dir || exit 1
+
+for f in *.rpm ; do
+       g=$(rpm --qf '%{GROUP}' -qp $f)
+       level=".."
+       a="$g"
+       b=
+       while [ "$a" != "$b" ]; do
+               b="$a"
+               a=${a#*/}
+               level="${level}/.."
+       done
+       [ -d "../by-group/$g" ] || mkdir -p "../by-group/$g"
+       ln -sf "$level/RPMS/$f" "../by-group/$g/$f"
+done
+
+# remove dangling symlinks...
+symlinks -dr $dir/../by-group
+# and empty directories
+find $dir/../by-group -depth -type d -empty -exec rmdir {} \;
This page took 0.122838 seconds and 4 git commands to generate.