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

[tyndur-devel] [PATCH] Added script to automatically build a lpt-repo



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

This script builds a lpt-repository from the lbuilds packages-directory
and automatically generates an index.

Currently it doesn't set a real description and is limited to i386.
---
 build/scripts/lpt_index.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 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..a851fa4
--- /dev/null
+++ b/build/scripts/lpt_index.sh
@@ -0,0 +1,44 @@
+#!/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/*
+do
+	extension=${file##*.}
+
+	if [ $extension == "tar" ]
+	then
+		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 $PACKAGE_DIRECTORY | grep $filename | awk '{print $5}')" >> "$DESTINATION_DIRECTORY/packages.i386"
+
+		echo "" >> "$DESTINATION_DIRECTORY/packages.i386"
+
+		cp "$file" "$DESTINATION_DIRECTORY/$packagename-$type-$packageversion-i386.tar"
+	fi
+done
-- 
1.7.10.4