-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
60 lines (52 loc) · 1.87 KB
/
install.sh
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
#! /bin/bash
# call with
# curl -Lks https://github.com/TheJoeSchr/dotfiles/raw/main/install.sh -o install.sh && env bash -x install.sh
ntpdate 0.us.pool.ntp.org >/dev/null 2>&1
putgitrepo() {
# Downloads a gitrepo $1 and places the files in $2 only overwriting conflicts
echo "Downloading and installing config files..."
[ -z "$3" ] && branch="main" || branch="$repobranch"
dir=$(mktemp -d)
[ ! -d "$2" ] && mkdir -p "$2"
chown "$name":wheel "$dir" "$2"
sudo -u "$name" git -C "$repodir" clone --depth 1 \
--single-branch --no-tags -q --recursive -b "$branch" \
--recurse-submodules "$1" "$dir"
sudo -u "$name" cp -rfT "$dir" "$2"
}
read -p "Re-clone bare git at $HOME/.cfg?" -n 1 -r -t 15 REPLY
echo # This is to move to a new line after reading input
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf $HOME/.cfg
git clone --bare [email protected]:TheJoeSchr/dotfiles.git $HOME/.cfg
fi
config="$(which git) --git-dir=$HOME/.cfg/ --work-tree=$HOME"
echo 'config="$(which git) --git-dir=$HOME/.cfg/ --work-tree=$HOME"'
#$config fetch --all
# doesn't work
read -p "Deleting pre-existing dot files?" -n 1 -r -t 15 REPLY
echo # This is to move to a new line after reading input
if [[ $REPLY =~ ^[Yy]$ ]]; then
$config reset --hard main
fi
$config checkout main
$config config status.showUntrackedFiles no
# Checkout submodules
$config submodule update --init --recursive
touch ~/.vimrc.local
touch ~/.bashrc.local
mkdir -p ~/Downloads
read -p "run ~/archRiceSystem.fish ?" -n 1 -r -t 15 REPLY
echo # This is to move to a new line after reading input
if [[ $REPLY =~ ^[Yy]$ ]]; then
# need to install fish first
sudo pacman -Sy --noconfirm fish
chmod +x ~/archRiceSystem.fish
/usr/bin/env fish ~/archRiceSystem.fish
fi
read -p "source .bashrc?" -n 1 -r -t 15 REPLY
echo # This is to move to a new line after reading input
if [[ $REPLY =~ ^[Yy]$ ]]; then
# source new files
. .bashrc
fi