forked from pivaldi/pi-emacs-configuration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·117 lines (95 loc) · 4.39 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
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
#!/bin/bash -E
# Copyright (c) 2011, Philippe Ivaldi <www.piprime.fr>
# $Last Modified on 2011/07/03
# This program is free software ; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation ; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY ; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program ; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Set colorful only on colorful terminals.
# src: https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
COLOR=''
NORMAL=''
if ${use_color} ; then
COLOR="\033[46m\033[31m"
NORMAL="\\033[0;39m"
fi
DIR=$(dirname $0)
cd $DIR
DIR="$(pwd)"
[ -e my-parameters.el ] || cp my-parameters-example.el my-parameters.el
[ -e user-post-init.el ] || cp user-post-init-example.el user-post-init.el
[ -e user-pre-init.el ] || cp user-pre-init-example.el user-pre-init.el
[ -e etc/pi-customize.el ] || cp etc/pi-customize-example.el etc/pi-customize.el
git submodule init && git submodule sync && git submodule update
find ./*/ -iname 'configure' -exec sh -c 'cd "$(dirname $0)" && ./configure' "{}" ";"
find ./*/ -iname 'makefile' -exec sh -c 'cd "$(dirname $0)" && make' "{}" ";"
EMACS_CONF="${HOME}/.emacs"
MESSAGE=''
[ -e "$EMACS_CONF" ] && {
BACKUP_FILE="${EMACS_CONF}_$(date +%Y_%m_%d:%H-%M)"
mv "$EMACS_CONF" "$BACKUP_FILE"
MESSAGE="Your .emacs was backuped to $BACKUP_FILE"
}
cat >~/.emacs<<EOF
;;: -*- emacs-lisp -*-
;; Copyright (c) 2011, Philippe Ivaldi <www.piprime.fr>
;; This program is free software ; you can redistribute it and/or modify
;; it under the terms of the GNU Lesser General Public License as published by
;; the Free Software Foundation ; either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY ; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;; You should have received a copy of the GNU Lesser General Public License
;; along with this program ; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;; Setting a variable to see if XEmacs is used
(defvar running-xemacs-p (string-match "XEmacs\|Lucid" emacs-version))
;; Depending on the version of (X) Emacs used is called the same
;; configuration files but from different directories.
(if running-xemacs-p
(progn
;; XEmacs backwards compatibility file
(setq user-init-file
(expand-file-name "init.el"
(expand-file-name ".xemacs" "~")))
(setq custom-file
(expand-file-name "custom.el"
(expand-file-name ".xemacs" "~"))))
(progn
;; Emacs
(if (> emacs-major-version 21)
(setq user-init-file (expand-file-name "${DIR}/init.el")) ;;Emacs > 21
(setq user-init-file (expand-file-name "~/emacs-21.d/init.el"))) ;;Emacs <= 21
))
(load-file user-init-file)
EOF
echo -e "${COLOR}"
echo '!!=='
[ MESSAGE != '' ] && echo " * $MESSAGE"
echo ' * Remember to put your identity and customize some parameters in the file :'
echo " ${DIR}/my-parameters.el"
echo ' * You can learn about shortkey and the necessary files to your needs in the file :'
echo " ${DIR}/init.el"
echo -e "==!!${NORMAL}"
[ -d "${DIR}/bin" ] && chmod u+x "${DIR}/bin/*"