-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsetup
73 lines (62 loc) · 2.36 KB
/
setup
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
project_remote_url="https://github.com/myTerminal/super-emacs.git"
project_dir_name=".super-emacs"
user_home_dir=$(cd "/home/$USER"; pwd -P)
emacs_dir_old=$user_home_dir/.emacs.d
emacs_dir_new=$user_home_dir/.config/emacs
# Determine the platform and target directory
platform=$(uname)
if [ $platform = 'Linux' ]; then
base_dir=$user_home_dir
project_dir=$base_dir/$project_dir_name
install_dir=$user_home_dir/.emacs.d
elif [ $platform = 'Darwin' ]; then
# TODO: Implement
echo "macOS found."
else
# TODO: Implement
echo "Unknown OS!"
fi
# Clone the git project at the appropriate path
git clone $project_remote_url $project_dir
# Check for existing Emacs config
if [ -d $emacs_dir_old ] || [ -d $emacs_dir_new ]; then
echo "Emacs config found. Setting up super-emacs will replace it. Are you sure? (y/n)?"
read -n1 -r -p "> " temp_user_response
if [ $temp_user_response == "y" ] || [ $temp_user_response == "Y" ]; then
echo -e "\nExisting Emacs config removed."
rm -rf $emacs_dir_old $emacs_dir_new
else
echo -e "\nSetup has ended without changes to your Emacs config."
exit 0
fi
fi
# Link Emacs directory to project directory
echo "Creating links to super-emacs..."
ln -s $project_dir/.emacs.d $emacs_dir_new
ln -s $project_dir/.emacs.d $emacs_dir_old
# Fetch crater-cli for temporary use
git clone https://github.com/crater-space/cli /tmp/crater-cli
# Install dependencies: fonts
echo "Installing font Liberation..."
mkdir -p ~/.local/share/fonts
mkdir ~/_temp
( cd ~/_temp; wget https://github.com/liberationfonts/liberation-fonts/files/6418984/liberation-fonts-ttf-2.1.4.tar.gz; tar -xvf liberation-fonts-ttf-2.1.4.tar.gz )
mkdir ~/.local/share/fonts/Liberation
mv ~/_temp/liberation-fonts-ttf-2.1.4/Liberation* ~/.local/share/fonts/Liberation/
rm -rf ~/_temp
# Install dependencies: aspell
echo "Install aspell for spell-check?"
read -n1 -r -p "> " temp_user_response
if [ $temp_user_response == "y" ] || [ $temp_user_response == "Y" ]; then
/tmp/crater-cli/crater install aspell
fi
# Install dependencies: R
echo "Install R for statistical computing?"
read -n1 -r -p "> " temp_user_response
if [ $temp_user_response == "y" ] || [ $temp_user_response == "Y" ]; then
/tmp/crater-cli/crater install r
fi
# Remove temporary crater-cli
rm -rf /tmp/crater-cli
echo "Setup for super-emacs has ended."