-
Notifications
You must be signed in to change notification settings - Fork 2
/
configctl
executable file
·624 lines (543 loc) · 19 KB
/
configctl
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
#!/bin/sh -
# configctl - control config setup and installation
# Licensed GPLv3+
# Usage: ./configctl [ACTION]
# Control configuration file installation.
# ACTION is one of: install uninstall prepare migrate link misc preload precompile check.
#
# The 'install' action is equivalent to the 'prepare', 'migrate', 'link', 'misc', 'preload', and 'precompile' actions, in that order.
# The 'uninstall' action is unimplemented.
# The 'prepare' action creates directories.
# The 'migrate' action migrates old configurations.
# The 'link' action creates symlinks and hardlinks, and is dependent on 'prepare'.
# The 'misc' action performs miscellaneous tasks, like touching files.
# The 'preload' action downloads resources from the network, and is dependent on 'link'. It is the only action requiring network access.
# The 'precompile' action precompiles zsh scripts, and is dependent on 'link' and 'preload'.
# The 'check' action searches for common binaries and reports if they are missing.
#
# Exit status is 0 upon success; 1 upon a sanity check error; 2 upon unimplemented functionality; 3 upon failed migration.
# Targets POSIX-compliant systems - no less, and no more.
# TODO call exec on this script if this isn't already exported, so the shell gets this too
export POSIXLY_CORRECT=
# TODO pull dotfile updates and reexec if anything changes
# VARIABLE DECLARATIONS
LINK_FILES=".bash_aliases .bash_logout .bash_profile .bashrc .byobu .emacs .gitconfig .gitignore .gitmodules .profile .reportbugrc .screenrc .selected_editor .zsh_favlist .zshrc.pre-oh-my-zsh bin .pam_environment .netscape .hgrc .zshrc .zprofile .offlineimaprc .gnus.el .caffrc .ispell_english .muttrc .msmtprc .dput.cf .nanorc"
HARDLINKS=".pgpkey"
ZSH_PRECOMPILE=".zshrc .zprofile antigen/antigen.zsh .oh-my-zsh/lib/*.zsh .oh-my-zsh/themes/*.zsh-theme .oh-my-zsh/plugins/*/*.zsh .oh-my-zsh/oh-my-zsh.sh"
DIRS=".gnupg .ssh .aptitude .config .bin/bash_completion .bin/todo.txt-cli .bin/bin .emacs.d/lisp .todo .bazaar .local/share/applications .mutt"
LINK_DIRS=".config/awesome .config/cower .config/terminator .config/profanity .config/git .config/autostart .config/GIMP"
AFTER_DIRS=".gnupg/gpg.conf .gnupg/gpg-agent.conf .ssh/config .aptitude/config .todo/config .bazaar/bazaar.conf .local/share/applications/firefox-nightly.desktop .mutt/gpg.rc .config/alacritty.toml"
TOUCH_FILES=".fetchmail.log .msmtp.log .mutt/muttrc.mailboxes"
CONFIG_DIR=$(pwd)
TARGET_DIR="$HOME"
DEFAULT_ACTION=install
NUM_WARNINGS=0
NUM_MIGRATIONS=0
# UTILITY FUNCTIONS
# TODO fix colors when running under (some versions of?) bash, not dash
# printf for these guys because echo -e isn't portable
logdbgr() {
printf "[\033[35mdbgr\033[0m] $1\n"
}
loginfo() {
printf "[\033[36minfo\033[0m] $1\n"
}
logwarn() {
printf "[\033[33mwarn\033[0m] $1\n"
NUM_WARNINGS=$(($NUM_WARNINGS + 1))
}
logfail() {
printf "[\033[31mfail\033[0m] $1\n"
echo "Finished unsuccessfully, with 1 failure, $NUM_WARNINGS warning(s), and 0 migrations."
exit $2
}
config_includes() {
# We could just let grep error on this and do 2>/dev/null, but that would swallow other things too
test -f $CONFIG_DIR/local-config || return 1
grep -q $1 $CONFIG_DIR/local-config
}
checkavailable() {
logdbgr "Checking for $1."
if command -v $1 2>&1 >/dev/null; then
loginfo "Detected $(type $1 | sed 's/is/as/')."
else
logfail "Failed to detect $1. Cannot $2." 1
fi
}
checkavailable_warn() {
logdbgr "Checking for $1."
if command -v $1 2>&1 >/dev/null; then
loginfo "Detected $(type $1 | sed 's/is/as/')."
else
logwarn "Failed to detect $1."
fi
}
checkssh() {
if [ ${1+x} ]; then
DESCRIPTION=" $1"
fi
if [ ${2+x} ]; then
KEYNAME="_$2"
fi
logdbgr "Checking for$DESCRIPTION SSH key..."
if [ ! -e "$TARGET_DIR"/.ssh/id_rsa$KEYNAME ]; then
logwarn "Could not find$DESCRIPTION SSH key."
else
loginfo "Found$DESCRIPTION SSH key at $TARGET_DIR/.ssh/id_rsa$KEYNAME."
fi
logdbgr "Done checking for$DESCRIPTION SSH key."
}
check_emacs_package() {
PACKAGE=$1
emacs -Q --eval "(if (eq (require '$PACKAGE nil t) nil) (kill-emacs 1) (kill-emacs 0))" -nw
}
# This is extremely gross. Please forgive me - POSIX sh doesn't have `builtin`.
setup_cd() {
cd() {
logdbgr "Changing working directory to $1."
unset -f cd
cd $1
setup_cd
}
}
setup_cd
handle_submodules() {
logdbgr "Handling submodules..."
if git submodule update --init; then
logdbgr "Done handling submodules."
else
logwarn "Failed to handle submodules."
fi
}
clone_from_git() {
if config_includes secure; then
loginfo "Skipping unpinned git clone operation for $1 because we are running in a secure environment."
return 0
fi
if [ -d "$TARGET_DIR/$3" ]; then
loginfo "$1 already cloned; pulling with rebase..."
cd "$TARGET_DIR/$3"
if git pull --rebase; then
handle_submodules
loginfo "Done pulling with rebase."
else
logwarn "Failed to pull with rebase."
fi
else
if [ -e "$TARGET_DIR/$3" ]; then
logwarn "$3 exists but is not a directory. Failed to clone $1."
else
logdbgr "Changing working directory to $CONFIG_DIR."
logdbgr "Cloning $1..."
if git clone "$2" "$TARGET_DIR/$3"; then
handle_submodules
loginfo "Done cloning $1."
else
logwarn "Failed to clone $1."
fi
fi
fi
cd "$CONFIG_DIR"
}
download_from_tarball() {
NAME=$1
URL=$2
EXTRACTED_DIRECTORY=$3
SCRIPT_FILE=$4
COMPLETION_FILE=$5
# TODO add in a SHA512 attestation and remove this check
if config_includes secure; then
loginfo "Skipping unverified tarball download for $NAME because we are running in a secure environment."
return 0
fi
if ! [ -d "$TARGET_DIR"/.bin/$NAME/$EXTRACTED_DIRECTORY ]; then
logdbgr "Downloading $NAME."
cd "$TARGET_DIR"/.bin/$NAME
curl -L $URL | gunzip | tar -x
# TODO: this doesn't handle already-existing links
# TODO do we need this chmod? Originally it was for todo.txt but 2.11 contains my patch fixing the bug
chmod +x "$TARGET_DIR"/.bin/$NAME/$EXTRACTED_DIRECTORY/$SCRIPT_FILE
ln -s "$TARGET_DIR"/.bin/$NAME/$EXTRACTED_DIRECTORY/$SCRIPT_FILE "$TARGET_DIR"/.bin/bin/$SCRIPT_FILE
ln -s "$TARGET_DIR"/.bin/$NAME/$EXTRACTED_DIRECTORY/$COMPLETION_FILE "$TARGET_DIR"/.bin/bash_completion
cd $CONFIG_DIR
else
logdbgr "Skipping $NAME due to already-existing directory."
fi
}
print_help() {
cat <<EOF
Usage: ./configctl [ACTION]
Control configuration file installation.
ACTION is one of: $ACTIONS.
The 'install' action is equivalent to the 'prepare', 'migrate', 'link', 'misc', 'preload', and 'precompile' actions, in that order.
The 'uninstall' action is unimplemented.
The 'prepare' action creates directories.
The 'migrate' action migrates old configurations.
The 'link' action creates symlinks and hardlinks, and is dependent on 'prepare'.
The 'misc' action performs miscellaneous tasks, like touching files.
The 'preload' action downloads resources from the network, and is dependent on 'link'. It is the only action requiring network access.
The 'precompile' action precompiles zsh scripts, and is dependent on 'link' and 'preload'.
The 'check' action searches for common binaries and reports if they are missing.
Exit status is 0 upon success; 1 upon a sanity check error; 2 upon
unimplemented functionality; 3 upon failed migration.
Version: configctl@$(git rev-parse --verify --short HEAD)
Copyright (C) 2015-2021 AJ Jordan <[email protected]>.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
EOF
}
# ARGUMENT PARSING
# TODO fix this hot mess to support short options
ACTIONS="install uninstall prepare migrate link misc preload precompile check"
# Validate actions
if [ -n "$1" ]; then
for j in $ACTIONS; do [ $j = $1 ] && ACTION_VALID=; done
else
# The default action is automatically valid
ACTION_VALID=
fi
[ ${ACTION_VALID+x} ] || { print_help; exit 1; }
case "$1" in
'install')
logdbgr "Using action 'install'."
;;
'uninstall')
logdbgr "Using action 'uninstall'."
;;
'prepare')
logdbgr "Using action 'prepare'."
;;
'migrate')
logdbgr "Using action 'migrate'."
;;
'link')
logdbgr "Using action 'link'."
;;
'misc')
logdbgr "Using action 'misc'."
;;
'preload')
logdbgr "Using action 'preload'."
;;
'precompile')
logdbgr "Using action 'precompile'."
;;
'check')
logdbgr "Using action 'check'."
;;
*)
logdbgr "Using default action ('$DEFAULT_ACTION')."
ACTION=$DEFAULT_ACTION
;;
esac
[ -z $ACTION ] && ACTION=$1
for i in $@; do
true
done
# SANITY CHECKS
loginfo "Detected configuration directory as $CONFIG_DIR."
loginfo "Using target directory $TARGET_DIR."
# Error checking on target directory
logdbgr "Checking if target directory exists."
if ! [ -e "$TARGET_DIR" ]; then
logwarn "Target directory does not exist."
loginfo "Creating target directory $TARGET_DIR."
if ! mkdir -p "$TARGET_DIR"; then
logfail "Failed to create directory $TARGET_DIR." 1
fi
fi
logdbgr "Checking if target directory is a directory."
if ! [ -d "$TARGET_DIR" ]; then
logfail "Fatal error: $TARGET_DIR is not a directory." 1
fi
checkavailable git "download resources from Git"
checkavailable curl "download static tarballs"
checkavailable emacs "download Emacs packages"
checkavailable patch "patch ZNC.el"
# Detect zsh
logdbgr "Checking for zsh."
if command -v zsh 2>&1 >/dev/null; then
loginfo "Detected $(type zsh | sed 's/is/as/')."
HAS_ZSH=0
else
logwarn "Failed to detect zsh. Precompilation will not occur."
HAS_ZSH=1
fi
logdbgr "Finished preparing."
logdbgr "Executing main script body."
# ACTION DEFINITIONS
action_prepare() {
loginfo "Creating configuration directories..."
for i in $DIRS; do
printf "Creating $i..."
mkdir -p "$TARGET_DIR"/$i
printf " done.\n"
done
loginfo "Done creating configuration directories."
}
action_migrate() {
loginfo "Migrating old configurations..."
# Remove old git-commit-mode installs
if ls $TARGET_DIR/.emacs.d/elpa/git-commit-mode* > /dev/null 2>&1; then
printf "Detected obsolete git-commit-mode, removing..."
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
rm -rf $TARGET_DIR/.emacs.d/elpa/git-commit-mode*
printf " done.\n"
fi
# Remove old git-rebase-mode installs
if ls $TARGET_DIR/.emacs.d/elpa/git-rebase-mode* > /dev/null 2>&1; then
printf "Detected obsolete git-rebase-mode, removing..."
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
rm -rf $TARGET_DIR/.emacs.d/elpa/git-rebase-mode*
printf " done.\n"
fi
# Migrate obsolete todotxt locations
if [ -d $TARGET_DIR/.bin/todotxt ]; then
printf "Detected obsolete todotxt bin directory, moving..."
if mv $TARGET_DIR/.bin/todotxt $TARGET_DIR/.bin/todo.txt-cli; then
printf " done.\n"
else
logfail "Failed to move obsolete todotxt bin directory. You should remove all todo.txt-related files and rerun configctl." 3
fi
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
printf "Detected obsolete todo_completion symlink, fixing..."
if rm "$TARGET_DIR"/.bin/bash_completion/todo_completion && ln -s "$TARGET_DIR"/.bin/todo.txt-cli/todo.txt_cli-2.10/todo_completion "$TARGET_DIR"/.bin/bash_completion; then
printf " done.\n"
else
logfail "Failed to fix obsolete todo_completion symlink. You should remove all todo.txt-related files and rerun configctl." 3
fi
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
printf "Detected obsolete todo.sh symlink, fixing..."
if rm "$TARGET_DIR"/.bin/bin/todo.sh && ln -s "$TARGET_DIR"/.bin/todo.txt-cli/todo.txt_cli-2.10/todo.sh "$TARGET_DIR"/.bin/bin; then
printf " done.\n"
else
logfail "Failed to fix obsolete todo.sh symlink. You should remove all todo.txt-related files and rerun configctl." 3
fi
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
fi
# Remove manually-installed package.el if Emacs has been upgraded, i.e. if `(require 'package)` suddenly starts working
if check_emacs_package package && [ -e "$TARGET_DIR"/.emacs.d/lisp/package.el ]; then
printf "Detected now-unneeded package.el, removing..."
rm "$TARGET_DIR"/.emacs.d/lisp/package.el
NUM_MIGRATIONS=$(($NUM_MIGRATIONS + 1))
printf " done.\n"
fi
if [ $NUM_MIGRATIONS = 0 ]; then
echo "Nothing to migrate."
fi
loginfo "Done migrating old configurations."
}
action_link() {
loginfo "Installing symlinks..."
for i in $LINK_FILES; do
printf "Installing $i..."
if [ -L "$TARGET_DIR"/$i ]; then
printf " skipped.\n"
continue;
elif [ -e "$TARGET_DIR"/$i ]; then
printf " aborted.\n"
logwarn "Refusing to overwrite file $TARGET_DIR/$i."
continue;
fi
ln -s $CONFIG_DIR/$i "$TARGET_DIR"
printf " done.\n"
done
loginfo "Done installing symlinks."
loginfo "Installing hardlinks..."
for i in $HARDLINKS; do
printf "Installing $i..."
if [ $CONFIG_DIR/$i -ef "$TARGET_DIR"/$i ]; then
printf " skipped.\n"
continue;
elif [ -e "$TARGET_DIR"/$i ]; then
printf " aborted.\n"
logwarn "Refusing to overwrite file $TARGET_DIR/$i."
continue;
fi
ln $CONFIG_DIR/$i "$TARGET_DIR"
printf " done.\n"
done
loginfo "Done installing hardlinks."
loginfo "Installing configuration directory symlinks..."
for i in $LINK_DIRS; do
printf "Installing $i..."
if [ $CONFIG_DIR/$i -ef "$TARGET_DIR"/$i ]; then
printf " skipped.\n"
continue;
elif [ -e "$TARGET_DIR"/$i ]; then
printf " aborted.\n"
logwarn "Refusing to overwrite directory $TARGET_DIR/$i."
continue;
fi
# TODO: make this relative, _maybe_
ln -s $CONFIG_DIR/$i "$TARGET_DIR/$i"
printf " done.\n"
done
loginfo "Done installing configuration directory symlinks."
loginfo "Installing symlinks nested in a directory..."
for i in $AFTER_DIRS; do
printf "Installing $i..."
if [ $CONFIG_DIR/$i -ef "$TARGET_DIR"/$i ]; then
printf " skipped.\n"
continue;
elif [ -e "$TARGET_DIR"/$i ]; then
printf " aborted.\n"
logwarn "Refusing to overwrite file $TARGET_DIR/$i."
continue;
fi
# TODO: make this relative, _maybe_
ln -s $CONFIG_DIR/$i "$TARGET_DIR/$i"
printf " done.\n"
done
loginfo "Done installing symlinks nested in a directory."
}
action_misc() {
loginfo "Checking npm configuration..."
if ! grep -v authToken $TARGET_DIR/.npmrc 2>&1 | diff /dev/stdin $CONFIG_DIR/.npmrc > /dev/null; then
logwarn "$TARGET_DIR/.npmrc is out of sync!"
fi
loginfo "Done checking npm configuration."
loginfo "Touching files..."
for i in $TOUCH_FILES; do
printf "Touching $i..."
touch "$TARGET_DIR"/$i
printf " done.\n"
done
loginfo "Done touching files."
loginfo "Setting permissions..."
printf "Removing group write permission for .ssh/config..."
chmod g-w $TARGET_DIR/.ssh/config
printf " done.\n"
loginfo "Done setting permissions."
}
action_preload() {
loginfo "Cloning resources from git..."
clone_from_git oh-my-zsh 'https://github.com/robbyrussell/oh-my-zsh' .oh-my-zsh
clone_from_git Antigen 'https://github.com/zsh-users/antigen.git' antigen
clone_from_git moz-git-tools 'https://github.com/mozilla/moz-git-tools.git' .bin/moz-git-tools
clone_from_git filter-other-days 'https://github.com/strugee/filter-other-days.git' .bin/filter-other-days
loginfo "Done cloning resources from git."
loginfo "Downloading static tarballs..."
download_from_tarball todo.txt-cli https://github.com/ginatrapani/todo.txt-cli/releases/download/v2.10.0/todo.txt_cli-2.10.tar.gz todo.txt_cli-2.10 todo.sh todo_completion
loginfo "Done downloading static tarballs."
if ! config_includes secure; then
loginfo "Ensuring that package.el is available..."
if ! check_emacs_package package && [ ! -e "$TARGET_DIR"/.emacs.d/lisp/package.el ]; then
logdbgr "\`(require 'package)\` failed, probably Emacs is too old to have package.el."
logdbgr "Downloading package.el."
curl 'https://git.savannah.gnu.org/gitweb/?p=emacs.git;a=blob_plain;hb=ba08b24186711eaeb3748f3d1f23e2c2d9ed0d09;f=lisp/emacs-lisp/package.el' > "$TARGET_DIR"/.emacs.d/lisp/package.el
else
logdbgr "\`(require 'package)\` succeeded."
fi
loginfo "Done ensuring that package.el is available."
loginfo "Downloading Emacs packages..."
# TODO handle errors
emacs --script .emacs
loginfo "Done downloading Emacs packages."
loginfo "Patching ZNC.el..."
cd "$TARGET_DIR"/.emacs.d/elpa/znc-*
# patch -N is specified all the way back in POSIX.1
curl https://github.com/rschuetzler/ZNC.el/commit/e58db9afef82957ffcea6a72977f5f2b4fb53d05.patch | patch -N
rm *.elc
emacs --batch --eval "(byte-recompile-directory \"/home/alex/.emacs.d/elpa/znc-20160627.1332\" 0)"
cd $CONFIG_DIR
loginfo "Done patching ZNC.el."
else
loginfo "Skipping Emacs package downloads because we are running in a secure environment."
fi
handle_submodules
}
action_precompile() {
if [ $HAS_ZSH = 0 ]; then
loginfo "Precompiling zsh scripts..."
cd $TARGET_DIR
for i in $ZSH_PRECOMPILE; do
printf "Precompiling $i..."
zsh -c "zcompile $i"
printf " done.\n"
done
cd $CONFIG_DIR
loginfo "Done precompiling zsh scripts."
else
logwarn "Not precompiling zsh scripts due to missing zsh."
fi
}
action_check() {
logdbgr 'Checking for standard utilities.'
checkavailable_warn sponge
checkavailable_warn ssh
checkavailable_warn dos2unix
checkavailable_warn pv
checkavailable_warn sl
checkavailable_warn nano
checkavailable_warn pkill
checkavailable_warn killall
checkavailable_warn tree
checkavailable_warn traceroute
checkavailable_warn dig
checkavailable_warn jq
if ! config_includes headless; then
checkavailable_warn parcimonie
checkavailable_warn offlineimap
checkavailable_warn profanity
checkavailable_warn mutt
# TODO check for msmtp secrets
checkavailable_warn msmtp
checkavailable_warn http
# For pump.io development
checkavailable_warn gm
checkavailable_warn adb
checkavailable_warn caff
checkavailable_warn gpg-key2ps
if ! config_includes darwin; then
# TODO: check for the presence of Profanity keyring secrets
checkavailable_warn xclip
checkavailable_warn secret-tool
if ! config_includes secure; then
checkavailable_warn firefox-nightly
fi
checkavailable_warn terminator
fi
fi
if ! config_includes no-nodejs; then
checkavailable_warn node
checkavailable_warn npm
checkavailable_warn grunt
checkavailable_warn gulp
checkavailable_warn yo
checkavailable_warn yosay
checkavailable_warn nsp
checkavailable_warn bunyan
checkavailable_warn vows
checkavailable_warn perjury
fi
logdbgr 'Done checking for standard utilities.'
logdbgr 'Checking for SSH keys...'
if ! config_includes no-ssh; then
checkssh general-use
fi
checkssh GitHub github
logdbgr 'Done checking for SSH keys.'
}
# MAIN SCRIPT BODY
if [ $ACTION = 'install' ]; then
action_prepare
action_migrate
action_link
action_misc
action_preload
action_precompile
elif [ $ACTION = 'uninstall' ]; then
logfail 'Uninstallation is unimpemented.' 2
else
action_$ACTION
fi
echo "Finished successfully, with 0 failures, $NUM_WARNINGS warning(s), and $NUM_MIGRATIONS migrations."