diff --git a/Makefile b/Makefile index 99f4899..33fbf39 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,8 @@ help: printf " %-16s - Configure build directory\\n" $(machine)-build;) @$(foreach machine, $(MACHINES), \ printf " %-16s - Configure build directory\\n" $(machine)-upload;) + @echo "Server targets:" + @echo " make-server-structure - Create directories for machine/release" @echo "Available variables:" @echo " V=1 - Enable verbose command output" @echo " SYSMOCOM_RELEASE=name - Pick branch during clone" @@ -133,6 +135,16 @@ build-all: | $(foreach machine, $(MACHINES), $(machine)-build) upload-all: | $(foreach machine, $(MACHINES), $(machine)-upload) clean-all: | $(foreach machine, $(MACHINES), $(machine)-clean) + +make-server-structure: +ifndef WEB_FILES + $(error "Please call with make make-server-structure WEB_FILES=...") +endif + $(Q)$(foreach machine, $(MACHINES), \ + mkdir $(WEB_FILES)/$(machine)/$(SYSMOCOM_RELEASE); \ + mkdir $(WEB_FILES)/$(machine)/$(SYSMOCOM_RELEASE)-testing; \ + mkdir $(WEB_FILES)/$(machine)/$(SYSMOCOM_RELEASE)-nightly; \ + ) install-ssh-config: | $(HOME)/.ssh diff --git a/README b/README index c23d395..93a85fa 100644 --- a/README +++ b/README @@ -43,3 +43,14 @@ Example of building everything $ make clean-all # Clean the tmp directory for all boards ... + + +Server side set-up: + +On the server we need scripts to copy from -testing to -stable. It is a simple +script and it is the easiest if we bind it to ssh keys. It should be a self +service for the developers. + +.... +command="/home/user/system-images/scripts/dispatch.sh" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC7ZJ339MQh1ctTP3UyRQSpdjcJmG8tafd+akq6cmplSuG6j8BZH38u38Zvf7+WLvMBsluujfj7lkuPA/vzP5c6YHBBWOoT+5moRxpEdLXzUPzxA2l+1Nfgd+pd4mvmV9WI22dY6mtDXtOZxXoG8sAXZe/RoUN9MTzayJVkUtp76SW5eiVT519kQGRRaHEFvEqis9t9K5wJN/CVD7uDudpel0ljtkRh4K0KFTUJLVG7bXu5CAOc61JGoeoAb0z/0DL5Nnlxe9P9eMHKqFSqC97xovtRGy1U+2EAVuWY2N32G0VuXpIisBrx/FGxChWp3V5q5KurlkrnV/Rq3dBmKwykAYTQRMrx6mMatiAxFnVnkXYnjFwGC5AdEO2iw865TJ1riv6uZsDviVxFK79BQnkLkFBNLWdfIiYP2j4mMSGsK4xpDXUFAP7xDoVzLO1ZyaJcqF/DCyS4sZ/cYcj0lW2pKxSkFE4Mv2zO4Zwgu7t1EmKjR6SDfzZ+wfSfcjAytwA9l6NfMlLvMy1bL+b5I4UHvZJD1nxpdzByKuTZ11/6o/BN+anrj+SqsXUrD7k9q3LhdMMAJf3lxG0ZVV81FZm6jh/XsO9FwoAzXwqezeJpnaNSqb4alYl/P/7xoFuNQjxZmomROIFMdOAOL8ius+Bz28k1va93tSgkPpr6YUJBaQ== .ssh/id_rsa-new +.... diff --git a/scripts/dispatch.sh b/scripts/dispatch.sh new file mode 100644 index 0000000..6fde0ec --- /dev/null +++ b/scripts/dispatch.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Dispatch based on SSH_ORIGINAL_COMMAND. rsync, diff and merge. +# TODO: Make this interactive and show the diff before and then +# do the merge? + +case "$SSH_ORIGINAL_COMMAND" in + "rsync") + exec /usr/local/bin/rrsync web-files + ;; + "diff-testing") + exec `dirname $0`/make-stable.sh $1 $2 dry-run + ;; + "merge-testing") + exec `dirname $0`/make-stable.sh $1 $2 + ;; +esac diff --git a/scripts/make-stable.sh b/scripts/make-stable.sh new file mode 100755 index 0000000..ba0145f --- /dev/null +++ b/scripts/make-stable.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Merge -testing into -stable by using hard links so we don't +# double the space requirement. + +if [ $# -lt 2 ]; then + echo "Need to pass MACHINE RELEASE as argument for upload" + exit 1 +fi + +MACHINE=$1 +RELEASE=$2 +DRYRUN=$3 + +if [ "x$DRYRUN" != "x" ]; then + ARGS=--dry-run +fi + +DIRS=images ipk sdk tools cache-state; + +for i in $DIRS; +do + echo "Working on $i" + rsync $ARGS --delete -avH \ + --link-dest=$PWD/web-files/$MACHINE/$RELEASE-testing/$i \ + web-files/$MACHINE/$RELEASE-testing/$i/ \ + web-files/$MACHINE/$RELEASE/$i/ +done