Skip to content

Commit

Permalink
Built Image configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
D3VL-Jack committed Oct 1, 2022
0 parents commit 862d24f
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build and release

on:
push:
branches: [ build ]
tags:
- '*'

workflow_dispatch:

jobs:
release:
name: Release IPK to GitHub Releases
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
steps:
- name: Branch name
id: branch_name
run: |
echo ::set-output name=IS_TAG::${{ startsWith(github.ref, 'refs/tags/') }}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=RELEASE_NAME::${GITHUB_REF#refs/*/}
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}

- name: View content
run: ls -R

- name: Create master push pre-release
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
RELEASE_NAME: ${{ steps.branch_name.outputs.RELEASE_NAME }}
if: "${{ env.IS_TAG == 'false' }}"
id: create_pre_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_NAME }}-${{ github.run_number }}
name: ${{ env.RELEASE_NAME }}-${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
artifacts: ./*/*.ipk

- name: Create tagged release
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.SOURCE_TAG }}
name: ${{ env.SOURCE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
artifacts: ./*/*.ipk

build:
name: Build IPK package
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Get GitHub Build Number (ENV)
id: get_buildno
run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV
continue-on-error: true

- name: Get repository name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | cut -d '/' -f2)" >> $GITHUB_ENV
shell: bash

- name: Make artifact name
id: make_artifactname
run: |
ARTIFACT_NAME="${{ env.REPOSITORY_NAME }}-${{ github.run_number }}"
echo "${ARTIFACT_NAME}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: Build IPK package
run: make

- name: Upload artifact containing all IPKs
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./ipk/*.ipk
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipk
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 D3VL LTD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NAME = $(shell cat ./control/control | grep Package | cut -d" " -f2)
ARCH = $(shell cat ./control/control | grep Architecture | cut -d" " -f2)
VERSION = $(shell cat ./control/control | grep Version | cut -d" " -f2)
IPK_NAME = "${NAME}_${VERSION}_${ARCH}.ipk"

all:

chmod +x ./control/postinst
chmod +x ./control/prerm
chmod +x ./data/opt/bin/image-configurator.sh

mkdir -p ipk
echo "2.0" > ipk/debian-binary
cp -r data ipk/
cp -r control ipk/
cd ipk/control && tar --owner=0 --group=0 -czvf ../control.tar.gz .
cd ipk/data && tar --owner=0 --group=0 -czvf ../data.tar.gz .
cd ipk/ && tar --owner=0 --group=0 -czvf "./${IPK_NAME}" ./control.tar.gz ./data.tar.gz ./debian-binary

clean:
rm -rf ipk
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# wtfos - Image Configurator

Change the wtfos images on your DJI Goggles

## Usage
To change the splashscreen image, put an image named `splashscreen.png` in the root of the SD card.

To change the screensaver images, put images named `screensaver01.png` and `screensaver02.png` in the root of the SD card.

Try to use 16:9 images or be prepared for some stretched results!

Plug the SD card into the Goggles and power them on, it may take upto 30 seconds for the images to change the first time as the goggles need todo some processing on the images.
7 changes: 7 additions & 0 deletions control/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Package: image-configurator
Version: 1.0.0
Maintainer: D3VL LTD <[email protected]>
Description: Change the splash screen and screensaver images with files on your micro sd.
Architecture: pigeon-glasses
Homepage: https://github.com/d3vl/wtfos-image-configurator
Depends: dinit, image-changer, ffmpeg
3 changes: 3 additions & 0 deletions control/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/system/bin/sh

/opt/sbin/dinitctl enable image-configurator || true
3 changes: 3 additions & 0 deletions control/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/system/bin/sh

/opt/sbin/dinitctl disable image-configurator || true
60 changes: 60 additions & 0 deletions data/opt/bin/image-configurator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/system/bin/sh

echo "[image-configurator] start";
SD_CARD=$(ls /mnt/media_rw);
if [[ SD_CARD ]]; then

IMAGE_CHANGER=$(opkg list-installed | grep "image-changer" > /dev/null; echo $?);
echo "[image-configurator] SD card found: $SD_CARD";

if [[ -f "/mnt/media_rw/$SD_CARD/screensaver01.png" ]]; then
echo "[image-configurator] screensaver01.png found on SD card";

ffmpeg -i "/mnt/media_rw/$SD_CARD/screensaver01.png" -vf "scale=1440:810" -pix_fmt bgra "/tmp/screensaver01.rgb" &&
mv /tmp/screensaver01.rgb /data/screensaver01.data

echo "[image-configurator] screensaver01.png converted to screensaver01.data";

if [[ $IMAGE_CHANGER -eq 0 ]]; then
draw_to_screensaver 1 /data/screensaver01.data
fi

rm "/mnt/media_rw/$SD_CARD/screensaver01.png"

fi

if [[ -f "/mnt/media_rw/$SD_CARD/screensaver02.png" ]]; then
echo "[image-configurator] screensaver02.png found on SD card";

ffmpeg -i "/mnt/media_rw/$SD_CARD/screensaver02.png" -vf "scale=1440:810" -pix_fmt bgra "/tmp/screensaver02.rgb" &&
mv /tmp/screensaver02.rgb /data/screensaver01.data

echo "[image-configurator] screensaver02.png converted to screensaver02.data";

if [[ $IMAGE_CHANGER -eq 0 ]]; then
draw_to_screensaver 2 /data/screensaver02.data
fi

rm "/mnt/media_rw/$SD_CARD/screensaver02.png"

fi

if [[ -f "/mnt/media_rw/$SD_CARD/splashscreen.png" ]]; then
echo "[image-configurator] splashscreen.png found on SD card";

ffmpeg -i "/mnt/media_rw/$SD_CARD/splashscreen.png" -vf "scale=1440:810,pad=w=1536:h=810:x=0:y=0:color=black" -pix_fmt nv12 "/tmp/splashscreen.yuv" &&
mv /tmp/splashscreen.yuv /data/splashscreen.yuv;

echo "[image-configurator] splashscreen.png converted to splashscreen.yuv";

if [[ $IMAGE_CHANGER -eq 0 ]]; then
draw_to_splash /data/splashscreen.yuv
fi

rm "/mnt/media_rw/$SD_CARD/splashscreen.png"

fi

echo "[image-configurator] SD scan functions complete";
fi

2 changes: 2 additions & 0 deletions data/opt/etc/dinit.d/image-configurator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type = scripted
command = /opt/bin/image-configurator.sh

0 comments on commit 862d24f

Please sign in to comment.