summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdicewords2
-rwxr-xr-xletsencrypt-helpers/make-combined-crt2
-rwxr-xr-xletsencrypt-helpers/request-letsencrypt2
-rwxr-xr-xpublish34
-rwxr-xr-xpublish-purge2
-rwxr-xr-xpvinfo2
-rwxr-xr-xqr25
7 files changed, 56 insertions, 13 deletions
diff --git a/dicewords b/dicewords
index 49d9230..5bb4ddc 100755
--- a/dicewords
+++ b/dicewords
@@ -36,5 +36,5 @@ if ! [ -e "$dictionary" ]; then
exit 1
fi
-egrep '^[a-z]{1,6}$' "$dictionary" | shuf | head -n "$count" | tr '\n' '-' | sed -e 's/-$//'
+egrep '^[a-z]{1,6}$' "$dictionary" | shuf | head -n "$count" | tr '\n' '.' | sed -e 's/\.$//'
echo
diff --git a/letsencrypt-helpers/make-combined-crt b/letsencrypt-helpers/make-combined-crt
index 531335f..885ee16 100755
--- a/letsencrypt-helpers/make-combined-crt
+++ b/letsencrypt-helpers/make-combined-crt
@@ -99,7 +99,7 @@ fi
(
cat "$chain"
-size=$(openssl rsa < "$cn".key -text -noout | awk -F: '$1 == "Private-Key" {print $2}' | sed -e 's/[^0-9]//g')
+size=$(openssl rsa < "$cn".key -text -noout | awk -F: '$1 ~ "Private-Key" {print $2}' | sed -r 's/[^0-9]*([0-9]*).*/\1/g')
if [ -e extra/dh-"$size".pem ]; then
cat extra/dh-"$size".pem;
else
diff --git a/letsencrypt-helpers/request-letsencrypt b/letsencrypt-helpers/request-letsencrypt
index 06bb266..f20dab0 100755
--- a/letsencrypt-helpers/request-letsencrypt
+++ b/letsencrypt-helpers/request-letsencrypt
@@ -43,7 +43,7 @@ tmp="`tempfile`"
trap "rm -f '$tmp'" EXIT
echo $PATH
-acme --account-key ~/account.key --csr "$cn".csr --acme-dir ~/acme-challenge/ > "$tmp"
+acme --disable-check --account-key ~/account.key --csr "$cn".csr --acme-dir ~/acme-challenge/ > "$tmp"
if [ -e "$cn-letsencrypt.pem" ]; then
savelog "$cn-letsencrypt.pem"
fi
diff --git a/publish b/publish
index ff4c42a..af3eb0e 100755
--- a/publish
+++ b/publish
@@ -63,6 +63,9 @@ else
clipper=true
fi
+# the screenshot tool, expected take a screenshot of whatever and
+# write the image in the argument provided
+screenshot=import
rsync_pre_invoke() { true ;}
rsync_post_invoke() { true ;}
@@ -82,6 +85,7 @@ OPTIONS:
-8 Add a AddDefaultCharset UTF-8 .htaccess file.
-c CF Use config file CF.
-H Show the history.
+ -l Show last used token.
-s FN When reading data from stdin, use FN as filename to be published.
-S Make a screenshot of one window and publish.
-h Show this message.
@@ -94,6 +98,7 @@ OPTIONS:
-T tag directory name on the server (use this to re-publish under that name)
-x Publish the contents of the xclipboard.
-u Unpublish directory (only useful together with -T)
+ -L Follow symlinks
EOF
}
@@ -114,6 +119,16 @@ history_append() {
mv "$history_tmp" "$history_file"
}
+history_last() {
+ if [ -r "$history_file" ]; then
+ tail -1 "$history_file" | cut -d' ' -f3
+ return 0
+ else
+ echo "history file: '$history_file' not found"
+ return 3
+ fi
+}
+
history_show() {
cat "$history_file"
}
@@ -139,7 +154,7 @@ relative=""
d_server=""
unpublish=0
-while getopts "rRhnq8HSxc:s:t:T:u" OPTION
+while getopts "rRhnq8HSxc:s:t:T:uL" OPTION
do
case $OPTION in
h)
@@ -167,6 +182,10 @@ do
exit 3
fi
;;
+ l)
+ history_last
+ exit $?
+ ;;
S)
do_screenshot=1
;;
@@ -196,6 +215,9 @@ do
u)
unpublish=1
;;
+ L)
+ rsync_args="$rsync_args -L"
+ ;;
*)
usage >&2
exit 1
@@ -221,12 +243,16 @@ fi
if [[ "$do_screenshot" -gt 0 ]]; then
setup_tmpdir
img="$tmpdir/screenshot.png"
- import "$img"
+ $screenshot "$img"
chmod a+r "$img"
set dummy "$img" "$@"
shift
fi
+is_text() {
+ file -b -i "$1" | grep -q ^text
+}
+
if [[ "$#" = 0 ]]; then
setup_tmpdir
if [ "${name_stdin%-}" != "" ]; then
@@ -255,6 +281,10 @@ if [[ "$#" = 0 ]]; then
exit 1
fi
fi
+ if [ "${name_stdin%-}" == "" ] && is_text "$stdin" ; then
+ mv "$stdin" "$stdin.txt"
+ stdin="$stdin.txt"
+ fi
set dummy "$stdin"
shift
elif [ "$inputxclip" = 1 ] ; then
diff --git a/publish-purge b/publish-purge
index 0be0fd7..cc17338 100755
--- a/publish-purge
+++ b/publish-purge
@@ -67,7 +67,7 @@ cleanit()
fi
fi
- if test_if_ancient "$d" "$ttl"; then
+ if [ "$ttl" -gt 0 ] && test_if_ancient "$d" "$ttl"; then
[ "$optVerbose" -ge "1" ] && echo "- Purging: $d"
[ "$optDonot" = "1" ] || rm -rf "$d"
fi
diff --git a/pvinfo b/pvinfo
index b2380ac..33df34a 100755
--- a/pvinfo
+++ b/pvinfo
@@ -99,7 +99,7 @@ VG: while (<LVD>) {
if ( m/^ --- Logical volume ---/ ) {
next VG;
}
- if ( m/^ Logical extent (\d+) to (\d+):$/ ) {
+ if ( m/^ Logical extents? (\d+) to (\d+):$/ ) {
$from = $1;
$to = $2;
next;
diff --git a/qr b/qr
index 287c852..4c82369 100755
--- a/qr
+++ b/qr
@@ -27,18 +27,21 @@ usage()
{
cat << EOF
usage: $0 -m <MSG>
+ $0 -w <essid> <password>
$0 [options] [<file>]
OPTIONS:
-m <MSG> Use MSG instead of reading input from file/stdin.
-M Add a/Include the trailing newline for single-line data.
+ -w <essid> <password> Create a wifi qr code.
EOF
}
msg=""
have_msg=0
multi_line=0
-while getopts "hm:M" OPTION
+wifi=0
+while getopts "hm:Mw" OPTION
do
case $OPTION in
h)
@@ -52,6 +55,9 @@ do
have_msg=1
msg="$OPTARG"
;;
+ w)
+ wifi=1
+ ;;
*)
usage >&2
exit 1
@@ -61,22 +67,29 @@ done
shift $(($OPTIND - 1))
-img="$(tempfile --suffix .png)"
+img="$(mktemp --suffix .png)"
trap "rm -f '$img'" EXIT
-if [ "$have_msg" -eq 0 ]; then
+if [ "$wifi" -gt 0 ]; then
+ if [ "$#" -ne 2 ]; then
+ usage >&2
+ exit 1
+ fi
+ essid="$1"; shift
+ password="$1"; shift
+ echo "WIFI:T:WPA;S:${essid};P:${password};;" | qrencode -s 5 -l H -o "$img"
+elif [ "$have_msg" -eq 0 ]; then
if [ "$#" -gt 1 ]; then
usage >&2
exit 1
fi
if [ "$#" -eq 0 ]; then
- stdin="$(tempfile)"
+ stdin="$(mktemp)"
trap "rm -f '$img' '$stdin'" EXIT
cat > "$stdin"
- set dummy "$stdin"
- shift
+ set -- "$stdin"
fi
fn="$1"; shift