-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·64 lines (52 loc) · 1.68 KB
/
install.sh
File metadata and controls
executable file
·64 lines (52 loc) · 1.68 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
#!/bin/bash
set -e
SCRIPT_DIR=$(dirname $0)
pushd "$SCRIPT_DIR" >/dev/null
SCRIPT_DIR=$(pwd)
for SFILE in $(ls -1 "./" | grep '^_'); do
TARGET_FILE=$(echo "$SFILE" | sed 's/^_/./g')
TARGET_FULL="$HOME/$TARGET_FILE"
echo "$SFILE"
if [ -L "$TARGET_FULL" ]; then
rm -rf "$TARGET_FULL"
fi
if [ -e "$TARGET_FULL" ]; then
echo "$HOME/$TARGET_FILE exits. creating a backup"
mv "$HOME/$TARGET_FILE" "$HOME/$TARGET_FILE.backup"
fi
ln -s "$PWD/$SFILE" "$TARGET_FULL"
done
mkdir -p $HOME/.config/i3
ln -sf $SCRIPT_DIR/config/i3/config $HOME/.config/i3
mkdir -p $HOME/.config/i3status
ln -sf $SCRIPT_DIR/config/i3status/config $HOME/.config/i3status
# add own bashrc to the existing ~/.bashrc + delete existing
# bashrc_nmandery inclusion
[ -f ~/.bashrc ] || touch ~/.bashrc
sed -i '/dotfiles nmandery start/,/dotfiles nmandery end/d' ~/.bashrc
cat >>~/.bashrc <<EOF
# dotfiles nmandery start
[ -f ~/.bashrc_nmandery ] && . ~/.bashrc_nmandery
# dotfiles nmandery end
EOF
# add own zshrc to the existing ~/.zshrc + delete existing
# zshrc_nmandery inclusion
[ -f ~/.zshrc ] || touch ~/.zshrc
sed -i '/dotfiles nmandery start/,/dotfiles nmandery end/d' ~/.zshrc
cat >>~/.zshrc <<EOF
# dotfiles nmandery start
[ -f ~/.zshrc_nmandery ] && . ~/.zshrc_nmandery
# dotfiles nmandery end
EOF
# add binaries
BINDIR=`realpath ~/bin`
[ -d "$BINDIR" ] || mkdir "$BINDIR"
for BINFILE in $(find "$SCRIPT_DIR/bin" -type f); do
if [ -x "$BINFILE" ]; then
BINBASENAME=$(basename "$BINFILE")
echo "linking executable $BINBASENAME to $BINDIR."
rm -f "$BINDIR/$BINBASENAME"
ln -f -s "$BINFILE" "$BINDIR/$BINBASENAME"
fi
done
popd >/dev/null