Skip to content

Commit

Permalink
Merge pull request #46 from sounddrill31/checkconf
Browse files Browse the repository at this point in the history
Check crave.conf.sample for tamper
  • Loading branch information
sounddrill31 authored Aug 2, 2024
2 parents 7103576 + 5963b06 commit 1199507
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
name: Prepare for Building
runs-on: ubuntu-latest
steps:
- name: Check-out to repository
uses: actions/checkout@v4

- name: Check Credentials
run: bash scripts/env-checker.sh

- name: Set Project variables
id: proj-variables
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ jobs:
name: Prepare for Building
runs-on: ubuntu-latest
steps:
- name: Check-out to repository
uses: actions/checkout@v4

- name: Check Credentials
run: bash scripts/env-checker.sh

- name: Set Project variables
id: proj-variables
run: |
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions .github/workflows/twrp-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
name: Prepare for Building
runs-on: ubuntu-latest
steps:
- name: Check-out to repository
uses: actions/checkout@v4

- name: Check Credentials
run: bash scripts/env-checker.sh

- name: Display Run Parameters # Credit to azwhikaru for this part
run: |
echo "::group::User Environment Variables"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/twrp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
name: Prepare for Building
runs-on: ubuntu-latest
steps:
- name: Check-out to repository
uses: actions/checkout@v4

- name: Check Credentials
run: bash scripts/env-checker.sh

- name: Display Run Parameters # Credit to azwhikaru for this part
run: |
echo "::group::User Environment Variables"
Expand Down
35 changes: 35 additions & 0 deletions scripts/env-checker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Check if crave.conf.sample exists
if [ ! -f "crave.conf.sample" ]; then
echo "crave.conf.sample doesn't exist!"
exit 1
fi

# Check if file name is correct
if [ -f "crave.conf" ]; then
echo "Don't change crave.conf.sample! Exiting..."
exit 1
fi

# Check if username has been altered
if ! grep -q "\"username\": \"\${CRAVE_USERNAME}\"" "crave.conf.sample"; then
echo "Don't add your username to crave.conf, use github secrets! Exiting..."
exit 1
fi

# Check if Authorization has been altered
if ! grep -q "\"Authorization\": \"\${CRAVE_TOKEN}\"" "crave.conf.sample"; then
echo "Don't add your token to crave.conf, use github secrets! Exiting..."
exit 1
fi

# Check if server is set to devspace.crave.io
if grep -q "\"server\": \"https://devspace.crave.io/api\"" "crave.conf.sample"; then
echo "Devspace.crave.io is the public instance and does not support building android!"
echo "Get a foss.crave.io account. To know more, read the docs: https://opendroid.pugzarecute.com/wiki/Crave_Devspace#getting-a-fosscraveiohttpsfosscraveio-account"
echo "Exiting..."
exit 1
fi

echo "crave.conf looks okay! Continuing..."

0 comments on commit 1199507

Please sign in to comment.