summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-01-01 22:50:40 -0800
committerOri Bernstein <ori@eigenstate.org>2019-01-01 22:50:40 -0800
commit89b8177e5cd88d382931a7ca431f2104c9daebe1 (patch)
tree45efd10ab62f07876b7d60406a2132e2295b5023
parentca311f0bd83c9d72848f5361a3f1736c7bb751da (diff)
downloadmc-89b8177e5cd88d382931a7ca431f2104c9daebe1.tar.gz
Add rebootstrap script to repository.
-rwxr-xr-xrebootstrap.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/rebootstrap.sh b/rebootstrap.sh
new file mode 100755
index 0000000..150f1eb
--- /dev/null
+++ b/rebootstrap.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+set -ex
+
+if [ -z $BUILDHOSTS ]; then
+ BUILDHOSTS=$HOME/src/myr/buildhosts
+fi
+
+build()
+{
+ host=$1
+ os=$2
+ wrkdir=$3
+ auth=$4
+ passwd=$5
+
+ makeprg=gmake
+ vcs=git
+ remotecmd="ssh $host"
+ setpath="mkdir -p $wrkdir/root/bin && export PATH=$PATH:$wrkdir/root/bin"
+ showpatch="cd '$wrkdir/mc' && cat update.patch && rm -f update.patch"
+ case $os in
+ plan9)
+ if echo $host | grep '@' > /dev/null; then
+ user=$(echo $host | cut -d '@' -f1)
+ host=$(echo $host | cut -d '@' -f2)
+ fi
+ if ! -z $passwd; then
+ export PASS=$passwd
+ fi
+ makeprg=mk
+ vcs=hg
+ setpath="mkdir -p $wrkdir/root/bin && bind -bc $wrkdir/root/bin /amd64/bin;
+ mkdir -p $wrkdir/root/lib && bind -bc $wrkdir/root/lib /amd64/lib;
+ mkdir -p $wrkdir/root/sys && bind -bc $wrkdir/root/sys /sys"
+ buildcmd="rc -e -c 'webfs; cd $wrkdir/mc ; $setpath;
+ $makeprg bootstrap ; $makeprg install ; $makeprg clean ; git pull ;
+ $makeprg genbootstrap ; $vcs diff > update.patch'"
+ showpatch="cd $wrkdir/mc ; cat update.patch ; rm -f update.patch"
+ remotecmd="drawterm -G -h $host -u $user -a $auth -c "
+ ;;
+ linux|macos)
+ makeprg=make
+ vcs=git
+ buildcmd="cd '$wrkdir/mc' && $setpath && ./configure --prefix=$wrkdir/root
+ $makeprg bootstrap && $makeprg install && $makeprg clean && git pull &&
+ $makeprg genbootstrap && $vcs diff > update.patch"
+
+ ;;
+ *)
+ buildcmd="cd '$wrkdir/mc' && $setpath && ./configure --prefix=$wrkdir/root
+ $makeprg bootstrap && $makeprg install && $makeprg clean && git pull &&
+ $makeprg genbootstrap && $vcs diff > update.patch"
+ ;;
+ esac
+
+ $remotecmd "$buildcmd"
+ $remotecmd "$showpatch" | patch -p1
+}
+
+while IFS= read -r desc; do
+ if ! echo $desc | grep '^#'; then
+ build $desc < /dev/null
+ built=1
+ fi
+done < $BUILDHOSTS
+
+if [ -z "$built" ]; then
+ 1>&2 echo "WARNING: no hosts to build on: Please define hosts in $BUILDHOSTS, or set \$BUILDHOSTS"
+fi
+