Add scripts and rules for server side handling

This is not tested and will be debugged on the server. Begin to
automate the on-server setup so we can make this a self-service
without much user interaction.
This commit is contained in:
Holger Hans Peter Freyther 2017-08-03 18:24:27 +08:00
parent e3f46e8a74
commit f5fbd4b8bd
4 changed files with 68 additions and 0 deletions

View File

@ -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"
@ -134,6 +136,16 @@ 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
ifndef SSH_HOST

11
README
View File

@ -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
....

17
scripts/dispatch.sh Normal file
View File

@ -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

28
scripts/make-stable.sh Executable file
View File

@ -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