Mercurial > ec-dotfiles
annotate setup @ 720:2cfa6fb4e755
Filetype for samba config
author | nanaya <me@nanaya.net> |
---|---|
date | Mon, 19 Aug 2024 16:52:59 +0900 |
parents | 42e58cea7821 |
children | 49538e2aad65 |
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 | 3 # This script is bourne-shell compatible. |
4 # Or at least it is when I last tested it in Solaris 10. | |
5 | |
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 | 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 | 11 # Get directory where this script and dotfiles are located. |
12 # $0 contains either full path when executed from a PATH (godwhy) | |
13 # or with complete path or ./<scriptname> when executed that way. | |
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 | 16 |
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 | 20 |
21 # FIXME: test existence of the directories. | |
22 # dotfiles | |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
23 rcdir="${basedir}/rc" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
24 |
471
9af2e1cd964e
Add test for $HOME writability.
edogawaconan <me@myconan.net>
parents:
467
diff
changeset
|
25 # Make sure $HOME points somewhere and writable. |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
26 test -n "${HOME}" || exit 1 |
471
9af2e1cd964e
Add test for $HOME writability.
edogawaconan <me@myconan.net>
parents:
467
diff
changeset
|
27 test -w "${HOME}" || exit 1 |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
28 |
404 | 29 # A safe echo. |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
30 _echo() { |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
31 _echon "${*}"; printf "\n" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
32 } |
404 | 33 # A safe and cross platform echo -n. |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
34 _echon() { |
338 | 35 printf '%s' "${*}" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
36 } |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
37 |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
38 _tcsh() { |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
39 case "$1" in |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
40 uninstall|install) |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
41 _rc "${1}" "cshrc" ".ec.tcsh" |
689 | 42 # shellcheck disable=SC2016 |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
43 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".cshrc" |
689 | 44 # shellcheck disable=SC2016 |
533
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 | 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" |
689 | 54 # shellcheck disable=SC2016 |
533
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' ".bash_profile" |
689 | 56 # shellcheck disable=SC2016 |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
57 _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
|
58 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
59 esac |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
60 } |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
61 |
527 | 62 _ksh() { |
63 case "${1}" in | |
64 uninstall|install) | |
65 _rc "${1}" "kshrc" ".ec.ksh" | |
689 | 66 # shellcheck disable=SC2016 |
527 | 67 _init "${1}" '[ -r "${HOME}/.ec.ksh" ] && . "${HOME}/.ec.ksh" #ECCORE_KSH' ".profile" |
68 ;; | |
69 esac | |
70 } | |
71 | |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
72 _zsh() { |
338 | 73 case "${1}" in |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
74 uninstall|install) |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
75 _rc "${1}" "zshrc" ".ec.zsh" |
689 | 76 # shellcheck disable=SC2016 |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
77 _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
|
78 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
79 esac |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
80 } |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
81 |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
82 _rc() { |
135
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
83 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
|
84 _echo "Invalid command." |
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
85 return |
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
86 fi |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
87 _srcfile="${rcdir}/${2}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
88 _dstfile="${HOME}/${3}" |
325
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
89 _dstdir="`_echo "${_dstfile}" | sed -e 's,^\(.*\)/[^/]*$,\1,'`" |
315
c6ad8279b076
Support for solarized vim color scheme.
Edho Arief <edho@myconan.net>
parents:
246
diff
changeset
|
90 mkdir -p "${_dstdir}" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
91 if test ! -h "${_dstfile}"; then |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
92 if test -f "${_dstfile}"; then |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
93 cp "${_dstfile}" "${_dstfile}.bak" |
135
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
94 _echo "${_dstfile} backed up to ${_dstfile}.bak" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
95 elif test -d "${_dstfile}"; then |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
96 cp -r "${_dstfile}" "${_dstfile}.bak" |
135
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
97 _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
98 fi |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
99 fi |
135
6a110770a756
A bit more sanity testing.
Edho Prima Arief <edho@myconan.net>
parents:
130
diff
changeset
|
100 rm -rf "${_dstfile}" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
101 case "${1}" in |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
102 install) |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
103 ln -fs "${_srcfile}" "${_dstfile}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
104 _echo "Installed ${_dstfile}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
105 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
106 uninstall) |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
107 _echo "Removed ${_dstfile}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
108 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
109 esac |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
110 } |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
111 |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
112 _init() { |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
113 _script="${HOME}/${3}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
114 _scripttmp="${HOME}/.tmp.${3}" |
325
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
115 rm -f "${_scripttmp}" |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
116 _data="${2}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
117 if [ -f "${_script}" ]; then |
325
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
118 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
|
119 mv -f "${_scripttmp}" "${_script}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
120 fi |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
121 case "${1}" in |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
122 install) |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
123 _echo "${_data}" >> "${_script}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
124 _echo "Added autostart to ${_script}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
125 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
126 uninstall) |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
127 _echo "Removed autostart from ${_script}" |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
128 ;; |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
129 esac |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
130 } |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
131 |
474 | 132 _touch() { |
580
5a0f3d427979
Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents:
579
diff
changeset
|
133 test "${1}" = "uninstall" && return |
5a0f3d427979
Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents:
579
diff
changeset
|
134 shift |
5a0f3d427979
Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents:
579
diff
changeset
|
135 |
474 | 136 touch "${@}" |
689 | 137 _echo "Ensured existence of ${*}" |
474 | 138 } |
139 | |
501 | 140 _tmux() { |
141 # Remove old tmux config. | |
142 _rc uninstall "tmux.conf" ".tmux.conf" | |
143 for tmux_conf in "${rcdir}/tmux-"*.conf; do | |
505
de5f65991cde
sh doesn't have parameter expansion :(
edogawaconan <me@myconan.net>
parents:
503
diff
changeset
|
144 tmux_conf_file="`basename "/${tmux_conf}"`" |
501 | 145 _rc "${1}" "${tmux_conf_file}" ".${tmux_conf_file}" |
146 done | |
147 } | |
148 | |
662
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
149 _vim_x() { |
579 | 150 case "${1}" in |
151 install) _echon "Copying";; | |
152 uninstall) _echon "Removing";; | |
153 esac | |
662
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
154 x="${2}" |
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
155 _echon " vim ${x}..." |
572 | 156 |
662
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
157 for i in "${basedir}/vendor/vim-${x}"/*.vim; do |
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
158 file_name="`basename "/${i}"`" |
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
159 _echon "[${file_name}]" |
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
160 _rc "${1}" "../vendor/vim-${x}/${file_name}" ".vim/${x}/${file_name}" > /dev/null |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
505
diff
changeset
|
161 done |
688 | 162 for d in "${basedir}/vendor/vim-${x}"/*/; do |
163 test -d "$d" || continue | |
164 dir_name="`basename "/${d}"`" | |
165 _echon "[${dir_name}]" | |
166 mkdir -p ".vim/${x}/${dir_name}" | |
167 for i in "${d}"/*.vim; do | |
168 file_name="`basename "/${i}"`" | |
169 _echon "[${file_name}]" | |
170 _rc "${1}" "../vendor/vim-${x}/${dir_name}/${file_name}" ".vim/${x}/${dir_name}/${file_name}" > /dev/null | |
171 done | |
172 done | |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
505
diff
changeset
|
173 _echo ...done |
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
505
diff
changeset
|
174 } |
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
505
diff
changeset
|
175 |
704
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
176 _vim_packs() { |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
177 case "${1}" in |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
178 install) _echon "Symlinking vim packs...";; |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
179 uninstall) _echon "Removing vim packs...";; |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
180 esac |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
181 |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
182 for i in "${basedir}/vendor/vim-packs"/*; do |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
183 pack_name="`basename "/${i}"`" |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
184 _echon "[${pack_name}]" |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
185 _rc "${1}" "../vendor/vim-packs/${pack_name}" ".vim/pack/default/opt/${pack_name}" > /dev/null |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
186 done |
705 | 187 _echo ...done |
704
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
188 } |
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
189 |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
190 _upgrade() { |
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
191 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
|
192 src="${HOME}/.ecos_${i}" |
534 | 193 dst="${HOME}/.ec.${i}" |
194 if test -f "${src}" || test -d "${src}" || test -h "${src}"; then | |
195 if test ! -f "${dst}" && test ! -d "${dst}" && test ! -h "${dst}"; then | |
196 _echo "Moving ${src} to ${dst}" | |
197 mv -f "${src}" "${dst}" | |
198 fi | |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
199 fi |
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
200 done |
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
201 } |
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
202 |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
203 _help() { |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
204 cat <<EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
205 Usage: ${0} [install|uninstall] |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
206 EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
207 } |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
208 |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
209 case "${1}" in |
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
210 install|uninstall) |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
211 _upgrade |
325
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
212 _tcsh "${1}" |
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
213 _bash "${1}" |
527 | 214 _ksh "${1}" |
325
795ad57794a6
[setup] Returning solaris compatibility.
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
215 _zsh "${1}" |
527 | 216 _rc "${1}" "shellinit-posix" ".ec.shellinit-posix" |
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
527
diff
changeset
|
217 _rc "${1}" "../bin" ".ec.bin" |
417 | 218 _rc "${1}" "gemrc" ".gemrc" |
356 | 219 _rc "${1}" "gitconfig" ".gitconfig" |
456 | 220 _rc "${1}" "gitignore_global" ".gitignore_global" |
332 | 221 _rc "${1}" "hgrc" ".hgrc" |
580
5a0f3d427979
Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents:
579
diff
changeset
|
222 _touch "${1}" "${HOME}/.hgrc.local" |
473 | 223 _rc "${1}" "hgignore_global" ".hgignore_global" |
580
5a0f3d427979
Change touch function to noop when uninstalling
nanaya <me@myconan.net>
parents:
579
diff
changeset
|
224 _touch "${1}" "${HOME}/.hgignore_global.local" |
417 | 225 _rc "${1}" "inputrc" ".inputrc" |
501 | 226 _tmux "${1}" |
662
f280738a90a6
[vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents:
606
diff
changeset
|
227 _vim_x "${1}" syntax |
704
1e0f578f6752
Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents:
689
diff
changeset
|
228 _vim_packs "${1}" |
417 | 229 _rc "${1}" "vimrc" ".vimrc" |
482
20521d872fab
Add irbrc to keep history of commands.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
230 _rc "${1}" "irbrc" ".irbrc" |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
231 ;; |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
232 *) |
127
a7484f2c9616
Long-overdue massive reorganization.
Edho Prima Arief <edho@myconan.net>
parents:
126
diff
changeset
|
233 _help |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
234 ;; |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
235 esac |