-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmanage
executable file
·41 lines (33 loc) · 991 Bytes
/
manage
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
#!/usr/bin/env bash
set -e
# A way to get the absolute path to this directory using
# just shell builtins. (source [[https://stackoverflow.com/a/3915420/6247387][here]]).
root="$(
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
pwd -P
)"
cd "$root" || exit 1
export HOME="$HOME"
export SHELL="${SHELL:-/usr/bin/bash}"
## Cleanup environment for different platforms.
if [ "$(./bin/ls-platform)" = windows ]; then
SHELL=$(cygpath -m "$SHELL")
HOME=$(cygpath -m "$HOME")
fi
# Source and export XDG files for the current platform.
if [ "$("$root"/bin/ls-platform)" = windows ]; then
xdg_file="$root/core/shell/user-dirs.windows"
else
xdg_file="$root/core/shell/user-dirs"
fi
# shellcheck disable=SC1090
source "$xdg_file"
source "$root/core/shell/xdgenv"
xdgvars=$(sed -e '/^#/d' -e '/^$/d' -e 's/^\(.\+\)=\(.\+\)$/\1/' "$xdg_file")
IFS=$'\n'
for var in $xdgvars; do
export "${var?}"
done
[ -e dotenv.local ] && source dotenv.local
export DOTFILES="$root"
./setup/dotty "$@"