#!/bin/bash while pgrep -af update.sh; do sleep 1 done finalPortsDirs=(/usr/src/ports/{cpan2crux,manual}Ports) d=$( find "${finalPortsDirs[@]}" -mindepth 2 "(" -name ".*" -type d -prune -false ")" -o -type d -not -name ".*" ) if [ -n "$d" ] then echo "dirs:" echo "$d" exit -1 fi l=$( find "${finalPortsDirs[@]}" -type l ) if [ -n "$l" ] then echo "links:" echo "$l" exit -1 fi if [ -d /usr/src/ports/.work ]; then rm -f /usr/src/ports/.work/{REPO,index.html} ls -1 /usr/src/ports/.work | \ while read -r s; do if [ ! -h "/usr/src/ports/.work/${s}" ]; then echo "/usr/src/ports/.work/${s} ist kein Symlink!" exit -1 fi rm /usr/src/ports/.work/$s done rmdir /usr/src/ports/.work fi mkdir /usr/src/ports/.work err=false for dir in $(find "${finalPortsDirs[@]}" -mindepth 1 -maxdepth 1 -type d) do file_missing=false for file in Pkgfile .md5sum .footprint .signature do if [ ! -f $dir/$file ] then echo "$dir/$file gibt es nicht, sollte es aber!" file_missing=true break fi done if ${file_missing}; then err=true continue fi if [ ! $(grep -c "^\s*name=" $dir/Pkgfile) -eq 1 ] then echo "$dir/Pkgfile hat \"name=..\" nicht genau ein Mal!" err=true continue fi if [ ! "$(grep "^\s*name=" $dir/Pkgfile | cut -d = -f 2)" == "$(basename "$dir")" ] then echo "$dir/Pkgfile behauptet zu $(grep "^\s*name=" $dir/Pkgfile | cut -d = -f 2) zu gehören!" err=true continue fi if [ ! $(grep -c "^\s*#\s*Maintainer:\s\+Erich Eckner, crux at eckner dot net\s*\$" $dir/Pkgfile) -eq 1 ] then echo "$dir/Pkgfile behauptet nicht von Erich gepflegt zu werden!" err=true continue fi if [ ! $(grep -c "\susr/man/" $dir/.footprint) -eq 0 ] then echo "$dir erzeugt Manpages in /usr/man statt /usr/share/man!" err=true continue fi ergs=$( prtverify $dir \ | grep -v "$( sed ' s@^# !suid \(\S\+\)$@ suid file found: \1$@ t d ' $dir/Pkgfile )" ) if [ -n "$ergs" ] then echo "prtverify meckert $dir an:" echo "$ergs" err=true continue fi signErr="$( cd $dir if ! signify -C -x .signature &> /dev/null then sudo -u pkgmk fakeroot pkgmk -d -cs 2>&1 | \ grep -v '^=======> Signature ok\.$' fi )" if [ -n "${signErr}" ] then >&2 echo "signify meckert $dir an:" echo "${signErr}" err=true continue fi ln -s ${dir} /usr/src/ports/.work/${dir##*/} done if ${err}; then exit -1 fi for file in deepthought.pub deepthought.httpup; do ln -s /usr/src/ports/{,.work/}${file} done for dir in "${finalPortsDirs[@]}"; do httpup-repgen ${dir} done for dir in "${finalPortsDirs[@]}"; do cat ${dir}/REPO done | \ sort > \ /usr/src/ports/.work/REPO git -C /usr/src/ports commit -m 'new ports uploaded' -- '*/REPO' knock-knock git -C /usr/src/ports push portspage --title="Erich Eckner's CRUX Ports" --header="/usr/src/ports/head" /usr/src/ports/.work | \ grep -v ">\." | \ sed 's|/usr/src/ports/\.work/\([^/]*\)/|/\1/Pkgfile|' | \ sed 's|\(Description\)|\1Experimental?|' | \ sed 's@^\(\s*\(.*\)\{3\}\)\([0-9]\{4\}\(-[0-9]\{2\}\)\{2\}\)$@\1EXPERIMENTELL\4@' | \ while read -r s do if echo "${s}" | grep -q "EXPERIMENTELL" then if echo "${s}" | grep -q "https://opensources\.eckner\.net/" then s="${s/EXPERIMENTELL/yes}" else s="${s/EXPERIMENTELL/ }" fi fi echo "${s}" done > \ /usr/src/ports/.work/index.html export RSYNC_RSH=ssh knock-knock rsync -aLvzzc --delete --delete-excluded \ --exclude "*tar.gz" \ --exclude "*tar.bz2" \ --exclude "*.gem" \ --exclude "*tgz" \ --exclude "*.zip" \ --exclude "sync.sh" \ --exclude "lastVersion.sh" \ --exclude "checkVersions" \ --exclude "head" \ --exclude ".ht*" \ --exclude "*CVS/" \ --include ".md5sum" \ --include ".footprint" \ --include ".signature" \ --exclude ".*" \ /usr/src/ports/.work/ ecknernet@eckner.net:crux.eckner.net