updated setup for latest apache script dependency
[iankelling.org] / set-comments
index 5694629e8afcd8bd0b9b53d99ddf62d29792ca93..b87f21166932f9f7ec24b9b2c21f267f488adf3a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 # Copyright (C) 2016 Ian Kelling
 
 # This program is free software: you can redistribute it and/or modify
@@ -20,7 +20,7 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 cd "${BASH_SOURCE%/*}/proposed-comments"
 
 
-shell="ssh iankelling.org"
+shell="ssh -oStrictHostKeyChecking=no $(chost iankelling.org)"
 while [[ $1 ]]; do
     case $1 in
         -a) all=true; shift ;;
@@ -32,6 +32,10 @@ s="$shell sqlite3 $PWD/comments.sqlite"
 
 grep -Eo '^[^|]+\|[^|]+' /tmp/hcomments | while IFS='|' read -r id state; do
     #echo "$id -- $state" # debug print
-    sqlite3 comments.sqlite "update c set state='$state' where id = '$id'"
+    if [[ $state == delete ]]; then
+        $s <<<"delete from c where id = '$id';"
+    else
+        $s <<<"update c set state='$state' where id = '$id';"
+    fi
 done
 $shell $PWD/../build.rb