summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkeygen.sh4
-rwxr-xr-xxibuild66
-rw-r--r--xibuilds/bash.xibuild17
3 files changed, 87 insertions, 0 deletions
diff --git a/keygen.sh b/keygen.sh
new file mode 100755
index 0000000..5ec5bbd
--- /dev/null
+++ b/keygen.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+mkdir -p keychain
+openssl genrsa -out keychain/xi.pem 4096
+openssl rsa -in keychain/xi.pem -pubout > keychain/xi.pub
diff --git a/xibuild b/xibuild
new file mode 100755
index 0000000..83751fb
--- /dev/null
+++ b/xibuild
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+usage () {
+ cat << EOF
+usage: $0 XIBUILD
+EOF
+}
+
+BUILD_FILE=${@: -1}
+
+[[ $# = 0 ]] && usage && exit 1
+[ -f "$FILE" ] && echo "$BUILD_FILE not found" && exit 1
+
+source $BUILD_FILE
+
+PKG_NAME=$(basename $BUILD_FILE .xibuild)
+
+XI_ROOT=$(pwd)
+PKGS_OUTPUT=$XI_ROOT/xipackages
+
+PKG_BUILD_DIR=$XI_ROOT/tmp/$PKG_NAME
+PKG_DEST=$PKG_BUILD_DIR/package
+
+# make the directories
+mkdir -p $PKG_DEST
+cd $PKG_BUILD_DIR
+
+# fetch, build then package the package
+fetch
+build
+package
+
+
+# go back to root, make things easier
+cd $XI_ROOT
+
+# bundle the package to a targz in the output dir
+mkdir -p $PKGS_OUTPUT
+
+PKG_FILE=$PKGS_OUTPUT/$PKG_NAME.xipkg
+
+tar -C $PKG_BUILD_DIR/package -czf $PKG_FILE ./
+
+# create info file
+PKG_INFO=$PKGS_OUTPUT/$PKG_NAME.xipkg.info
+
+echo "" > $PKG_INFO
+echo "NAME=$PKG_NAME" >> $PKG_INFO
+echo "PKG_FILE=$PKG_NAME.xipkg" >> $PKG_INFO
+echo "CHECKSUM=$(md5sum $PKG_FILE | awk '{ print $1 }')" >> $PKG_INFO
+echo "DATE=$(date)" >> $PKG_INFO
+
+# sign the package
+PRIV_KEY=$XI_ROOT/keychain/xi.pem
+PUB_KEY=$XI_ROOT/keychain/xi.pub
+
+if [ -f "$PRIV_KEY" ]; then
+ echo "SIGNATURE=\n" >> $PKG_INFO
+ openssl dgst -sign $PRIV_KEY $PKG_FILE >> $PKG_INFO
+else
+ echo "SIGNATURE=\nunsigned">> $PKG_INFO
+ >&2 echo "WARNING! no private key: unsigned packages!"
+fi
+# clean up
+rm -rf $PKG_BUILD_DIR
+rmdir $XI_ROOT/tmp
diff --git a/xibuilds/bash.xibuild b/xibuilds/bash.xibuild
new file mode 100644
index 0000000..efa9c19
--- /dev/null
+++ b/xibuilds/bash.xibuild
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+fetch () {
+ git clone https://git.savannah.gnu.org/git/bash.git
+}
+
+build () {
+ cd bash
+ ./configure --without-bash-malloc --prefix=/usr
+ make
+ make DESTDIR=$PKG_DEST install
+}
+
+package () {
+ echo "packaged"
+}
+