8
8
source constants.sh
9
9
source helpers.sh
10
10
11
+ PASSWORD=
12
+
13
+ user_setup () {
14
+ echo -e " ${GREEN} Creating new user${NC} "
15
+ useradd -m -G wheel $USERNAME
16
+ echo ${USERNAME} :${PASSWORD} | chpasswd -e
17
+ }
18
+
11
19
build_stepmania () {
12
20
echo -e " ${GREEN} Building StepMania${NC} "
21
+ begin_checked_section
22
+
13
23
git clone --depth=1 https://github.com/stepmania/stepmania.git /stepmania
14
24
mkdir /stepmania/build
15
25
pushd /stepmania
@@ -25,20 +35,25 @@ build_stepmania() {
25
35
cmake --install build --strip
26
36
popd
27
37
rm -rf /stepmania
38
+ chown -R ${USERNAME} :${USERNAME} /opt/stepmania-5.1/
39
+
40
+ end_checked_section
28
41
}
29
42
30
43
configure_settings () {
31
44
echo -e " ${GREEN} Setting up configuration files${NC} "
45
+ begin_checked_section
32
46
33
47
# Set initial configuration for StepMania
34
48
mkdir -p /opt/stepmania-5.1/Data
35
49
cat << EOF >> /opt/stepmania-5.1/Data/Static.ini
36
50
[Options]
37
51
Windowed=0
38
52
EOF
53
+ chown ${USERNAME} :${USERNAME} /opt/stepmania-5.1/Data/Static.ini
39
54
40
55
# Run stepmania when `startx` is run
41
- cat << EOF > ~ /.xinitrc
56
+ cat << EOF > /home/ ${USERNAME} /.xinitrc
42
57
#!/bin/sh
43
58
44
59
if [ -d /etc/X11/xinit/xinitrc.d ]; then
50
65
51
66
exec /opt/stepmania-5.1/stepmania
52
67
EOF
68
+ chown ${USERNAME} :${USERNAME} /home/${USERNAME} /.xinitrc
53
69
54
70
# Automatically login as root
55
71
mkdir -p /etc/systemd/system/
[email protected]
56
72
cat
<< EOF > /etc/systemd/system/[email protected] /override.conf
57
73
[Service]
58
74
ExecStart=
59
- ExecStart=-/usr/bin/agetty --skip-login --nonewline --noissue --autologin root --noclear %I \$ TERM
75
+ ExecStart=-/usr/bin/agetty --skip-login --nonewline --noissue --autologin $USERNAME --noclear %I \$ TERM
60
76
EOF
61
77
62
78
# Start X after login on tty1
63
- cat << EOF > ~ /.bash_profile
79
+ cat << EOF > /home/ ${USERNAME} /.bash_profile
64
80
if [[ -z \$ DISPLAY ]] && [[ \$ (tty) = /dev/tty1 ]]; then
65
81
startx -- -nocursor &>/dev/null
66
82
fi
67
83
EOF
84
+ chown ${USERNAME} :${USERNAME} /home/${USERNAME} /.bash_profile
68
85
69
86
# Disable `Last login...` message
70
- touch ~ /.hushlogin
87
+ touch /home/${USERNAME} /.hushlogin
88
+ chown ${USERNAME} :${USERNAME} /home/${USERNAME} /.hushlogin
89
+
90
+ end_checked_section
71
91
}
72
92
73
93
timezone_setup () {
@@ -84,6 +104,9 @@ locale_setup() {
84
104
}
85
105
86
106
initramfs_setup () {
107
+ echo -e " ${GREEN} Rebuilding initramfs${NC} "
108
+ begin_checked_section
109
+
87
110
# Compress with lz4
88
111
echo COMPRESSION=\" lz4\" >> /etc/mkinitcpio.conf
89
112
echo COMPRESSION_OPTIONS=\" -9\" >> /etc/mkinitcpio.conf
@@ -118,10 +141,14 @@ EOF
118
141
119
142
# Rebuild initramfs
120
143
mkinitcpio -p linux
144
+
145
+ end_checked_section
121
146
}
122
147
123
148
bootloader_setup () {
124
149
echo -e " ${GREEN} Setting up bootloader${NC} "
150
+ begin_checked_section
151
+
125
152
bootctl install
126
153
local uuid=$( cat $UUID_PATH )
127
154
cat << EOF > /boot/loader/loader.conf
@@ -154,13 +181,26 @@ EOF
154
181
if [[ " $( sha256sum /boot/EFI/systemd/systemd-bootx64.efi | cut -d' ' -f1) " == " $checksum " ]]; then
155
182
echo -ne " \x90\x90\x90\x90\x90" | dd of=/boot/EFI/systemd/systemd-bootx64.efi bs=1 seek=40320 count=5 conv=notrunc
156
183
fi
184
+
185
+ end_checked_section
157
186
}
158
187
159
188
cleanup () {
189
+ echo -e " ${GREEN} Cleaning up${NC} "
160
190
rm -rf /var/cache/pacman/pkg
161
191
touch /tmp/success
162
192
}
163
193
194
+ # Parse arguments
195
+ while [[ " $1 " != " " ]]; do
196
+ case $1 in
197
+ --password ) shift ; PASSWORD=$1 ;;
198
+ * ) echo " Invalid argument \" $1 \" " ; exit 1 ;;
199
+ esac
200
+ shift
201
+ done
202
+
203
+ user_setup
164
204
build_stepmania
165
205
configure_settings
166
206
timezone_setup
0 commit comments