Last active
December 5, 2016 12:20
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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