-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspacemacsAutoInstall_manjaro.sh
executable file
·303 lines (268 loc) · 12.2 KB
/
spacemacsAutoInstall_manjaro.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#!/usr/bin/env bash
set -e
#Run package installations in system global area when parm is non-nill using
#sudo -H
if [[ $1 ]]; then
# Install external packages
pacman -Syyu --noconfirm
pacman -S base-devel --noconfirm
pacman -S libgccjit git tcl tk ripgrep the_silver_searcher vim wget curl cmake \
tree-sitter clojure \
extra-cmake-modules python autoconf automake gdb gdb-common lldb \
adobe-source-code-pro-fonts clang clang-tools-extra boost boost-libs llvm \
llvm-libs npm libpng zlib poppler-glib \
emacs-wayland libva-utils libva-mesa-driver \
nodejs npm-check-updates luarocks docker docker-compose \
docker-machine docker-buildx make ctags fish gradle maven openjdk-doc \
jdk-openjdk gnuplot go go-tools texlive-bin texlive-core texlive-fontsextra \
texlive-formatsextra texlive-games \
texlive-humanities texlive-langchinese texlive-langcyrillic texlive-langextra \
texlive-langgreek texlive-langjapanese texlive-langkorean texlive-latexextra \
texlive-music texlive-pictures texlive-pstricks \
texlive-publishers texlive-science texlive-bibtexextra lua coq memcached \
ruby opam racket rustfmt rust cargo r gcc-fortran-multilib \
puppet vagrant swi-prolog \
elixir smlnj sbcl pass gradle \
gradle-doc groovy groovy-docs geckodriver terraform graphviz cowsay \
gsl lld mlocate firefox openssh sed \
xorg-xauth pam rlwrap kotlin texlab pandoc pandoc-crossref --noconfirm
# Fetch kubectl for kubernetes development
curl -LO https://storage.googleapis.com/kubernetes-release/release/"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
# Install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod +x get_helm.sh
./get_helm.sh
# Install stack for haskell
wget -qO- https://get.haskellstack.org/ | sh
# Take care that locate is up-to-date for later searching
updatedb
# Install lua dependencies
luarocks install luacheck
luarocks install lanes
# Install pip directly from python as the OS does it wrongly
rm /usr/lib/python3.12/EXTERNALLY-MANAGED -f
python -m ensurepip --upgrade
python -m pip install --upgrade pip
# Manually create a standard pip link
ln /usr/bin/pip3 pip --symbolic
mv ./pip /usr/bin/
## We use the buildin emacs but keep the code to build manually again when necessary
# Build emacs
# emacsBaseDir="${HOME}/emacsBuild"
# if [[ ! -d "${emacsBaseDir}" ]]; then
# git clone git://git.savannah.gnu.org/emacs.git "${emacsBaseDir}"
# cd "${emacsBaseDir}" || exit
# git checkout emacs-29
# ./autogen.sh
# ./configure --with-x --with-x-toolkit=gtk3 --with-json --with-mailutils --with-cairo --with-modules --with-native-compilation=aot --without-compress-install --with-tree-sitter
# make -j8
# sudo make install
# make distclean
# cd ..
# rm "${emacsBaseDir}" -R
# fi
else
# Set user specific actions which do not require sudo and should be run in
# the local userspace
localInstallDir="${HOME}/.local"
localInstallBin="${localInstallDir}/bin"
# Install Ruby dependencies
mkdir "${localInstallBin}" -p
gem install -n "${localInstallBin}" rdoc pry pry-doc ruby_parser rubocop ruby_test rVM rails \
specific_install puppet-lint sqlint solargraph rubocop-performance
# Install python packages
python -m pip install --force-reinstall pyang jedi json-rpc service_factory ipython autoflake \
ansible wheel flake8 fabric python-binary-memcached sphinx \
importmagic epc \
bashate yapf isort 'python-lsp-server[all]' \
pylsp-mypy mypy isort Black rope ruff python-lsp-black \
python-lsp-isort pyls-memestra python-lsp-ruff pylsp-rope memestra --user
# Set current path
SOURCE="${BASH_SOURCE[0]}"
while [[ -h "$SOURCE" ]]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Get newest spacemacs
spacemacsInstallationDir="${HOME}/.emacs.d"
[[ ! -d "${spacemacsInstallationDir}" ]] && git clone https://github.com/syl20bnr/spacemacs "${spacemacsInstallationDir}"
cd "${spacemacsInstallationDir}" || exit
git checkout develop
git pull
cd "${DIR}" || exit
# Set base path
installBaseDir="${HOME}/.spacemacsInstall"
mkdir -p "${installBaseDir}"
# Add .profile as default value for .bash_profile
echo "Setting profile settings"
[[ ! -f "${HOME}/.profile" ]] && touch "${HOME}/.profile"
if grep -Fxq "[[ -f ${HOME}/.profile ]] && . ${HOME}/.profile" "${HOME}"/.bash_profile
then
echo "nothing to do"
else
echo "[[ -f ${HOME}/.profile ]] && . ${HOME}/.profile" >> "${HOME}"/.bash_profile
fi
# Install fish terminal
echo "Setting fish settings"
fishConfigDir="${HOME}/.config/fish"
fishConfigFile="${fishConfigDir}/config.fish"
mkdir -p "${fishConfigDir}"
TERMINFO="$(locate eterm-color.ti)"
tic -o "${HOME}"/.terminfo "${TERMINFO}"
[[ ! -f "${fishConfigFile}" ]] && echo "# emacs ansi-term support
if test -n \"\$EMACS\"
set -x TERM eterm-color
end
# this function may be required
function fish_title
true
end" >> "${fishConfigFile}"
# Prepare Go environment
echo "prepare go env"
goPath="${HOME}/goWorkspace"
goPathSrc="${goPath}/src"
goPathBin="${goPath}/bin"
goPathSrcExample="${goPathSrc}/example"
goPathSrcExampleFile="${goPathSrcExample}/example.go"
JAVA_HOME="/usr/lib/jvm/default-runtime"
export GOPATH=${goPath}
export PATH=$PATH:${goPathBin}:${localInstallBin}
export JAVA_HOME
# Prepare .profile with paths
if grep -Fxq "export JAVA_HOME=${JAVA_HOME}" "${HOME}"/.profile
then
echo "nothing to do"
else
echo "export JAVA_HOME=${JAVA_HOME}" >> "${HOME}"/.profile
fi
if grep -Fxq "export GOPATH=${goPath}" "${HOME}"/.profile
then
echo "nothing to do"
else
echo "export GOPATH=${goPath}" >> "${HOME}"/.profile
fi
if grep -Fxq "export PATH=${PATH}" "${HOME}"/.profile
then
echo "nothing to do"
else
echo "export PATH=${PATH}" >> "${HOME}"/.profile
fi
# Prepare fish config with paths
if grep -Fxq "set -x JAVA_HOME ${JAVA_HOME}" "${fishConfigFile}"
then
echo "nothing to do"
else
echo "set -x JAVA_HOME ${JAVA_HOME}" >> "${fishConfigFile}"
fi
if grep -Fxq "set -x GOPATH ${goPath}" "${fishConfigFile}"
then
echo "nothing to do"
else
echo "set -x GOPATH ${goPath}" >> "${fishConfigFile}"
fi
if grep -Fxq "set -x PATH ${PATH//:/ }" "${fishConfigFile}"
then
echo "nothing to do"
else
echo "set -x PATH ${PATH//:/ }" >> "${fishConfigFile}"
fi
[[ ! -d "${goPath}" ]] && mkdir "${goPath}"
[[ ! -d "${goPathSrc}" ]] && mkdir "${goPathSrc}"
[[ ! -d "${goPathSrcExample}" ]] && mkdir "${goPathSrcExample}"
[[ ! -f "${goPathSrcExampleFile}" ]] && echo "package main
import \"fmt\"
func main() {
fmt.Printf(\"hello, world\\n\")
}" >> "${goPathSrcExampleFile}"
GO111MODULE=on go install golang.org/x/tools/gopls@latest
GO111MODULE=on CGO_ENABLED=0 go install -v -trimpath -ldflags '-s -w' github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/mdempsky/gocode@latest
go install github.com/zmb3/gogetdoc@latest
go install golang.org/x/tools/cmd/godoc@latest
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/tools/cmd/gorename@latest
go install golang.org/x/tools/cmd/guru@latest
go install github.com/cweill/gotests/...@latest
go install github.com/davidrjenni/reftools/cmd/fillstruct@latest
go install github.com/fatih/gomodifytags@latest
go install github.com/godoctor/godoctor@latest
go install github.com/haya14busa/gopkgs/cmd/gopkgs@latest
go install github.com/josharian/impl@latest
go install github.com/rogpeppe/godef@latest
# Install plantuml
echo "prepare plantuml"
plantUmlInstallDir="${HOME}/.plantuml"
if [[ ! -d "${plantUmlInstallDir}" ]]; then
mkdir "${plantUmlInstallDir}"
wget -O "${plantUmlInstallDir}/plantUml.jar" https://downloads.sourceforge.net/project/plantuml/plantuml.jar
fi
# Install nodejs dependencies
echo "prepare npm"
npm config set prefix "${localInstallDir}"
npm install -g tern babel-eslint eslint-plugin-react vmd elm volar \
elm-oracle elm-format elm-test typescript-formatter webpack pulp eslint bower \
grunt typescript yarn js-yaml prettier typescript-language-server js-beautify \
import-js parcel bash-language-server yaml-language-server dockerfile-language-server-nodejs \
flow-bin vscode-json-languageserver vscode-css-languageserver-bin vscode-html-languageserver-bin \
vim-language-server @elm-tooling/elm-language-server elm-analyse less typescript
# Install sqlfmt
echo "prepare sqlfmt"
wget -q -O - https://github.com/maddyblue/sqlfmt/releases/download/v0.5.0/sqlfmt_Linux_x86_64.tar.gz | tar -xpvzf - --directory "${localInstallDir}/bin"
chmod +x "${localInstallDir}/bin/sqlfmt"
# Build groovy lsp is not compatible with java 20
# echo "prepare groovy lsp"
# groovyBaseDir="${installBaseDir}/groovy-lsp"
# groovyInstallDir="${HOME}/.groovy-lsp"
# if [[ ! -d "${groovyBaseDir}" ]]; then
# mkdir -p "${groovyInstallDir}"
# cd "${installBaseDir}" || exit
# git clone https://github.com/GroovyLanguageServer/groovy-language-server groovy-lsp
# cd "groovy-lsp" || exit
# ./gradlew build
# cp ./build/libs/groovy-lsp-all.jar "${groovyInstallDir}/groovy-lsp-all.jar"
# chmod +x "${groovyInstallDir}/groovy-lsp-all.jar"
# fi
# cd "${DIR}" || exit
# Install leiningen and boot for clojure builds as well as lsp
echo "prepare leiningen"
wget -O "${localInstallDir}/bin/lein" https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x "${localInstallDir}/bin/lein"
"${localInstallDir}/bin/lein" version
echo "prepare boot"
wget -O "${localInstallDir}/bin/boot" https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh
chmod +x "${localInstallDir}/bin/boot"
"${localInstallDir}/bin/boot" -u
echo "clojure lsp"
wget -O "${localInstallDir}/bin/clojure-lsp" https://github.com/clojure-lsp/clojure-lsp/releases/latest/download/clojure-lsp
chmod +x "${localInstallDir}/bin/clojure-lsp"
# Install additional linters for clojure
echo "clojure jocker"
cd "${localInstallDir}" || exit
wget -O "${localInstallDir}/joker-linux-amd64.zip" https://github.com/candid82/joker/releases/latest/download/joker-linux-amd64.zip
unzip "${localInstallDir}/joker-linux-amd64.zip"
mv "${localInstallDir}/joker" "${localInstallDir}/bin/joker"
chmod +x "${localInstallDir}/bin/joker"
rm "${localInstallDir}/joker-linux-amd64.zip"
cd "${DIR}" || exit
# Commit default spacemacs dotfile
echo "copy dotfile"
cp .spacemacs "${HOME}"/.spacemacs
# Install haskell dependencies with stack, do it manually to avoid dynamic
# linking in arch linux haskell packages
# Avoid building too much packages as this exceed max build time
# https://wiki.archlinux.org/index.php/Haskell
echo "install stack haskell env"
stack setup
stack upgrade
# Install haskell dependencies with stack, do it manually to avoid dynamic linking
echo "install stack additional packages"
stack install pandoc ShellCheck hoogle hlint hasktags happy alex apply-refact
# Get latest hadolint release
echo "install hadolint"
wget -O "${localInstallDir}/bin/hadolint" https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
chmod +x "${localInstallDir}/bin/hadolint"
fi