Skip to content

Commit 9c4cee4

Browse files
authored
Merge pull request #1875 from Dhanus3133/feat/insiders-build
Add common script to configure public and Insiders builds
2 parents 8dc0308 + be0722f commit 9c4cee4

2 files changed

Lines changed: 64 additions & 35 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
set -e
3+
4+
mkdir -p stage-raspap/package-raspap
5+
6+
PRERUN_COMMANDS=""
7+
INSTALLER_COMMANDS=""
8+
9+
if [ -n "$INSIDERS_USER" ] && [ -n "$INSIDERS_TOKEN" ]; then
10+
echo ">>> Configuring for private Insiders build."
11+
12+
PRERUN_COMMANDS=$(
13+
cat <<-EOF
14+
echo "${INSIDERS_TOKEN}" > "\${ROOTFS_DIR}/etc/insiders_token"
15+
chmod 600 "\${ROOTFS_DIR}/etc/insiders_token"
16+
EOF
17+
)
18+
19+
INSTALLER_COMMANDS=$(
20+
cat <<-EOF
21+
INSIDERS_TOKEN_VALUE=\$(cat /etc/insiders_token)
22+
curl -sL https://install.raspap.com | bash -s -- \\
23+
--yes --insiders --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 --check 0 \\
24+
--name "${INSIDERS_USER}" --token "\$INSIDERS_TOKEN_VALUE"
25+
rm -f /etc/insiders_token
26+
EOF
27+
)
28+
else
29+
echo ">>> Configuring for public build."
30+
31+
INSTALLER_COMMANDS=$(
32+
cat <<-EOF
33+
curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 --check 0
34+
EOF
35+
)
36+
fi
37+
38+
cat >stage-raspap/prerun.sh <<-EOF
39+
#!/bin/bash -e
40+
if [ ! -d "\${ROOTFS_DIR}" ]; then
41+
copy_previous
42+
fi
43+
${PRERUN_COMMANDS}
44+
EOF
45+
46+
cat >stage-raspap/package-raspap/00-run-chroot.sh <<-EOF
47+
#!/bin/bash -e
48+
apt-get update -y && apt-get install -y curl dhcpcd5 iptables procps
49+
50+
${INSTALLER_COMMANDS}
51+
52+
# Set Wi-Fi country to prevent RF kill
53+
raspi-config nonint do_wifi_country "US"
54+
55+
# Fetch RaspAP version and set MOTD
56+
RASPAP_VERSION=\$(curl -sL https://install.raspap.com | bash -s -- --version)
57+
echo "\$RASPAP_VERSION" | tee /etc/motd
58+
EOF
59+
60+
chmod +x stage-raspap/prerun.sh
61+
chmod +x stage-raspap/package-raspap/00-run-chroot.sh
62+
63+
echo "Build configuration complete."

.github/workflows/release.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,7 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Add RaspAP Stage
26-
run: |
27-
mkdir -p stage-raspap/package-raspap &&
28-
{
29-
cat > stage-raspap/package-raspap/00-run-chroot.sh <<-EOF
30-
#!/bin/bash
31-
apt-get update -y && apt-get install -y curl dhcpcd5 iptables procps
32-
curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 --check 0
33-
34-
# Set Wi-Fi country to prevent RF kill
35-
raspi-config nonint do_wifi_country "US"
36-
37-
# Fetch RaspAP version and set MOTD
38-
RASPAP_VERSION=\$(curl -sL https://install.raspap.com | bash -s -- --version)
39-
echo "\$RASPAP_VERSION" | tee /etc/motd
40-
EOF
41-
} &&
42-
chmod +x stage-raspap/package-raspap/00-run-chroot.sh &&
43-
{
44-
cat > stage-raspap/prerun.sh <<-EOF
45-
#!/bin/bash -e
46-
if [ ! -d "\${ROOTFS_DIR}" ]; then
47-
copy_previous
48-
fi
49-
EOF
50-
} &&
51-
chmod +x stage-raspap/package-raspap/00-run-chroot.sh &&
52-
{
53-
cat > stage-raspap/prerun.sh <<-EOF
54-
#!/bin/bash -e
55-
if [ ! -d "\${ROOTFS_DIR}" ]; then
56-
copy_previous
57-
fi
58-
EOF
59-
} &&
60-
chmod +x stage-raspap/prerun.sh
26+
run: sh ./.github/scripts/add-raspap-stage.sh
6127

6228
- name: Build RaspAP Image
6329
id: build

0 commit comments

Comments
 (0)