commit eacecfa7739ba694e086f3ac9dc6c14ccaf3be9e
parent 1ae24197c53fd2a61fd1ab6c0a6dc66a58a71ffc
Author: parazyd <parazyd@dyne.org>
Date: Tue, 14 Feb 2017 23:39:16 +0100
final mars
Diffstat:
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,18 +1,18 @@
-DESTDIR = /var/www/html
+PREFIX = /var/www/html
all:
@./mars generate
push: all
- @./mars push
+ @./mars push -f
clean:
@./mars clean
install:
- cp -f Makefile ${DESTDIR}/Makefile
- cp -f mars ${DESTDIR}/mars
- cp -f rsync-exclude ${DESTDIR}/rsync-exclude
- cp -f webtree ${DESTDIR}/webtree
+ cp -f Makefile ${DESTDIR}${PREFIX}/Makefile
+ cp -f mars ${DESTDIR}${PREFIX}/mars
+ cp -f rsync-exclude ${DESTDIR}${PREFIX}/rsync-exclude
+ cp -f webtree ${DESTDIR}${PREFIX}/webtree
.PHONY: all push clean install
diff --git a/mars b/mars
@@ -1,4 +1,4 @@
-#!/bin/dash
+#!/bin/sh
# copyleft (c) parazyd 2016-2017
# see LICENSE file for license details
@@ -60,9 +60,22 @@ process() {
done
}
+push() {
+ [ "$1" = -f ] || {
+ printf "(*) do you want to rsync?\n"
+ printf "(enter to accept, ^C to quit)"
+ read dummy
+ }
+
+ rsync -P -e 'ssh' -avul --delete --stats \
+ --size-only \
+ --exclude-from 'rsync-exclude' \
+ . $WEBHOST:$WEBROOT
+}
+
case "$1" in
generate) process generate ;;
clean) process ;;
- push) push ;;
- *) printf "usage: %s {generate|clean|push}\n" "$(basename $0)" && exit 1 ;;
+ push) push $2;;
+ *) printf "usage: %s {generate|clean|push [-f]}\n" "$(basename $0)" && exit 1 ;;
esac