#!/bin/bash
mkdir -p "$HOME/.opt/bin"
tar -xf gm_key_64.gz -C "$HOME"
tar -xf genemark_suite_linux_64.tar.gz -C "$HOME/.opt"
tar -xf gm_et_linux_64.tar.gz -C "$HOME/.opt"

while read -r BINARY
do
        ln -sf "$BINARY" "$HOME/.opt/bin/$(basename "$BINARY")"
done < <(find "$HOME/.opt/genemark_suite_linux_64/" -type f  -executable)

while read -r BINARY
do
        ln -sf "$BINARY" "$HOME/.opt/bin/$(basename "$BINARY")"
done < <(find "$HOME/.opt/gm_et_linux_64/" -type f  -executable)


while read -r PERL_SCRIPT
do
        sed -i -e 's:#!/usr/bin/perl:#!/usr/bin/env perl:' "$(readlink -f "$PERL_SCRIPT")"
done < <(find "$HOME/.opt/bin" -type l -iname '*.pl')
