-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-steamos-setup.bash
executable file
·102 lines (71 loc) · 1.92 KB
/
01-steamos-setup.bash
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
#! /usr/bin/env bash
# Root check:
if [[ ! "${USER}" == "root" ]]; then
echo "You need root privileges to run this."
exit 1
fi
# Packages to install via pacman:
TO_INSTALL=(
git
glibc
openssh
rsync
vim
zsh
)
# Locales to enable:
LOCALES=(
"en_GB.UTF-8"
"it_IT.UTF-8"
"ja_JP.UTF-8"
)
# Full line separator (with fallback):
SEP=""
if [[ $(command -v tput) ]]; then
I=0
TCOLS=$(tput cols)
while [[ ${I} -lt ${TCOLS} ]]; do
SEP+="="
I=$((I + 1))
done
else
SEP="======================================================================="
fi
# Control variable, so we0ll eval only on SteamOS:
lsb_release -a | grep SteamOS &> /dev/null
NOT_STEAMOS=$?
# Utility function: prints a nice colored line and executes a command.
# Parameters:
# - prompt to print after the colored line
# - command string to eval
function execho()
{
# Bold: \e[1m
# Black background: \e[49m
# Red foreground: \e[31m
P="\e[1m\e[49m\e[31m"
# Full line separator:
echo -e "${P}${SEP}"
echo -e "${P}=====>\e[0m ${1}"
# Only eval on SteamOS, otherwise just echo:
if [[ 0 == ${NOT_STEAMOS} ]]; then
eval "${2}"
else
echo "${2}"
fi
}
execho "Removing readonly flag..." "steamos-readonly disable"
execho "Setting up keyring..." "pacman-key --init"
execho "Populating keyring 'archlinux'..." "pacman-key --populate archlinux"
execho "Populating keyring 'holo'..." "pacman-key --populate holo"
execho "Updating keyring packages..." \
"pacman -S --noconfirm --overwrite \* archlinux-keyring holo-keyring"
execho "Installing packages..." \
"pacman -S --noconfirm --overwrite \* ${TO_INSTALL[*]}"
execho "Setting user shell to zsh..." "chsh -s /bin/zsh deck"
for l in ${LOCALES[@]}; do
execho "Enabling locale '${l}'..." \
"sed -i \"s,^#${l},${l},\" /etc/locale.gen"
done
execho "Generating locales..." "locale-gen"
execho "Setting back readonly flag..." "steamos-readonly enable"