forked from ThePrimeagen/dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-env
More file actions
executable file
·82 lines (67 loc) · 1.81 KB
/
dev-env
File metadata and controls
executable file
·82 lines (67 loc) · 1.81 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
#!/usr/bin/env bash
dry_run="0"
if [ -z "$XDG_CONFIG_HOME" ]; then
echo "no xdg config hom"
echo "using ~/.config"
XDG_CONFIG_HOME=$HOME/.config
fi
if [ -z "$DEV_ENV" ]; then
echo "env var DEV_ENV needs to be present"
exit 1
fi
if [[ $1 == "--dry" ]]; then
dry_run="1"
fi
log() {
if [[ $dry_run == "1" ]]; then
echo "[DRY_RUN]: $1"
else
echo "$1"
fi
}
log "env: $DEV_ENV"
update_files() {
log "copying over files from: $1"
pushd $1 &> /dev/null
(
configs=`find . -mindepth 1 -maxdepth 1 -type d`
for c in $configs; do
directory=${2%/}/${c#./}
log " removing: rm -rf $directory"
if [[ $dry_run == "0" ]]; then
rm -rf $directory
fi
log " copying env: cp $c $2"
if [[ $dry_run == "0" ]]; then
cp -r ./$c $2
fi
done
)
popd &> /dev/null
}
copy() {
log "removing: $2"
if [[ $dry_run == "0" ]]; then
rm $2
fi
log "copying: $1 to $2"
if [[ $dry_run == "0" ]]; then
cp $1 $2
fi
}
update_files $DEV_ENV/env/.config $XDG_CONFIG_HOME
update_files $DEV_ENV/env/.local $HOME/.local
copy $DEV_ENV/tmux-sessionizer/tmux-sessionizer $HOME/.local/scripts/tmux-sessionizer
copy $DEV_ENV/env/.zsh_profile $HOME/.zsh_profile
copy $DEV_ENV/env/.zshrc $HOME/.zshrc
copy $DEV_ENV/env/.xprofile $HOME/.xprofile
copy $DEV_ENV/env/.tmux-sessionizer $HOME/.tmux-sessionizer
copy $DEV_ENV/dev-env $HOME/.local/scripts/dev-env
# build daydream's client and server
pushd $DEV_ENV/daydream &> /dev/null
./build
popd &> /dev/null
mkdir -p $HOME/.local/bin
copy $DEV_ENV/daydream/opencode-client $HOME/.local/bin/opencode-client
copy $DEV_ENV/daydream/opencode-server $HOME/.local/bin/opencode-server
hyprctl reload