-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·95 lines (81 loc) · 2.26 KB
/
setup.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
OS=$(cat /etc/os-release | grep "^ID=" | cut -d'=' -f2)
source ./utils/logs.sh
# check if superuser
if [ "$EUID" -eq 0 ]
then error "Please do not run as with superuser privileges (you will be asked for the password when needed)"
exit 1
fi
# ask for sudo validation
info "Please enter your password to continue"
sudo -v
if [ $? -ne 0 ]; then
error "Failed to validate privileges"
exit 1
fi
# check if the operating system is supported
if [ $OS = "fedora" ]; then
debug "Fedora detected, continuing with the setup\n"
else
error "The operating system is unsuported"
exit 1
fi
# update the system
info "Updating the system"
if [ $OS = "fedora" ]; then
sudo dnf update -y
if [ $? -ne 0 ]; then
error "Failed to update the system"
exit 1
fi
fi
success "System updated\n"
# setup ssh keys
info "Setting up ssh keys"
info "Installing openssl"
if [ $OS = "fedora" ]; then
sudo dnf install -y openssl
fi
info "Decrypting the files"
mkdir -p ~/.ssh
# encrypt with: zip --encrypt -r ssh_keys.enc .ssh
unzip ssh_keys.enc
mv .ssh ~
success "Files decrypted\n"
# run os specific commands (flatpak with fedora, rpm...)
if [ $OS = "fedora" ]; then
info "Running fedora specific commands"
source ./os_scripts/fedora.sh
fi
# install the required packages
info "Installing FNM"
if [ -x "$(command -v fnm)" ]; then
warning "FNM is already installed\n"
else
curl -fsSL https://fnm.vercel.app/install | bash
source ~/.bashrc
fnm install --latest
success "FNM installed\n"
fi
info "Installing c and c++ compilers"
if [ $OS = "fedora" ]; then
sudo dnf install -y gcc-c++ gcc
fi
success "C and C++ compilers installed\n"
info "Installing neovim"
if [ $OS = "fedora" ]; then
sudo dnf install -y neovim ripgrep
fi
success "Neovim installed\n"
info "Setting up neovim"
git clone git@github.com:timrekelj/neotim ~/.config/nvim
success "Neovim configuration installed (may require further setup)\n"
git config --global user.email "hello@timrekelj.si"
git config --global user.name "Tim Rekelj"
# copy font files to their default locations
mkdir -p ~/.local/share/fonts
cp -r fonts/* ~/.local/share/fonts/
# copy config files
info "Copying config files to their default locations\n"
cp .bashrc ~/
cp -r wallpapers ~/Pictures/