-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_adam_aliases.sh
executable file
·45 lines (37 loc) · 1.17 KB
/
install_adam_aliases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $working_dir
source scripts/colors.sh
text_green
echo "Installing with directory: "$working_dir
text_reset
# # Check for previous install by looking to see if .adam_aliases/ already exists
DIR="$working_dir/.adam_aliases/"
if [ -d "$DIR" ]; then
text_red
echo "It looks like you've already run this install script"
echo "Skipping the install this time!"
text_reset
exit -1 # TODO allow force install?
fi
# Create directory to store aliases info
mkdir .adam_aliases
touch .adam_aliases/current_user
# Now we add stuff to the bashrc
echo "" >> ~/.bashrc
echo "export ALIASES_DIR="$working_dir >> ~/.bashrc
echo "source $working_dir/.adam_aliases.bashrc" >> ~/.bashrc
# Ask if configure new user
echo "Do you want to configure a new user?"
read -p "'n' if you are already have a user stored in this repo (y/n) " resp
if [[ "$resp" = "y" ]]; then
# Run the new user script
export ALIASES_DIR=$working_dir
cd $working_dir
./new_user_config.sh
else # Not configure new user
text_red
echo "Not configuring new user"
echo "Make sure to 'source_USER' after this!"
text_reset
fi