-
Notifications
You must be signed in to change notification settings - Fork 5
/
INSTALL.sh
executable file
·78 lines (63 loc) · 1.4 KB
/
INSTALL.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
#!/bin/bash
##
## EPITECH PROJECT, 2018
## epitech-emacs
## File description:
## emacs configurations installer
##
function usage {
echo "USAGE: $0 [local|system]"
echo
echo "Official Emacs configuration for Epitech students."
echo -e "\tlocal:\tlocal installation"
echo -e "\tsystem:\tsystem-wide installation"
exit 0
}
function copy_files {
if [ -d "$1/epitech" ]
then
echo "Cleaning old directory..."
rm -r "$1/epitech"
fi
echo "Copying files..."
mkdir -p "$1"
cp -r "src/epitech" "$1/epitech"
mkdir -p "$1/site-start.d"
cp "src/site-start.d/epitech-init.el" "$1/site-start.d"
cp "LICENSE" "$1/epitech/LICENSE"
}
function local_install {
echo "Installing Emacs configuration locally..."
copy_files "$HOME/.emacs.d/lisp"
if [ ! -f "$HOME/.emacs" ] ||
[ `grep -c "^;; Epitech configuration" "$HOME/.emacs"` == 0 ]
then
echo "Updating init file..."
cat >> "$HOME/.emacs" <<EOF
;;
;; Epitech configuration
;;
(add-to-list 'load-path "~/.emacs.d/lisp")
(load "site-start.d/epitech-init.el")
EOF
else
echo "Init file already fixed, skipping updating."
fi
echo "Done."
}
function system_install {
echo "Installing Emacs configuration system-wide..."
copy_files "/usr/share/emacs/site-lisp"
echo "Done."
}
case "$1" in
local )
local_install
;;
system )
system_install
;;
* )
usage
;;
esac