-
Notifications
You must be signed in to change notification settings - Fork 10
198 lines (185 loc) · 9.7 KB
/
builds.yml
File metadata and controls
198 lines (185 loc) · 9.7 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: docker build
# on: [push]
on:
push:
paths:
- 'usr/share/usability-misc/dist-installer-cli-standalone'
- '.github/workflows/builds.yml'
jobs:
changes:
runs-on: ubuntu-22.04
permissions:
pull-requests: read
outputs:
builds: ${{ steps.filter.outputs.builds }}
installer: ${{ steps.filter.outputs.installer }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
installer:
- 'usr/share/usability-misc/dist-installer-cli-standalone'
builds:
- '.github/workflows/builds.yml'
build:
needs: changes
# if: ${{ (needs.changes.outputs.installer == 'true') }}
# if: ${{ (needs.changes.outputs.builds == 'true') }}
if: ${{ (needs.changes.outputs.installer == 'true' || needs.changes.outputs.builds == 'true') }}
## Github takes too long to set the current latest image, this is
## why we set it manually.
## https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- image: fedora:41
- image: fedora:42
#- image: fedora:latest
#- image: fedora:rawhide
## Debian bullseye: EOL
## E: The repository '\''https://deb.debian.org/debian bullseye-backports Release'\'' does not have a Release file.
#- image: debian:oldoldstable
- image: debian:oldstable
- image: debian:stable
- image: debian:testing
- image: debian:unstable
- image: ubuntu:latest
- image: linuxmintd/mint22.1-amd64:latest
- image: kalilinux/kali-rolling
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: System Basic Packages
run: |
if command -v apt-get; then
apt-get update --error-on=any
## Installer aborts if package upgrades are pending.
apt-get dist-upgrade --yes
apt-get install --yes shellcheck sudo adduser tor locales
elif command -v dnf; then
dnf upgrade --assumeyes
dnf install --assumeyes ShellCheck sudo tor systemd gawk
## Debugging.
dnf provides needs-restarting
else
exit 1
fi
## TODO: test
sed -i "s/^# \(ru_RU.UTF-8 UTF-8\)$/\1/" /etc/locale.gen || true
## TODO: Probably missing package on Fedora.
locale-gen || true
- name: System information
run: |
cat /etc/os-release
sep="--------------------"
printf '%s\n' "${sep}"
uname -a
printf '%s\n' "${sep}"
echo "${PATH}"
printf '%s\n' "${sep}"
localedef --list-archive
printf '%s\n' "${sep}"
locale
printf '%s\n' "${sep}"
if command -v apt-get >/dev/null; then
for f in \
/etc/apt/sources.list \
/etc/apt/sources.list.d/*.list \
/etc/apt/sources.list.d/*.sources
do
test -f "${f}" || continue
printf '%s\n%s\n%s\n' "### ${f} ###" "$(cat "$f")" "${sep}"
done
elif command -v dnf >/dev/null; then
for f in \
/etc/yum.repos.d/*.repo
do
test -f "${f}" || continue
printf '%s\n%s\n%s\n' "### ${f} ###" "$(cat "$f")" "${sep}"
done
fi
printf '%s\n' "${sep}"
#cat /etc/sudoers
#ls /etc/sudoers.d
- name: Enable Services
run: |
if command -v apt-get; then
service tor start
service tor status
elif command -v dnf; then
#cat /etc/tor/torrc || true
## Manual start without systemd.
# sudo -u toranon tor -f /etc/tor/torrc --RunAsDaemon 1
# sleep 3
# ps aux | grep tor
## 'service' not available on Fedora.
#service tor start || true
#service tor status || true
/lib/systemd/systemd --system || true
/usr/sbin/init || true
## systemd installation in this way does not work. Error message:
## System has not been booted with systemd as init system (PID 1). Can't operate.
systemctl enable --now tor || true
systemctl start tor || true
systemctl status tor || true
fi
- name: Normal user with sudo privileges
run: |
if test -f /etc/debian_version; then
## Debian trixie needs "--comment".
## Older Debian versions need "--gecos".
adduser --comment "" --disabled-password user || adduser --gecos "" --disabled-password user
usermod -aG sudo user
echo "%sudo ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/user
elif test -f /etc/fedora-release; then
adduser user
usermod -aG wheel user
echo "%wheel ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/user
else
exit 1
fi
- name: Run default dist-installer-cli - Clearnet
run: sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci
- name: Run default dist-installer-cli - Onion
run: sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --onion
- name: Run VirtualBox Installer - default repository - Clearnet
run: sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only
- name: Run VirtualBox Installer - default repository - Onion
run: sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --onion
- name: Run VirtualBox Installer - Oracle repository - Clearnet
run: |
if ! grep -iq "kali" /etc/os-release; then
sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --oracle-repo
fi
- name: Run VirtualBox Installer - Oracle repository - Onion
run: |
if ! grep -iq "kali" /etc/os-release; then
sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --oracle-repo --onion
fi
- name: Run VirtualBox Installer - back to default repository
run: |
sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only || {
ec="$?"
if grep -iq -e "debian" -e "buntu" -e "mint" /etc/os-release && test "$ec" = "108"; then
printf '%s\n' "Expected error as --oracle-repo is not specified"
apt-get remove -y 'virtualbox*'
sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only
else
exit $?
fi
}
- name: Run VirtualBox Installer - back to default repository - Clearnet
run: sudo -u user -- usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --onion
- name: Run with non-English locale - Clearnet
run: sudo -u user -- env LC_ALL=ru_RU.UTF-8 LANG=ru_RU.UTF-8 LANGUAGE=ru_RU usr/share/usability-misc/dist-installer-cli-standalone --non-interactive --log-level=debug --no-boot --dev --ci --import-only=both --destroy-existing-guest
## When `source`d the script should exit in less than a second because it should not perform actual work.
## If it was running longer that would mean that it can no longer be `source`d without actually running.
- name: Run Bash to test 'source'ing the script
run: sudo -u user -- timeout 5 bash -c "set -x && source usr/share/usability-misc/dist-installer-cli-standalone"
- name: Run Installer ShellCheck
run: shellcheck usr/share/usability-misc/dist-installer-cli-standalone