#!/bin/bash

#GIT_STORE=/home/dbi/.git-credentials
sudo apt install -y git
sudo rm -rf /opt/.my_git_repos
sudo mkdir -p /opt/.my_git_repos
sudo chown root:sysadmin /opt/.my_git_repos
sudo chmod go+w /opt/.my_git_repos
cd /opt/.my_git_repos
#echo https://cartache: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@github.com > $GIT_STORE
#echo https://cartache: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@github.com > /opt/.my_git_repos/.git-credentials
#sudo chown dbi:dbi $GIT_STORE
#sudo chmod 600 $GIT_STORE
git config --global credential.helper store
git clone https://github.com/Cartache/denis_mbp.git
echo 'source /opt/.my_git_repos/denis_mbp/.bash_aliases' >> ~/.bashrc
touch ~/.bash_aliases_local
source /opt/.my_git_repos/denis_mbp/.bash_aliases
echo "source /opt/.my_git_repos/denis_mbp/.bash_aliases" >> /home/dbi/.bashrc
sudo chown dbi:dbi /home/dbi/.bashrc
sudo bash -c 'echo source /opt/.my_git_repos/denis_mbp/.bash_aliases >> /etc/profile'
sudo bash -c 'echo source /opt/.my_git_repos/denis_mbp/.bash_aliases >> /root/.bashrc'