Init
This commit is contained in:
28
old_scripts/extract_man.sh
Executable file
28
old_scripts/extract_man.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#! /bin/bash
|
||||
|
||||
ROCKY_VERSION=8.10
|
||||
MAN_OUTPUT=./export/${ROCKY_VERSION}/
|
||||
DIRECTORY=$1
|
||||
|
||||
if [ -z "$DIRECTORY" ]; then
|
||||
echo "Please provide the directory containing the RPM files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$MAN_OUTPUT"
|
||||
|
||||
extract_man_pages() {
|
||||
local rpm=$1
|
||||
local man_output=$2
|
||||
|
||||
MANCOUNT=$(rpm2cpio "$rpm" | cpio -itv --quiet | grep -c "/man/")
|
||||
RPMNAME=$(rpm -qp --qf "%{NAME}\n" "$rpm")
|
||||
if [ "$MANCOUNT" -ne 0 ]; then
|
||||
mkdir -p "${man_output}/${RPMNAME}"
|
||||
rpm2cpio "$rpm" | cpio -idmv --quiet -D "${man_output}/${RPMNAME}/" '*/man/*'
|
||||
fi
|
||||
}
|
||||
|
||||
export -f extract_man_pages
|
||||
|
||||
find "$DIRECTORY" -type f -name "*.rpm" | parallel --will-cite -j+0 extract_man_pages {} "$MAN_OUTPUT"
|
||||
Reference in New Issue
Block a user