This commit is contained in:
Greg DiCristofaro 2022-09-14 10:46:01 -04:00
parent 238c75a100
commit 9cee1e413e
2 changed files with 8 additions and 5 deletions

View File

@ -44,7 +44,7 @@ if [[ -z "$APPLICATION_ZIP_PATH" ]] && [[ ! -d "$INSTALL_DIR" ]]; then
fi fi
# check against the asc file if the zip exists # check against the asc file if the zip exists
if [[ -n "$ASC_FILE" ]] && [[ -n "$APPLCATION_ZIP_PATH" ]]; then if [[ -n "$ASC_FILE" ]] && [[ -n "$APPLICATION_ZIP_PATH" ]]; then
VERIFY_DIR=$(pwd)/temp VERIFY_DIR=$(pwd)/temp
KEY_DIR=$VERIFY_DIR/private KEY_DIR=$VERIFY_DIR/private
mkdir -p $VERIFY_DIR && mkdir -p $VERIFY_DIR &&
@ -65,7 +65,7 @@ ZIP_NAME="${ZIP_FILE_NAME%.*}"
APPLICATION_EXTRACTED_PATH=$INSTALL_DIR/$ZIP_NAME/ APPLICATION_EXTRACTED_PATH=$INSTALL_DIR/$ZIP_NAME/
# if specifying a zip path, ensure directory doesn't exist and then create and extract # if specifying a zip path, ensure directory doesn't exist and then create and extract
if [[ -n "$APPLCATION_ZIP_PATH" ]]; then if [[ -n "$APPLICATION_ZIP_PATH" ]]; then
if [[ -d $APPLICATION_EXTRACTED_PATH || -f $APPLICATION_EXTRACTED_PATH ]]; then if [[ -d $APPLICATION_EXTRACTED_PATH || -f $APPLICATION_EXTRACTED_PATH ]]; then
echo "A file or directory already exists at $APPLICATION_EXTRACTED_PATH" >>/dev/stderr echo "A file or directory already exists at $APPLICATION_EXTRACTED_PATH" >>/dev/stderr
exit 1 exit 1
@ -81,7 +81,10 @@ if [[ -n "$APPLCATION_ZIP_PATH" ]]; then
fi fi
echo "Setting up application at $APPLICATION_EXTRACTED_PATH..." echo "Setting up application at $APPLICATION_EXTRACTED_PATH..."
pushd $APPLICATION_EXTRACTED_PATH && # find unix_setup.sh in least nested path (https://stackoverflow.com/a/40039568/2375948)
UNIX_SETUP_PATH=`find $APPLICATION_EXTRACTED_PATH -name 'unix_setup.sh' -printf "%d %p\n"| sort -n | perl -pe 's/^\d+\s//;' | head -n1 | xargs -I{} dirname {}`
pushd $UNIX_SETUP_PATH &&
chown -R $(whoami) . && chown -R $(whoami) . &&
chmod u+x ./unix_setup.sh && chmod u+x ./unix_setup.sh &&
./unix_setup.sh -j $JAVA_PATH -n $APPLICATION_NAME && ./unix_setup.sh -j $JAVA_PATH -n $APPLICATION_NAME &&
@ -90,5 +93,5 @@ if [[ $? -ne 0 ]]; then
echo "Unable to setup permissions for application binaries" >>/dev/stderr echo "Unable to setup permissions for application binaries" >>/dev/stderr
exit 1 exit 1
else else
echo "Application setup done." echo "Application setup done. You can run $APPLICATION_NAME from $UNIX_SETUP_PATH/bin/$APPLICATION_NAME."
fi fi

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Clones sleuthkit repo from github (if necessary) and installs # Clones sleuthkit repo from github (if necessary) and installs
# this script does require sudo privileges # this script does require sudo privileges
# called like: build_tsk.sh -r <repo path to be created or existing> -b <tsk branch to checkout> -r <non-standard remote repo (optional)> # called like: build_tsk.sh -p <repo path to be created or existing> -b <tsk branch to checkout> -r <non-standard remote repo (optional)>
usage() { usage() {
echo "Usage: install_tsk_from_src [-p repo_path (should end with '/sleuthkit')] [-b tsk_branch] [-r sleuthkit_repo]" 1>&2 echo "Usage: install_tsk_from_src [-p repo_path (should end with '/sleuthkit')] [-b tsk_branch] [-r sleuthkit_repo]" 1>&2