-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·37 lines (28 loc) · 769 Bytes
/
Copy pathsetup.sh
File metadata and controls
executable file
·37 lines (28 loc) · 769 Bytes
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
#!/bin/bash
set -e
set -o pipefail
IS_LINUX=$(uname -s | grep -q Linux && echo true || echo false)
IS_ARCH=false
if [[ "$IS_LINUX" == true ]]; then
OS_ID=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
if [[ "$OS_ID" == "arch" ]]; then
IS_ARCH=true
fi
fi
if [[ "$IS_ARCH" == "false" ]]; then
echo "🚨 Unsupported OS" >&2
exit 1
fi
DOTFILES_DIR="$HOME/dotfiles"
if [[ ! -d "$DOTFILES_DIR" ]]; then
if ! [ -x "$(command -v git)" ]; then
if [[ "$IS_ARCH" == true ]]; then
sudo pacman -S --needed git
fi
echo "✅ Installed Git"
fi
git clone --quiet https://github.com/marjorg/setup.git $DOTFILES_DIR
echo "✅ Cloned repository to $DOTFILES_DIR"
else
echo "⚠️ Repository already exist in $DOTFILES_DIR"
fi