summaryrefslogtreecommitdiff
path: root/control.sh
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-01-01 05:58:43 +0000
committerJay Freeman <saurik@saurik.com>2008-01-01 05:58:43 +0000
commitea2670c18699e514ee1d65dfd35ad22c296a74e7 (patch)
tree6826a5266d78c22210c194772a8daed06ef0a19c /control.sh
parenta45e85d54e8df7a333946cc52fec519fc6aa4d87 (diff)
Initial commit.
git-svn-id: http://svn.telesphoreo.org/trunk@2 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'control.sh')
-rwxr-xr-xcontrol.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/control.sh b/control.sh
new file mode 100755
index 000000000..394b9bd43
--- /dev/null
+++ b/control.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+shopt -s extglob nullglob
+
+export PKG_NAME=$1
+shift
+
+export PKG_BASE=$(realpath "$(dirname "$0")")
+. "${PKG_BASE}/helper.sh"
+
+cat <<EOF
+Package: ${PKG_NAME}
+Essential: $([[ ${PKG_PRIO} == required ]] && echo yes || echo no)
+EOF
+
+if [[ $1 == status ]]; then
+ cat <<EOF
+Status: install ok installed
+EOF
+fi
+
+cat <<EOF
+Priority: ${PKG_PRIO}
+Section: $(cat "${PKG_DATA}/_metadata/section")
+EOF
+
+if [[ $1 == status || $1 == control ]]; then
+ cat <<EOF
+Installed-Size: $(du -s "${PKG_DEST}" | cut -d $'\t' -f 1)
+EOF
+fi
+
+cat <<EOF
+Maintainer: $(cat "${PKG_DATA}/_metadata/maintainer")
+Architecture: darwin-arm
+Version: ${PKG_VRSN}
+EOF
+
+if [[ $1 == available ]]; then
+ cat <<EOF
+Size: $(find "${PKG_DEST}" -type f -exec cat {} \; | gzip -c | wc -c | cut -d $'\t' -f 1)
+EOF
+fi
+
+unset comma
+for dep in "${PKG_DEPS[@]}"; do
+ if [[ ${comma+@} == @ ]]; then
+ echo -n ","
+ else
+ echo -n "Depends:"
+ comma=
+ fi
+
+ echo -n " $(basename "${dep}" .dep)"
+done
+
+if [[ ${comma+@} == @ ]]; then
+ echo
+fi
+
+cat <<EOF
+Description: $(head -n 1 "${PKG_DATA}/_metadata/description")
+$(tail -n +2 "${PKG_DATA}/_metadata/description" | fold -sw 72 | sed -e 's/^/ /')
+EOF
+
+if [[ $1 == status || $1 == available ]]; then
+ echo
+fi