commit 71ee27c91d79958bc45346803734c02d113fef69
parent 39701f863e337a489d5af66901af8a8ad593f63f
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 23 Nov 2019 12:44:33 +0100
Merge branch 'master' of a3nm.net:git/mybin
Diffstat:
6 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/calendar-backup.sh b/calendar-backup.sh
@@ -1,12 +1,13 @@
#!/bin/bash
+set -e
+
# run with chronic to avoid spam
-mkdir -p ~/backup/calendar
-cd; cd ~/backup/calendar/ # required to have the right paths in the archive
+cd /mnt/mem/backup/calendar # required to have the right paths in the archive
# avoid "file changed as we read it" errors from tar
-cp -Rv calendar_current calendar_backup
+cp -R calendar_current calendar_backup
FILE="dump-`date +%s`"
tar cf ${FILE}.tar calendar_backup
xz ${FILE}.tar
diff --git a/cpupload b/cpupload
@@ -2,7 +2,7 @@
# cp file to upload directory
FILE="$1"
-OFILE="${2:-$FILE}"
+OFILE="${2:-$(basename $FILE)}"
DEST=~browser2/uploads
sudo cp -i "$FILE" "$DEST/$OFILE"
sudo chown browser2:browser2 "$DEST/$OFILE"
diff --git a/dropbox b/dropbox
@@ -38,7 +38,7 @@ then
exit 2
fi
-BADL=$(xhost | sed 1d | grep -v "SI:localuser:$ID" |
+BADL=$(xhost 2>/dev/null | sed 1d | grep -v "SI:localuser:$ID" |
grep -vE "SI:localuser:(browser|browser2|bitcoin)" | wc -l)
if [ $BADL -gt 0 ]
then
@@ -118,7 +118,7 @@ fi
# now everything is in order
-grep -qs "^bindfs $ENDPOINT " /proc/mounts || (
+grep -qs " $ENDPOINT fuse " /proc/mounts || (
echo "$ENDPOINT was not mounted, mounting it"
sudo bindfs --create-for-user=$(id -u dropbox) \
--create-for-group=$(id -g dropbox) \
diff --git a/find-reminder.sh b/find-reminder.sh
@@ -4,9 +4,14 @@ ID="$1"
atq | cut -f1 | while read job;
do
FILE=`at -c $job | grep 'reminder-send.sh' | cut -d ' ' -f2`
- if grep "^In-Reply-To: $ID" ~/logs/reminder/$FILE > /dev/null
+ if [ -n "$FILE" ]
then
- echo $job
+ if grep "^In-Reply-To: $ID" ~/logs/reminder/$FILE > /dev/null
+ then
+ echo $job
+ fi
+ else
+ echo "WARNING: no file found for job: $job"
fi
done
diff --git a/luks_mount b/luks_mount
@@ -3,15 +3,24 @@
set -e
VOLUME="$1"
+MACHINE="$2"
+if [ -z $MACHINE ]
+then
+ COMMAND=""
+else
+ COMMAND="ssh $MACHINE"
+fi
+ID=$(duuid "$VOLUME")
+
KEY="$HOME/credentials/$VOLUME.key"
FOLDER="/mnt/$VOLUME"
if [ -f "$KEY" ]
then
- sudo cryptsetup luksOpen --key-file "$KEY" $(duuid "$VOLUME") "$VOLUME"
+ cat "$KEY" | $COMMAND sudo cryptsetup luksOpen --key-file=- "$ID" "$VOLUME"
else
- sudo cryptsetup luksOpen $(duuid "$VOLUME") "$VOLUME"
+ $COMMAND sudo cryptsetup luksOpen "$ID" "$VOLUME"
fi
-sudo mkdir -p "$FOLDER"
-sudo mount "/dev/mapper/$VOLUME" "$FOLDER"
+$COMMAND sudo mkdir -p "$FOLDER"
+$COMMAND sudo mount "/dev/mapper/$VOLUME" "$FOLDER"
diff --git a/show-reminder.sh b/show-reminder.sh
@@ -1,5 +1,6 @@
#!/usr/bin/zsh
+# TODO: sometimes the message-ID is on a separate line after "Message-ID:"
grep -i '^Message-id' | cut -d ' ' -f2 | while read l;
do
echo "Scheduled reminders for $l:"