-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev
More file actions
executable file
·82 lines (66 loc) · 2.06 KB
/
dev
File metadata and controls
executable file
·82 lines (66 loc) · 2.06 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
#!/bin/sh
export DEV_ENV_HOME="/home/simbaclaws/dev"
dry_run="0"
# Ensure DEV_ENV_HOME is set
if [ -z "$DEV_ENV_HOME" ]; then
echo "env var \$DEV_ENV_HOME needs to be present"
exit 1
fi
# Handle dry run argument
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_HOME"
update_files() {
log "copying over files from: $1"
# Use cd instead of pushd/popd
cd "$1" || exit 1
# Find directories and iterate over them
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
cd - || exit 1
}
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 and copy necessary configurations
update_files "$DEV_ENV_HOME/env/.config" "$HOME/.config"
# update_files "$DEV_ENV_HOME/env/.local" "$HOME/.local"
# copy "$DEV_ENV_HOME/tmux-sessionizer/tmux-sessionizer" "$HOME/.local/bin/tmux-sessionizer"
copy "$DEV_ENV_HOME/env/.config/picom.conf" "$HOME/.config/picom.conf"
copy "$DEV_ENV_HOME/env/.config/redshift.conf" "$HOME/.config/redshift.conf"
copy "$DEV_ENV_HOME/env/.zsh_profile" "$HOME/.zsh_profile"
copy "$DEV_ENV_HOME/env/.bash_profile" "$HOME/.bash_profile"
copy "$DEV_ENV_HOME/env/.xprofile" "$HOME/.xprofile"
copy "$DEV_ENV_HOME/env/.zshrc" "$HOME/.zshrc"
copy "$DEV_ENV_HOME/env/.local/bin/tmux-sessionizer" "$HOME/.local/bin/tmux-sessionizer"
copy "$DEV_ENV_HOME/env/.local/bin/ready-tmux" "$HOME/.local/bin/ready-tmux"
# copy "$DEV_ENV_HOME/env/.tmux-sessionizer" "$HOME/.tmux-sessionizer"
copy "$DEV_ENV_HOME/dev" "$HOME/.local/bin/dev"
copy "$DEV_ENV_HOME/scripts/askpass-rofi" "$HOME/.local/bin/askpass-rofi"
copy "$DEV_ENV_HOME/scripts/cht.sh" "$HOME/.local/bin/cht"
sudo cp $DEV_ENV_HOME/scripts/start-dwm.sh /usr/local/bin/start-dwm.sh