#!/bin/sh

TMP_PATH=/tmp
SOURCE_FILE=.iterm2_shell_integration.bash
if [ ! -f /opt/$SOURCE_FILE ] ; then
    DOWNLOAD_UNIT=$TMP_PATH/$SOURCE_FILE
    curl -L https://iterm2.com/shell_integration/bash -o $DOWNLOAD_UNIT
else
    DOWNLOAD_UNIT=/opt/$SOURCE_FILE
fi

DEST_PATH=/home/dbi 
DEST_FILE_FULL=$DEST_PATH/$SOURCE_FILE
cp $DOWNLOAD_UNIT $DEST_FILE_FULL
chown dbi:dbi $DEST_FILE_FULL
chmod 770 $DEST_FILE_FULL
echo "source $DEST_FILE_FULL" >> /etc/.profile

DEST_PATH=/root
DEST_FILE_FULL=$DEST_PATH/$SOURCE_FILE
cp $DOWNLOAD_UNIT $DEST_FILE_FULL
echo "source $DEST_FILE_FULL" >> /etc/.profile

rm $DOWNLOAD_UNIT



