-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·67 lines (56 loc) · 2.27 KB
/
Copy pathsetup
File metadata and controls
executable file
·67 lines (56 loc) · 2.27 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
65
66
67
#!/usr/bin/env bash
set -o pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=scripts/lib/common.sh
source "${REPO_ROOT}/scripts/lib/common.sh"
timestamp=$(date +"%Y-%m-%d_%H:%M:%S")
LOGFILE="${REPO_ROOT}/logs/${timestamp}_setup.log"
init_logging "setup"
_get_distro() {
[ -f /etc/os-release ] && source /etc/os-release
[ "$1" = "arch" ] || [ "$1" = "debian" ] || [ "$1" = "fedora" ] && echo "$1" && return 0
[[ "$ID" =~ "fedora" ]] || [[ "$ID_LIKE" =~ "fedora" ]] && echo "fedora" && return 0
[[ "$ID_LIKE" =~ "arch" ]] || [[ "$ID" =~ "arch" ]] && echo "arch" && return 0
[[ "$ID_LIKE" =~ "debian" ]] || [[ "$ID" =~ "debian" ]] && echo "debian" && return 0
return 1
}
_print_post_setup_tasks() {
_section "Setup finished"
_out "Post-setup tasks:"
_out "1. Reboot the machine"
_out "2. Run ghostty"
_out "3. Check firewall rules if one was already installed"
_out "4. Install Node.js via nvm (after exec zsh):"
_out " - nvm install node"
_out "5. Install python with pyenv (skip first two steps on arch):"
_out " - pyenv install -l | less"
_out " - pyenv install <version>"
_out " - pyenv global <version>"
_out " - mkdir -p ~/Python && cd ~/Python"
_out " - python -m venv <name>"
_out "6. Open nvim and make sure plugins are installed (automation should have done this):"
_out " - nvim"
_out "7. Open tmux (tmux) and make sure plugins are installed (automation should have done this):"
_out " - tmux"
_out " - Run this, if plugins are not installed: ctrl+space I"
_out "8. Log out/in (or run 'newgrp docker') for docker group membership to apply"
}
main() {
local distro username
username="$(whoami)"
_info "Linux setup script for Arch, Debian, and Fedora"
if ! distro=$(_get_distro "$1") || [ -z "$distro" ]; then
_error "Unknown distribution. Provide 'arch', 'debian', or 'fedora' as an argument."
exit 1
fi
_info "Running setup for ${distro}..."
LOGFILE="${LOGFILE}" LINUX_SETUP_LOGGING=1 "${REPO_ROOT}/scripts/setup-${distro}" "$username"
rc=$?
if [ "$rc" -eq 0 ]; then
_info "Setup completed. Log saved to: ${LOGFILE}"
_print_post_setup_tasks
exit 0
fi
exit 1
}
main "$@"