Skip to content

Instantly share code, notes, and snippets.

@graphicore
Last active December 5, 2016 12:20
Show Gist options
  • Save graphicore/a83eeb8829ba64a628c8872092910515 to your computer and use it in GitHub Desktop.
Save graphicore/a83eeb8829ba64a628c8872092910515 to your computer and use it in GitHub Desktop.
ftxvalidator drop in replacement: Execute the Mac OS tool `ftxvalidator` on a remote host.
#! /bin/bash
# Copyright 2016 Lasse Fister <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script let's you execute the Mac OS tool `ftxvalidator` on a remote host.
# Put it in your local `bin` as a drop in replacement.
# You must add your clients ssh public key to .ssh/authorized_keys on the remote machine.
# Limitations:
# The remote temporary filename is not generated very cleverly.
# Don't use this in parallel with the same font filenames!
# Configuration for ssh and scp, please change accordingly:
SSH_PORT=22
REMOTE_LOGIN="username@remote_host"
# the last argument is the local file name
localfile=("${@:$#}")
base=`basename $localfile`
remotefile=/tmp/$base
# make an array form the arguments
ARGS=( "$@" )
# remove the filename
unset ARGS[${#ARGS[@]}-1]
# add the new file name
ARGS+=($remotefile)
scp -P $SSH_PORT $localfile $REMOTE_LOGIN:$remotefile
ssh -p $SSH_PORT $REMOTE_LOGIN "ftxvalidator ${ARGS[@]}"
exitstatus=$?
# cleanup
ssh -p $SSH_PORT $REMOTE_LOGIN "unlink $remotefile"
exit $exitstatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment