-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
54 lines (39 loc) · 1.22 KB
/
Copy pathsetup.sh
File metadata and controls
54 lines (39 loc) · 1.22 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
#!/bin/bash
LOCALBASH_DIR = "$HOME/environment_definitions"
backupdir="$HOME/backup"
if [ ! -d "$LOCALBASH_DIR" ];
then
log_error "$LOCALBASH_DIR does not exists!"
exit
fi
echo "This sets up your .bashrc, .bash_profile and .envrc. Overwritten files are backed up to ~/backup."
mkdir -p "$HOME/backup"
if [ ! -d "$backupdir" ];
then
log_error "$backupdir could not be created!"
exit
fi
backupfiles=( ".bashrc" ".bash_profile" ".envrc" ".profile")
for i in "${backupfiles[@]}"
do
:
file="$HOME/$i"
if [ -f "$HOME/$i" ]
then
echo "backing up $file ..."
mv $file "$backupdir/${i}_$(date +%F-%T)"
fi
done
function copy_
# ln -s "$LOCALBASH_DIR/configurations/direnv/direnvrc" "$HOME/.config/direnv/direnvrc"
# TODO:
# - separate login and interactive shells, clear up role of direnv. direnv must be selfcontained and if it is not executed, no harm.
# - setup script in python or make?
# - custom VIM setup baked in
# use direnv executable to whip bash into submission?
# Problems:
# things like stdlib not sourced before dlr script
# pyenv was not found, initialization in .envrc?? Problematic probably
# bash_profile not loaded -> nothing worked
# endless loop in .direnv
# stdlib not picked up