iankelling.org
/
git
/
mediawiki-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
get 1.28 changes, small doc addition
[mediawiki-setup]
/
get-wiki-snapshot
diff --git
a/get-wiki-snapshot
b/get-wiki-snapshot
index 578732ba0c1f185fdafd716014c75dde94617e68..b89bafa7f122a5e5ab8c7a6618e251d58869a2f5 100755
(executable)
--- a/
get-wiki-snapshot
+++ b/
get-wiki-snapshot
@@
-4,6
+4,9
@@
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+# usage: get-wiki-snapshot [-l]
+# -l means generate script from local guide, don't download new one.
+
cd "${BASH_SOURCE%/*}"
cd "${BASH_SOURCE%/*}"
@@
-13,7
+16,7
@@
start=' *<source lang="bash"> *'
end=' *<\/source> *'
if [[ $1 != -l ]]; then # use local file
end=' *<\/source> *'
if [[ $1 != -l ]]; then # use local file
-
ruby <<'EOF' > $page_file
+ ruby <<'EOF' > $page_file
require 'json'
puts JSON.parse(`curl -k 'https://ofswiki.org/w/api.php?\
action=query&titles=Mediawiki_Setup_Guide&prop=revisions&rvprop=content&\
require 'json'
puts JSON.parse(`curl -k 'https://ofswiki.org/w/api.php?\
action=query&titles=Mediawiki_Setup_Guide&prop=revisions&rvprop=content&\
@@
-25,6
+28,7
@@
fi
#!/bin/bash
# Copyright (C) 2016 Ian Kelling
# This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
#!/bin/bash
# Copyright (C) 2016 Ian Kelling
# This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
+set -x
EOF
sed -rn "/^$start$/,/^$end$/{s/^($start|$end)$/# \0/;p}" $page_file
} > $script_file
EOF
sed -rn "/^$start$/,/^$end$/{s/^($start|$end)$/# \0/;p}" $page_file
} > $script_file