Minor updates to repair_assets

This commit is contained in:
Dave Morriss 2024-08-22 21:51:44 +01:00
parent d3c4f3907f
commit dd3bf0c981

View File

@ -15,15 +15,15 @@
# BUGS: --- # BUGS: ---
# NOTES: --- # NOTES: ---
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com # AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
# VERSION: 0.0.7 # VERSION: 0.0.8
# CREATED: 2024-05-10 21:26:31 # CREATED: 2024-05-10 21:26:31
# REVISION: 2024-08-04 19:40:52 # REVISION: 2024-08-22 21:48:44
# #
#=============================================================================== #===============================================================================
# set -o nounset # Treat unset variables as an error # set -o nounset # Treat unset variables as an error
VERSION="0.0.7" VERSION="0.0.8"
SCRIPT=${0##*/} SCRIPT=${0##*/}
# DIR=${0%/*} # DIR=${0%/*}
@ -62,14 +62,20 @@ source "$LIB"
define_colours define_colours
# #
# Sanity checks # Sanity checks. Calling 'command' on a non-existent script/program will
# return an empty string. This works for built-in stuff and things on the
# PATH.
# #
IA=$(command -v ia) IA=$(command -v ia)
[ -n "$IA" ] || { echo "Program 'ia' was not found"; exit 1; } [ -z "$IA" ] || { echo "Program 'ia' was not found"; exit 1; }
Q2T=$(command -v query2tt2) Q2T=$(command -v query2tt2)
[ -n "$Q2T" ] || { echo "Program 'query2tt2' was not found"; exit 1; } [ -z "$Q2T" ] || { echo "Program 'query2tt2' was not found"; exit 1; }
FIXAL="$BASEDIR/fix_asset_links" FIXAL="$BASEDIR/fix_asset_links"
[ -e "$FIXAL" ] || { echo "Program '$FIXAL' was not found"; exit 1; } [ -e "$FIXAL" ] || { echo "Program '$FIXAL' was not found"; exit 1; }
TUNNEL_IS_OPEN=$(command -v tunnel_is_open)
[ -z "$TUNNEL_IS_OPEN" ] || { echo "Program 'tunnel_is_open' was not found"; exit 1; }
OPEN_TUNNEL=$(command -v open_tunnel)
[ -z "$OPEN_TUNNEL" ] || { echo "Program 'open_tunnel' was not found"; exit 1; }
# #
# Make temporary files and set traps to delete them # Make temporary files and set traps to delete them
@ -591,10 +597,10 @@ fi
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if [[ $DRYRUN -eq 0 ]]; then if [[ $DRYRUN -eq 0 ]]; then
if [[ ! -e $DBNOTES ]]; then if [[ ! -e $DBNOTES ]]; then
if ! tunnel_is_open; then if ! $TUNNEL_IS_OPEN; then
open_tunnel $OPEN_TUNNEL
fi fi
if query2tt2 -config="$BASEDIR/.hpr_livedb.cfg" \ if $Q2T -config="$BASEDIR/.hpr_livedb.cfg" \
-temp="$BASEDIR/query2tt2_nokey.tpl" \ -temp="$BASEDIR/query2tt2_nokey.tpl" \
-out="$DBNOTES" \ -out="$DBNOTES" \
-dbarg="${show:3}" \ -dbarg="${show:3}" \
@ -610,7 +616,8 @@ if [[ $DRYRUN -eq 0 ]]; then
fi fi
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Adjust the notes with 'fix_asset_links' # Adjust the notes with 'fix_asset_links' (exists but not fully implemented
# yet :-)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if [[ $DRYRUN -eq 0 ]]; then if [[ $DRYRUN -eq 0 ]]; then
echo "$FIXAL" echo "$FIXAL"
@ -630,7 +637,7 @@ fi
# √ Download them from the IA # √ Download them from the IA
# √ Make a directory on the HPR server # √ Make a directory on the HPR server
# √ Copy the assets to the HPR server # √ Copy the assets to the HPR server
# Modify the notes to point to the assets on the server # Modify the notes to point to the assets on the server
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# vim: syntax=sh:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21:fdm=marker # vim: syntax=sh:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21:fdm=marker