summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapps/plugins/puzzles/genhelp.sh6
-rwxr-xr-xapps/plugins/puzzles/resync.sh44
2 files changed, 47 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/genhelp.sh b/apps/plugins/puzzles/genhelp.sh
index 9aa304c0c1..3df7706b5d 100755
--- a/apps/plugins/puzzles/genhelp.sh
+++ b/apps/plugins/puzzles/genhelp.sh
@@ -1,10 +1,10 @@
1#!/bin/bash 1#!/bin/bash
2# usage: ./genhelp.sh 2# usage: ./genhelp.sh
3# 3#
4# expects halibut to be installed in $PATH: 4# Expects halibut to be installed in $PATH:
5# http://www.chiark.greenend.org.uk/~sgtatham/halibut 5# https://www.fwei.tk/git/halibut
6# 6#
7# also requires host CC and lz4 library to be available 7# Also requires host CC and lz4 library to be available
8 8
9halibut --text src/puzzles.but 9halibut --text src/puzzles.but
10 10
diff --git a/apps/plugins/puzzles/resync.sh b/apps/plugins/puzzles/resync.sh
new file mode 100755
index 0000000000..76679971a4
--- /dev/null
+++ b/apps/plugins/puzzles/resync.sh
@@ -0,0 +1,44 @@
1#!/bin/sh
2# Usage: resync.sh PUZZLES_PATH
3#
4# Automatic resync tool. Removes the current source snapshot in src/
5# and copies just the source files we need from the puzzles source
6# tree. Handles help generation as well. Stages changes in git.
7#
8# Expects a modified Halibut (https://www.fwei.tk/git/halibut) to be
9# installed in $PATH. Also requires host CC and lz4 library to be
10# available
11
12
13if [ $# -ne 1 ]
14then
15 echo -e "Usage: $0 PUZZLES_PATH\n"
16 echo "Automatically resync with upstream."
17 echo "PUZZLES_PATH is the path to a puzzles source tree."
18 exit
19fi
20
21echo "=== POTENTIALLY DANGEROUS OPERATION ==="
22echo "Are you sure you want to remove all files in src/?"
23echo -n "If so, type \"yes\" in all caps: "
24read ans
25if [ "YES" == $ans ]
26then
27 pushd "$(dirname "$0")" > /dev/null
28
29 echo "[1/5] Removing current src/ directory"
30 rm -rf src
31 echo "[2/5] Copying new sources"
32 mkdir src
33 cp -r "$1"/{*.c,*.h,*.R,*.but,LICENCE,README} src
34 echo "[3/5] Regenerating help"
35 ./genhelp.sh
36
37 echo "[4/5] Staging for commit"
38 git add src help
39 echo "[5/5] Successfully resynced with upstream"
40
41 popd > /dev/null
42else
43 echo "Did nothing."
44fi