annotate setup @ 623:0f0bdbd8d37d

Update syntax files Additionally nginx repo fixed their cookie thingie.
author nanaya <me@nanaya.pro>
date Mon, 04 Mar 2019 20:01:03 +0900
parents b9672858e2e2
children f280738a90a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
1 #!/bin/sh
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
2
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
3 # This script is bourne-shell compatible.
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
4 # Or at least it is when I last tested it in Solaris 10.
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
5
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
6 # Ensure no variable is empty when used.
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
7 set -u
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
8 # Stop on any error.
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
9 set -e
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
10
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
11 # Get directory where this script and dotfiles are located.
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
12 # $0 contains either full path when executed from a PATH (godwhy)
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
13 # or with complete path or ./<scriptname> when executed that way.
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
14 # Therefore it's safe to use dirname in this case.
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
15 basedir="`dirname "${0}"`"
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
16
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
17 # To get actual path, go to the directory and pwd from it.
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
18 cd "${basedir}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
19 basedir="`pwd`"
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
20
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
21 # FIXME: test existence of the directories.
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
22 # dotfiles
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
23 rcdir="${basedir}/rc"
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
24 # misc scripts
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
25 bindir="${basedir}/bin"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
26
471
9af2e1cd964e Add test for $HOME writability.
edogawaconan <me@myconan.net>
parents: 467
diff changeset
27 # Make sure $HOME points somewhere and writable.
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
28 test -n "${HOME}" || exit 1
471
9af2e1cd964e Add test for $HOME writability.
edogawaconan <me@myconan.net>
parents: 467
diff changeset
29 test -w "${HOME}" || exit 1
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
30
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
31 # A safe echo.
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
32 _echo() {
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
33 _echon "${*}"; printf "\n"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
34 }
404
c171c29e13f5 A bit of documentation.
Edho Arief <edho@myconan.net>
parents: 393
diff changeset
35 # A safe and cross platform echo -n.
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
36 _echon() {
338
94d0e4826d28 Cosmetics.
Edho Arief <edho@myconan.net>
parents: 332
diff changeset
37 printf '%s' "${*}"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
38 }
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
39
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
40 _tcsh() {
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
41 case "$1" in
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
42 uninstall|install)
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
43 _rc "${1}" "cshrc" ".ec.tcsh"
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
44 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".cshrc"
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
45 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".tcshrc"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
46 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
47 esac
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
48 }
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
49
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
50 _bash() {
338
94d0e4826d28 Cosmetics.
Edho Arief <edho@myconan.net>
parents: 332
diff changeset
51 case "${1}" in
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
52 uninstall|install)
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
53 _rc "${1}" "bashrc" ".ec.bash"
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
54 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bash_profile"
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
55 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bashrc"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
56 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
57 esac
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
58 }
1
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
59
527
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
60 _ksh() {
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
61 case "${1}" in
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
62 uninstall|install)
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
63 _rc "${1}" "kshrc" ".ec.ksh"
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
64 _init "${1}" '[ -r "${HOME}/.ec.ksh" ] && . "${HOME}/.ec.ksh" #ECCORE_KSH' ".profile"
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
65 ;;
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
66 esac
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
67 }
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
68
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
69 _zsh() {
338
94d0e4826d28 Cosmetics.
Edho Arief <edho@myconan.net>
parents: 332
diff changeset
70 case "${1}" in
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
71 uninstall|install)
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
72 _rc "${1}" "zshrc" ".ec.zsh"
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
73 _init "${1}" '[ -r "${HOME}/.ec.zsh" ] && . "${HOME}/.ec.zsh" #ECCORE_ZSH' ".zshrc"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
74 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
75 esac
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
76 }
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
77
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
78 _rc() {
135
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
79 if test -z "${3}" || test -z "${2}" || test -z "${1}"; then
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
80 _echo "Invalid command."
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
81 return
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
82 fi
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
83 _srcfile="${rcdir}/${2}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
84 _dstfile="${HOME}/${3}"
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
85 _dstdir="`_echo "${_dstfile}" | sed -e 's,^\(.*\)/[^/]*$,\1,'`"
315
c6ad8279b076 Support for solarized vim color scheme.
Edho Arief <edho@myconan.net>
parents: 246
diff changeset
86 mkdir -p "${_dstdir}"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
87 if test ! -h "${_dstfile}"; then
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
88 if test -f "${_dstfile}"; then
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
89 cp "${_dstfile}" "${_dstfile}.bak"
135
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
90 _echo "${_dstfile} backed up to ${_dstfile}.bak"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
91 elif test -d "${_dstfile}"; then
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
92 cp -r "${_dstfile}" "${_dstfile}.bak"
135
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
93 _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
94 fi
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
95 fi
135
6a110770a756 A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents: 130
diff changeset
96 rm -rf "${_dstfile}"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
97 case "${1}" in
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
98 install)
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
99 ln -fs "${_srcfile}" "${_dstfile}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
100 _echo "Installed ${_dstfile}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
101 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
102 uninstall)
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
103 _echo "Removed ${_dstfile}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
104 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
105 esac
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
106 }
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
107
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
108 _init() {
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
109 _script="${HOME}/${3}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
110 _scripttmp="${HOME}/.tmp.${3}"
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
111 rm -f "${_scripttmp}"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
112 _data="${2}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
113 if [ -f "${_script}" ]; then
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
114 sed -e "/`_echo "${_data}" | sed -e 's/.*#//'`/d" "${_script}" > "${_scripttmp}"
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
115 mv -f "${_scripttmp}" "${_script}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
116 fi
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
117 case "${1}" in
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
118 install)
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
119 _echo "${_data}" >> "${_script}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
120 _echo "Added autostart to ${_script}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
121 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
122 uninstall)
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
123 _echo "Removed autostart from ${_script}"
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
124 ;;
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
125 esac
1
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
126 }
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
127
474
8c637534d6cd More informative touch.
edogawaconan <me@myconan.net>
parents: 473
diff changeset
128 _touch() {
580
5a0f3d427979 Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents: 579
diff changeset
129 test "${1}" = "uninstall" && return
5a0f3d427979 Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents: 579
diff changeset
130 shift
5a0f3d427979 Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents: 579
diff changeset
131
474
8c637534d6cd More informative touch.
edogawaconan <me@myconan.net>
parents: 473
diff changeset
132 touch "${@}"
8c637534d6cd More informative touch.
edogawaconan <me@myconan.net>
parents: 473
diff changeset
133 _echo "Ensured existence of ${@}"
8c637534d6cd More informative touch.
edogawaconan <me@myconan.net>
parents: 473
diff changeset
134 }
8c637534d6cd More informative touch.
edogawaconan <me@myconan.net>
parents: 473
diff changeset
135
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
136 _tmux() {
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
137 # Remove old tmux config.
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
138 _rc uninstall "tmux.conf" ".tmux.conf"
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
139 for tmux_conf in "${rcdir}/tmux-"*.conf; do
505
de5f65991cde sh doesn't have parameter expansion :(
edogawaconan <me@myconan.net>
parents: 503
diff changeset
140 tmux_conf_file="`basename "/${tmux_conf}"`"
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
141 _rc "${1}" "${tmux_conf_file}" ".${tmux_conf_file}"
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
142 done
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
143 }
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
144
572
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
145 _vim_autoload() {
579
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
146 case "${1}" in
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
147 install) _echon "Copying";;
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
148 uninstall) _echon "Removing";;
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
149 esac
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
150 _echon " vim autoloads..."
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
151
572
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
152 for i in "${basedir}/vendor/vim-autoload"/*.vim; do
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
153 autoload_file_name="`basename "/${i}"`"
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
154 _echon "[${autoload_file_name}]"
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
155 _rc "${1}" "../vendor/vim-autoload/${autoload_file_name}" ".vim/autoload/${autoload_file_name}" > /dev/null
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
156 done
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
157 _echo ...done
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
158 }
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
159
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
160 _vim_syntax() {
579
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
161 case "${1}" in
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
162 install) _echon "Copying";;
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
163 uninstall) _echon "Removing";;
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
164 esac
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
165 _echon " vim syntaxes..."
fd416344f175 Fix uninstall message
nanaya <me@myconan.net>
parents: 572
diff changeset
166
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
167 for i in "${basedir}/vendor/vim-syntax"/*.vim; do
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
168 syntax_file_name="`basename "/${i}"`"
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
169 _echon "[${syntax_file_name}]"
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
170 _rc "${1}" "../vendor/vim-syntax/${syntax_file_name}" ".vim/syntax/${syntax_file_name}" > /dev/null
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
171 done
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
172 _echo ...done
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
173 }
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
174
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
175 _upgrade() {
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
176 for i in bash bash.after bash.before bin tcsh tcsh.after tcsh.before zsh zsh.after zsh.before; do
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
177 src="${HOME}/.ecos_${i}"
534
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
178 dst="${HOME}/.ec.${i}"
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
179 if test -f "${src}" || test -d "${src}" || test -h "${src}"; then
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
180 if test ! -f "${dst}" && test ! -d "${dst}" && test ! -h "${dst}"; then
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
181 _echo "Moving ${src} to ${dst}"
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
182 mv -f "${src}" "${dst}"
49235ac0891a A better check?
edogawaconan <me@myconan.net>
parents: 533
diff changeset
183 fi
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
184 fi
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
185 done
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
186 }
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
187
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
188 _help() {
23
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
189 cat <<EOF
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
190 Usage: ${0} [install|uninstall]
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
191 EOF
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
192 }
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
193
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
194 case "${1}" in
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
195 install|uninstall)
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
196 _upgrade
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
197 _tcsh "${1}"
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
198 _bash "${1}"
527
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
199 _ksh "${1}"
325
795ad57794a6 [setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
200 _zsh "${1}"
527
cb4e2a6595ea Add ksh support.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
201 _rc "${1}" "shellinit-posix" ".ec.shellinit-posix"
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 527
diff changeset
202 _rc "${1}" "../bin" ".ec.bin"
417
31bc186f8ed3 Sorted dotfile installation.
Edho Arief <edho@myconan.net>
parents: 416
diff changeset
203 _rc "${1}" "gemrc" ".gemrc"
356
38fad89edd55 Added gitconfig.
Edho Arief <edho@myconan.net>
parents: 338
diff changeset
204 _rc "${1}" "gitconfig" ".gitconfig"
456
e0f9a54b9dce Add global gitignore.
Edho Arief <edho@myconan.net>
parents: 425
diff changeset
205 _rc "${1}" "gitignore_global" ".gitignore_global"
332
db66d53e10ea Canonical name for configs.
Edho Arief <edho@myconan.net>
parents: 325
diff changeset
206 _rc "${1}" "hgrc" ".hgrc"
580
5a0f3d427979 Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents: 579
diff changeset
207 _touch "${1}" "${HOME}/.hgrc.local"
473
1ed4d4c449a6 Add global hgignore.
edogawaconan <me@myconan.net>
parents: 471
diff changeset
208 _rc "${1}" "hgignore_global" ".hgignore_global"
580
5a0f3d427979 Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents: 579
diff changeset
209 _touch "${1}" "${HOME}/.hgignore_global.local"
417
31bc186f8ed3 Sorted dotfile installation.
Edho Arief <edho@myconan.net>
parents: 416
diff changeset
210 _rc "${1}" "inputrc" ".inputrc"
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 485
diff changeset
211 _tmux "${1}"
606
b9672858e2e2 Better color
nanaya <me@nanaya.pro>
parents: 580
diff changeset
212 _rc "${1}" "vim-srcery-drk" ".vim/colors/srcery-drk.vim"
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 505
diff changeset
213 _vim_syntax "${1}"
572
a163d6875651 Vendor autoloads.
nanaya <me@myconan.net>
parents: 555
diff changeset
214 _vim_autoload "${1}"
417
31bc186f8ed3 Sorted dotfile installation.
Edho Arief <edho@myconan.net>
parents: 416
diff changeset
215 _rc "${1}" "vimrc" ".vimrc"
482
20521d872fab Add irbrc to keep history of commands.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
216 _rc "${1}" "irbrc" ".irbrc"
26
175848778e77 Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents: 23
diff changeset
217 ;;
23
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
218 *)
127
a7484f2c9616 Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents: 126
diff changeset
219 _help
23
738a2da8b79c Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents: 17
diff changeset
220 ;;
1
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
221 esac