This repository was archived by the owner on Aug 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashInstall
More file actions
executable file
·89 lines (73 loc) · 1.9 KB
/
Copy pathbashInstall
File metadata and controls
executable file
·89 lines (73 loc) · 1.9 KB
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
#!/bin/dash
#
# Installs a basic fallback Bash environment into the
# user's $HOME directory.
#
# usage: bashInstall [ --install | --check | --remove | --clean | --nuke ]
#
# where --install: installs other development related config files
# --check: checks what was installed
# --remove: removes files which were installed
# --clean: same as above, deletes emptied directories
# --nuke: same as above but cleans up other content
#
# For more traditional Unix pre-XDG utilities.
# shellcheck shell=sh
export SCRIPT_NAME=bashInstall
export DOTFILES_GIT_REPO="${DOTFILES_GIT_REPO:=$HOME/devel/dotfiles}"
export DF_ACTION=install
cd "$DOTFILES_GIT_REPO/home" || {
printf '%s: failed to cd into %s\n' "$SCRIPT_NAME" "$DOTFILES_GIT_REPO/home" >&2
exit 1
}
umask 0022
. ../bin/sourced/parse_cmdline.sh
. ../bin/sourced/functions.sh
bash_files='
.bash_logout
.bash_profile
.bashrc
.inputrc
'
bin_scripts='
chkcolor
monitor
spin
'
remove_items="
$HOME/.bash_login
$HOME/.profile
$HOME/bin/codepoint
$HOME/bin/etherApe
$HOME/bin/pathtrim
$HOME/bin/rt
$HOME/bin/viewJarManifest
"
dirs_to_create="
$HOME/catch
$HOME/scratch
"
items_to_clean="
$HOME/.bash_history
"
items_to_nuke=''
## Perform ACTION
case "$DF_ACTION" in
install|check|remove)
# Process bash config files
process_files "$HOME" "$bash_files" . 0644
# Process ~/bin scripts
process_files "$HOME/bin" "$bin_scripts" bin 0755
chmod 0755 "$HOME/bin"
# Remove/report no longer needed files and directories
remove_items "$remove_items"
# Create/report missing/delete directories
ensure_dirs "$dirs_to_create"
;;
clean)
remove_items "$items_to_clean"
;;
nuke)
remove_items "$items_to_clean $items_to_nuke"
;;
esac