-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_user.sh
79 lines (60 loc) · 2.04 KB
/
install_user.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
mkdir -p "/home/$(whoami)/Documents"
mkdir -p "/home/$(whoami)/Downloads"
# Uncomment to set the keymap you want. Replace "fr" by your country code
# localectl --no-convert set-x11-keymap fr
# Function able to install any package from the AUR (needs the package names as arguments).
aur_install() {
curl -O "https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz" \
&& tar -xvf "$1.tar.gz" \
&& cd "$1" \
&& makepkg --noconfirm -si \
&& cd - \
&& rm -rf "$1" "$1.tar.gz"
}
aur_check() {
qm=$(pacman -Qm | awk '{print $1}')
for arg in "$@"
do
if [[ "$qm" != *"$arg"* ]]; then
yay --noconfirm -S "$arg" &>> /tmp/aur_install \
|| aur_install "$arg" &>> /tmp/aur_install
fi
done
}
cd /tmp
dialog --infobox "Installing \"Yay\", an AUR helper..." 10 60
aur_check yay
count=$(wc -l < /tmp/aur_queue)
c=0
cat /tmp/aur_queue | while read -r line
do
c=$(( "$c" + 1 ))
dialog --infobox \
"AUR install - Downloading and installing program $c out of $count: $line..." \
10 60
aur_check "$line"
done
DOTFILES="/home/$(whoami)/dotfiles"
if [ ! -d "$DOTFILES" ]; then
# Don't forget to replace benjaminshawki with your own username on Github
git clone https://github.com/benjaminshawki/dotfiles.git \
"$DOTFILES" >/dev/null
fi
source "$DOTFILES/zsh/.zshenv"
# Some trickery with the .gitmodules file to make sure the submodules are installed.
cd "$DOTFILES"
# Backup the original .gitmodules file
mv "$DOTFILES/.gitmodules" "$DOTFILES/.gitmodules_backup"
git submodule update --init --recursive nvim
# Replace SSH URLs with HTTPS URLs in .gitmodules
#sed -i 's/[email protected]:/https:\/\/github.com\//g' "$DOTFILES/.gitmodules"
# Sync the submodule URLs to the updated .gitmodules
#git submodule sync
# Initialize and update the submodules
#git submodule update --init --recursive
bash install.sh
# Restore the original .gitmodules file
mv "$DOTFILES/.gitmodules_backup" "$DOTFILES/.gitmodules"
# Sync back to the original SSH URLs
git submodule sync