[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] Script zum Erzeugen eines LPT-Repositories



From: "Moritz Grosch (LittleFox)" <littlefox@xxxxxxxx>

Generiert ein LPT-Repository aus dem packages-Ordner von lbuilds.

Signed-off-by: Moritz Grosch (LittleFox) <littlefox@xxxxxxxx>
---
 build/scripts/lpt_index.sh |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100755 build/scripts/lpt_index.sh

diff --git a/build/scripts/lpt_index.sh b/build/scripts/lpt_index.sh
new file mode 100755
index 0000000..94bd42a
--- /dev/null
+++ b/build/scripts/lpt_index.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+if [ "$1" == "" -o "$2" == "" ]; then
+	echo "Usage: lpt-index.sh <package directory> <destination directory>"
+	exit -1
+fi
+
+PACKAGE_DIRECTORY=$1
+DESTINATION_DIRECTORY=$2
+
+if [ ! -d "$DESTINATION_DIRECTORY" ]; then
+	mkdir -p "$DESTINATION_DIRECTORY"
+else
+	rm -rf $DESTINATION_DIRECTORY/*
+fi
+
+for file in $PACKAGE_DIRECTORY/*.tar
+do
+	extension=${file##*.}
+
+	filename=${file##*/}
+	filenamewithoutsuffix=${file%.*}
+	packagename=${filename%-*}
+	packageversion=${filenamewithoutsuffix##*-}
+
+	if [[ $packagename == lib* ]]; then
+		type="lib"
+        else
+		type="bin"
+        fi
+
+	echo "P $packagename" >> "$DESTINATION_DIRECTORY/packages.i386"
+	echo "D no description" >> "$DESTINATION_DIRECTORY/packages.i386"
+	echo "S $type" >> "$DESTINATION_DIRECTORY/packages.i386"
+	echo "V $packageversion" >> "$DESTINATION_DIRECTORY/packages.i386"
+	echo "s $(ls -l $file | awk '{print $5}')" >> "$DESTINATION_DIRECTORY/packages.i386"
+	echo "" >> "$DESTINATION_DIRECTORY/packages.i386"
+
+	cp "$file" "$DESTINATION_DIRECTORY/$packagename-$type-$packageversion-i386.tar"
+done
-- 
1.7.10.4