-
Notifications
You must be signed in to change notification settings - Fork 6
/
installer.sh
executable file
·130 lines (110 loc) · 5.46 KB
/
installer.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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
set -e
readonly SPACEMACS_URL=https://github.com/syl20bnr/spacemacs
readonly SPACEMACS_DIR=${HOME}/.emacs.d
readonly DOTSPACEMACS_DIR=${HOME}/.spacemacs.d
readonly BACKUP_SUFFIX="backup-$(date +"%Y%m%d-%H%M%S")"
readonly DOTSPACEMACS_BRANCH="${1:-master}"
###############################################################################
# Install Spacemacs #
###############################################################################
function install_spacemacs {
sudo snap install emacs --classic
if [ -d "${SPACEMACS_DIR}" ]; then
if [ "$(cd "${SPACEMACS_DIR}" && git config --get remote.origin.url)" = "${SPACEMACS_URL}" ]; then
cd ${SPACEMACS_DIR} && git stash && git checkout develop && git pull
else
mv -v ${SPACEMACS_DIR} ${SPACEMACS_DIR}.${BACKUP_SUFFIX} && git clone "${SPACEMACS_URL}" -b develop ${SPACEMACS_DIR}
fi
else
git clone "${SPACEMACS_URL}" -b develop ${SPACEMACS_DIR}
fi
[[ -d "${DOTSPACEMACS_DIR}" ]] && mv -v ${DOTSPACEMACS_DIR} ${DOTSPACEMACS_DIR}.${BACKUP_SUFFIX}
git clone https://github.com/Maverobot/dot-spacemacs.git --recurse-submodules -b ${DOTSPACEMACS_BRANCH} ${DOTSPACEMACS_DIR}
}
###############################################################################
# Install dependencies #
###############################################################################
function install_dependencies {
sudo apt update
sudo apt install -y entr xclip build-essential cmake g++ gcc \
python3-dev python3-pip python3-wheel python3-venv python3-setuptools \
libz-dev libtinfo-dev libpq-dev sqlite3
sudo python3 -m pip install wheel
sudo snap install --channel=edge shellcheck
sudo snap install shfmt
pip3 install --user yapf offlineimap
pip3 install --user cmake-language-server cmake-format
# Install fonts
curl -Ls https://github.com/hbin/top-programming-fonts/raw/master/install.sh | bash
# Install ripgrep as an alternative to `grep`
curl -LOs https://github.com/BurntSushi/ripgrep/releases/download/11.0.2/ripgrep_11.0.2_amd64.deb
sudo dpkg -i ripgrep_11.0.2_amd64.deb
# Install fd as an alternative to `find`
curl -LOs https://github.com/sharkdp/fd/releases/download/v8.1.1/fd_8.1.1_amd64.deb
sudo dpkg -i fd_8.1.1_amd64.deb
# Create ~/org folder if not yet present
mkdir ~/org -p
}
###############################################################################
# Compile groovy language server #
###############################################################################
function compile_groovy_language_server {
(
rm /tmp/groovy-language-server -rf && cd /tmp
git clone https://github.com/prominic/groovy-language-server.git
cd groovy-language-server && ./gradlew build
cp -v build/libs/groovy-language-server-all.jar ${DOTSPACEMACS_DIR}/
)
}
function download_plantuml {
(
cd ${DOTSPACEMACS_DIR}
wget -nc -q --show-progress http://sourceforge.net/projects/plantuml/files/plantuml.jar
)
}
###############################################################################
# Compile ccls (C/C++/ObjC language server) #
###############################################################################
function compile_ccls {
(
cd ${DOTSPACEMACS_DIR} && ./build_ccls.sh
)
}
###############################################################################
# Update Spacemacs and Get ready #
###############################################################################
function update_spacemacs {
# Installs missing packages and it can fail
/snap/bin/emacs -l ${SPACEMACS_DIR}/init.el --batch --eval 'nil' || echo "There occurred an error during the installation of missing packages"
# Updates the packges to their latest versions
/snap/bin/emacs -l ${SPACEMACS_DIR}/init.el --batch --eval '(configuration-layer/update-packages t)'
}
###############################################################################
# Install fonts #
###############################################################################
function install_fonts {
/snap/bin/emacs -u $(id -un) --batch --eval '(all-the-icons-install-fonts t)'
}
###############################################################################
# Export Documentation #
###############################################################################
function export_documentation {
(
cd ${DOTSPACEMACS_DIR}
/snap/bin/emacs --batch -l ~/.emacs.d/init.el spacemacs.org --eval "(setq org-html-htmlize-output-type 'css)" -f org-html-export-to-html
mv -v spacemacs.html docs/index.html
)
}
echo "Note:"
echo " - If ${SPACEMACS_DIR} already exists but is not from 'syl20bnr/spacemacs', it will be moved to ${SPACEMACS_DIR}.${BACKUP_SUFFIX}."
echo " - If ${SPACEMACS_DIR} already exists and is from 'syl20bnr/spacemacs', the uncommitted changes will be stashed."
echo " - If ${DOTSPACEMACS_DIR} already exists, it will be moved to ${DOTSPACEMACS_DIR}.${BACKUP_SUFFIX}."
install_dependencies
install_spacemacs
compile_ccls
update_spacemacs
install_fonts
export_documentation
compile_groovy_language_server
download_plantuml