Subject: [alpine-devel] [PATCH] new: aports helper scripts

From: Matt Smith <[email-masked]>
Date: Wed, 8 Dec 2010 15:20:21 -0600

I've created some helper scripts for aports, which I'll briefly cover here.

New files:
- aports/apk-aports.conf: configuration file for the following helper scripts
- aports/apkindex.sh:     creates a signed APKINDEX.tar.gz for your aports
- aports/apkwrapper.sh:   apk wrapper that uses your aports repository

Let me know what you think.
---
 apk-aports.conf |   32 ++++++++++++++++++++++++++++++++
 apkindex.sh     |   34 ++++++++++++++++++++++++++++++++++
 apkwrapper.sh   |   22 ++++++++++++++++++++++
 3 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 apk-aports.conf
 create mode 100755 apkindex.sh
 create mode 100755 apkwrapper.sh

diff --git a/apk-aports.conf b/apk-aports.conf
new file mode 100644
index 0000000..18aca10
--- /dev/null
+++ b/apk-aports.conf
@@ -0,0 +1,32 @@
+#!/bin/sh
+################################################################################
+# Contributor: Matt Smith <[email-masked]>
+# Maintainer:  Matt Smith <[email-masked]>
+# Description: apk/aports configuration, used by aports helper scripts
+# Version:     2010-12-08T15:01-06:00 (ISO 8601:2004)
+################################################################################
+
+# REMOVE OR COMMENT THE FOLLOWING TWO LINES AND EDIT THE VARIABLES THAT FOLLOW.
+echo -e "Not configured!\nPlease edit ${APK_APORTS_CONF} ..."
+exit 1
+
+#
+# Path to aports directory, no trailing slash
+APORTS_DIR=/home/user/aports
+
+#
+# aport category directories to scan for .apk files, space delimited
+APORTS_CATS="main testing"
+
+#
+# Path to abuild private key
+ABUILD_PRIV_KEY=/home/user/.abuild/user.rsa
+
+#
+# Path to abuild public key
+ABUILD_PUB_KEY=/etc/apk/keys/user.rsa.pub
+
+
+# DO NOT EDIT BEYOND THIS POINT
+APORTS_APKINDEX="${APORTS_DIR}/APKINDEX.tar.gz"
+APORTS_REPOFILE="${APORTS_DIR}/APKREPO"
diff --git a/apkindex.sh b/apkindex.sh
new file mode 100755
index 0000000..44ebcc3
--- /dev/null
+++ b/apkindex.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+################################################################################
+# Contributor: Matt Smith <[email-masked]>
+# Maintainer:  Matt Smith <[email-masked]>
+# Description: aports helper script: creates a signed APKINDEX.tar.gz and
+#              APKREPO file for use with apk or aports/apkwrapper.sh
+# Usage:       apkindex.sh
+# Version:     2010-12-08T14:52-06:00 (ISO 8601:2004)
+################################################################################
+
+# Get configuration:
+APK_APORTS_CONF_NAME="apk-aports.conf"
+if [ "${0:0:2}" == "./" ]; then
+	APK_APORTS_CONF="./${APK_APORTS_CONF_NAME}"
+else
+	APK_APORTS_CONF="`echo $0 | \
+		sed -r "s;^(/.*)/[^/]+;\1/${APK_APORTS_CONF_NAME};"`"
+fi
+source $APK_APORTS_CONF
+
+# Create APKINDEX.tar.gz for aports
+APORTS_CAT_DIRS=""
+for APORTS_CAT in $APORTS_CATS; do
+	APORTS_CAT_DIRS="${APORTS_CAT_DIRS} ${APORTS_DIR}/${APORTS_CAT}/*/*.apk"
+done
+apk index -o $APORTS_APKINDEX ${APORTS_CAT_DIRS:1}
+
+# Sign the aports APKINDEX.tar.gz
+abuild-sign -k $ABUILD_PRIV_KEY -p $ABUILD_PUB_KEY $APORTS_APKINDEX
+
+# Create aports APKREPO to use like:
+#   apk --repositories-file $APKREPO add $APORTS_PKG
+#   (This is the purpose of aports/apkwrapper.sh)
+echo "${APORTS_DIR}/" > $APORTS_REPOFILE
diff --git a/apkwrapper.sh b/apkwrapper.sh
new file mode 100755
index 0000000..306328e
--- /dev/null
+++ b/apkwrapper.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+################################################################################
+# Contributor: Matt Smith <[email-masked]>
+# Maintainer:  Matt Smith <[email-masked]>
+# Description: aports helper script: apk wrapper that uses the signed
+#              APKINDEX.tar.gz and APKREPO files generated by aports/apkindex.sh
+# Example Use: apkwrapper.sh add /path/to/aports/main/package/package-0.1-r0.apk
+# Version:     2010-12-08T15:08-06:00 (ISO 8601:2004)
+################################################################################
+
+# Get configuration:
+APK_APORTS_CONF_NAME="apk-aports.conf"
+if [ "${0:0:2}" == "./" ]; then
+	APK_APORTS_CONF="./${APK_APORTS_CONF_NAME}"
+else
+	APK_APORTS_CONF="`echo $0 | \
+			sed -r "s;^(/.*)/[^/]+;\1/${APK_APORTS_CONF_NAME};"`"
+fi
+source $APK_APORTS_CONF
+
+# Invoke apk using the aports repository file
+apk --repositories-file $APORTS_REPOFILE $*
-- 
1.7.3.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---