2022-03-13 12:25:55 +01:00
|
|
|
#!/usr/bin/env bash
|
2022-03-12 11:38:34 +01:00
|
|
|
|
2022-09-22 18:56:50 +02:00
|
|
|
run_directory=$(dirname $(readlink -f "$0"))
|
2022-03-12 19:49:47 +01:00
|
|
|
user=$(whoami)
|
2022-03-12 12:37:24 +01:00
|
|
|
|
2022-03-17 15:08:12 +01:00
|
|
|
if [ -f $run_directory/.disabled ]; then
|
|
|
|
echo "Installation is disabled. Exiting..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2022-03-12 12:37:24 +01:00
|
|
|
if [[ $user != 'root' ]]; then
|
|
|
|
echo "Copying rcs to home directory..."
|
|
|
|
cp $run_directory/bashrc /home/$user/.bashrc
|
|
|
|
cp $run_directory/vimrc /home/$user/.vimrc
|
|
|
|
cp $run_directory/tmux.conf /home/$user/.tmux.conf
|
|
|
|
|
|
|
|
if ! command -v sudo &> /dev/null; then
|
|
|
|
echo "Could not copy to root directory: sudo was not found."
|
2022-03-12 12:15:06 +01:00
|
|
|
else
|
|
|
|
echo "Copying rcs to root directory..."
|
2022-03-12 12:37:24 +01:00
|
|
|
sudo cp $run_directory/bashrc /root/.bashrc
|
|
|
|
sudo cp $run_directory/vimrc /root/.vimrc
|
|
|
|
sudo cp $run_directory/tmux.conf /root/.tmux.conf
|
2022-03-12 12:15:06 +01:00
|
|
|
fi
|
|
|
|
|
2022-03-12 12:37:24 +01:00
|
|
|
else
|
2022-03-12 12:15:06 +01:00
|
|
|
echo "Copying rcs to root directory..."
|
|
|
|
cp $run_directory/bashrc /root/.bashrc
|
|
|
|
cp $run_directory/vimrc /root/.vimrc
|
|
|
|
cp $run_directory/tmux.conf /root/.tmux.conf
|
|
|
|
fi
|
2022-03-12 11:38:34 +01:00
|
|
|
|
|
|
|
echo "Finished install. Exiting..."
|
|
|
|
exit 0
|