#!/bin/bash XIBUILD=./xibuild fetch () { git clone https://git.davidovski.xyz/xilinux/xipkgs mkdir dist } build () { for REPO in $(du -h xipkgs/repo/* | awk '{print $2}' | sort -r ); do REPO_NAME=$(echo $REPO | cut -d"/" -f2-) REPO_INDEX=dist/$REPO_NAME/index.html REPO_LIST_OLD=dist/$REPO_NAME/packages.txt REPO_LIST=dist/$REPO_NAME/packages.list start-index $REPO_NAME $REPO_INDEX printf "" > xibuild.report.log for BUILD_FILE in $REPO/*; do DEST=dist/$REPO_NAME $XIBUILD -o $DEST $BUILD_FILE extend-index $BUILD_FILE $REPO_INDEX done; rm xibuild.report.log conclude-index $REPO_INDEX generate-package-list add-additional done; } start-index () { echo " packages for $1

Packages in $1

" > $2 } extend-index () { PKG_NAME=$(basename $1 .xibuild) DESC=$(grep $PKG_NAME xibuild.report.log | cut -d" " -f3-) COLOR="none" if grep $PKG_NAME xibuild.report.log | grep -q new; then COLOR="pass" fi if grep $PKG_NAME xibuild.report.log | grep -q fail; then if [ -f dist/$REPO_NAME/$PKG_NAME.xipkg ]; then COLOR="warning" else COLOR="fail" fi fi echo " " >> $2 } conclude-index () { echo "
name xibuild build log description file info file
$PKG_NAME src log $DESC $PKG_NAME.xipkg .info

Latest builds: $(date)

Legend:

" >> $1 } generate-package-list () { cd dist/$REPO_NAME ls -1 *.xipkg.info > packages.txt echo "" > packages.list for file in $(ls -1 *.xipkg); do echo "$file $(md5sum $file)" >> packages.list done; cd - } add-additional () { # move logs and sources mv logs/* dist/$REPO_NAME/logs mkdir -p dist/$REPO_NAME/src mv $REPO/* dist/$REPO_NAME/src/ # add key for whole repo mkdir dist/keychain cp keychain/xi.pub dist/keychain/ } clean () { rm -rf xipkgs rm -rf logs rm -rf tmp rm -rf xibuild.log } sync () { [[ $# = 0 ]] || rsync -vLta --no-perms --no-owner --no-group --delete -z -e ssh ./dist/ $1 } # update the repository clean fetch build clean sync $@