Skip to content

Instantly share code, notes, and snippets.

@AndersDJohnson
Last active June 5, 2019 13:34
Show Gist options
  • Save AndersDJohnson/5042332 to your computer and use it in GitHub Desktop.
Save AndersDJohnson/5042332 to your computer and use it in GitHub Desktop.
installer for linux binaries
#!/bin/bash
# Copies local files and directories to root path.
# Run this from the directory of the distr
_SRCDIR="./"
_SRCDIR_SED="\\./"
_INSTALLDIR="/"
_INSTALLDIR_SED="\/"
_DIRS=`find "$_SRCDIR" -type d`
# assumes an filename argument
function _install_prefix {
echo $1 | sed "s/^${_SRCDIR_SED}/${_INSTALLDIR_SED}/"
}
for _DIR in $_DIRS
do
mkdir -p "`_install_prefix $_DIR`"
done
_FILES=`find "$_SRCDIR" -type f`
for _FILE in $_FILES
do
cp "$_FILE" "`_install_prefix $_FILE`"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment