This repository was archived by the owner on Aug 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup
More file actions
executable file
·107 lines (89 loc) · 2.87 KB
/
setup
File metadata and controls
executable file
·107 lines (89 loc) · 2.87 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
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
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
set -euxo pipefail
# shellcheck source=_setup-scripts/utils.sh
source _setup-scripts/utils.sh
do_setup() {
if is_ci; then
# Make sure we don't get any readline prompts on CI
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
fi
bootstrap
clone_dotfiles
if [[ $(uname) == "Linux" ]]; then
./_setup-scripts/debian.sh
./_setup-scripts/debian_i3wm.sh
./_setup-scripts/debian_additional.sh
./_setup-scripts/debian_docker.sh
./_setup-scripts/debian_gh_cli.sh
fi
if [[ $(uname) == "Darwin" ]]; then
./_setup-scripts/mac.sh
fi
./_setup-scripts/stow.sh
./asdf/.bin/asdf_bootstrap.sh
finish
}
# Preparing the system, updating packages, installing deps to run the rest.
bootstrap() {
if [[ $(uname) == "Darwin" ]]; then
echo "[setup] Warning! MacOS setup is currently only tested on Seqoia 15.1"
echo "[setup] Starting to set up homebrew"
set +ex
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
brew analytics off
brew install git curl libyaml
rustup default stable
fi
if [[ $(uname) == "Linux" ]]; then
print_message "[setup] Ensure prerequisites are installed"
run_with_sudo apt-get update -qq
run_with_sudo apt-get install software-properties-common git wget curl \
libdbus-glib-1-dev libyaml-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev liblzma-dev zlib1g-dev libbz2-dev -qq
print_message "[setup] Upgrading and autocleaning packages..."
run_with_sudo apt-get update -qq
run_with_sudo apt-get upgrade -qq --allow-downgrades --allow-remove-essential --allow-change-held-packages
run_with_sudo apt-get autoremove -y -qq
fi
}
clone_dotfiles() {
if [ -d "$HOME/.dotfiles" ]; then
print_message "[setup] Dotfiles exist. Updating dotfiles..."
# cd "$HOME/.dotfiles" && git stash && git checkout main -q && git pull -q && (git stash pop || true)
elif [ "${TESTING-false}" == "true" ]; then
print_message "[setup] We're in our testing container. Hello!"
print_message "[setup] We're about to test the code that has been mapped to the container."
cd /code || exit 1
cp -r /code "$HOME/.dotfiles"
else
print_message "[setup] Cloning dotfiles..."
git clone -q https://github.com/phansch/dotfiles.git "$HOME/.dotfiles" && cd "$HOME/.dotfiles" || exit
fi
}
finish() {
if is_ci; then return; fi
ask_for_confirmation "[setup] Almost done. Do you want to re-login now to complete the setup? "
if answer_is_yes; then
xfce4-session-logout --logout
else
echo "Ok, not logging you out."
fi
}
all=null
while getopts ":as" opt; do
case "$opt" in
a)
all=true
;;
s)
all=false
;;
\?)
echo >&2 \
"usage: $0 [-a] [-s]"
exit 1
;;
esac
done
shift $((OPTIND - 1))
do_setup "$all"