Skip to content

Commit

Permalink
Merge branch 'testing' into Eeems-patch-15
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems authored Jun 3, 2024
2 parents 70e9c85 + 8041d39 commit 6099772
Show file tree
Hide file tree
Showing 60 changed files with 1,390 additions and 2,824 deletions.
10 changes: 4 additions & 6 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,18 @@ runs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- name: Cache Python environment
uses: actions/cache@v3
id: cache-python
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
path: .venv
key: .venv-${{ hashFiles('requirements.txt') }}
- name: Install Python dependencies
shell: bash
env:
CACHE_HIT: ${{ steps.cache-python.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
make .venv/bin/activate
fi
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
private
build
build/
!scripts/build/
__pycache__
.venv
.venv/
repo/
33 changes: 24 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,30 @@ export USAGE
help:
@echo "$$USAGE"

repo:
.venv/bin/activate: requirements.txt
@echo "Setting up development virtual env in .venv"
python -m venv .venv; \
. .venv/bin/activate; \
python -m pip install -r requirements.txt

repo: .venv/bin/activate
. .venv/bin/activate; \
./scripts/repo_build.py $(FLAGS)

repo-local:
repo-local: .venv/bin/activate
. .venv/bin/activate; \
./scripts/repo_build.py --local $(FLAGS)

repo-new:
repo-new: .venv/bin/activate
. .venv/bin/activate; \
./scripts/repo_build.py --diff $(FLAGS)

repo-check:
repo-check: .venv/bin/activate
. .venv/bin/activate; \
./scripts/repo-check build/repo

$(RECIPES): %:
$(RECIPES): %: .venv/bin/activate
. .venv/bin/activate; \
./scripts/package_build.py $(FLAGS) "$(@)"

push: %:
Expand All @@ -85,24 +96,28 @@ $(RECIPES_PUSH): %:
"Make sure rsync is installed on your reMarkable."; \
fi

format:
format: .venv/bin/activate
@echo "==> Checking Bash formatting"
shfmt -d .
@echo "==> Checking Python formatting"
. .venv/bin/activate; \
black --line-length 80 --check --diff scripts

format-fix:
format-fix: .venv/bin/activate
@echo "==> Fixing Bash formatting"
shfmt -l -w .
@echo "==> Fixing Python formatting"
. .venv/bin/activate; \
black --line-length 80 scripts

lint:
lint: .venv/bin/activate
@echo "==> Linting Bash scripts"
shellcheck $$(shfmt -f .) -P SCRIPTDIR
# shellcheck $$(shfmt -f .) -P SCRIPTDIR
@echo "==> Typechecking Python files"
. .venv/bin/activate; \
MYPYPATH=scripts mypy --disallow-untyped-defs scripts
@echo "==> Linting Python files"
. .venv/bin/activate; \
PYTHONPATH=: pylint scripts

$(RECIPES_CLEAN): %:
Expand Down
10 changes: 5 additions & 5 deletions package/appmarkable/package
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
pkgnames=(appmarkable)
pkgdesc="Front-end for apps that do not have a graphical user interface"
url="https://github.com/LinusCDE/appmarkable"
pkgver=0.0.0-11
timestamp=2021-03-10T18:36Z
pkgver=0.1.3-1
timestamp=2024-06-01T21:00Z
section="devel"
maintainer="Linus K. <[email protected]>"
license=MIT
installdepends=(display)
flags=(patch_rm2fb)

image=rust:v2.1
source=(https://github.com/LinusCDE/appmarkable/archive/c44ee87ea2b1f1e41c9592476c076150c9a1acf4.zip)
sha256sums=(76e151aeae0f18b206dd3c6258bf74bcb5256ee2f803e1ed2073278831158f60)
image=rust:v3.1
source=(https://github.com/LinusCDE/appmarkable/archive/0463ffc5bdaf29ff0a0e92fb15a90b06e310c417.zip)
sha256sums=(bb45ed03a360f1a58e58e5a8e3176008e8e63053fc46925d20be92b532a02822)

build() {
# Fall back to system-wide config
Expand Down
4 changes: 2 additions & 2 deletions package/display/package
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ timestamp=2023-08-27T02:39:10Z
maintainer="raisjn <[email protected]>"
license=MIT
url="https://github.com/ddvk/remarkable2-framebuffer"
pkgver=1:0.0.32-2
pkgver=1:0.0.33-1
_release="${pkgver%-*}"
_release="v${_release#*:}"
_libver=1.0.1
Expand All @@ -23,7 +23,7 @@ source=(
rm2fb-preload.env
)
sha256sums=(
603eef1688a8c3adb1df23f4f00fe12b80938fe99801b515cd74f84c8cede5b1
dd57f1ba31f08a28d801989e9a705bd93cc637cd8f4dffa160412119e69329ff
SKIP
SKIP
SKIP
Expand Down
93 changes: 93 additions & 0 deletions package/draft/launcherctl-draft
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash
set -e
draft_pid() {
systemctl show --no-pager --property MainPID draft.service | sed 's|MainPID=||'
}
kill_pid() {
pid="$1"
if [[ "$(awk '{print $3}' "/proc/${pid}/stat")" == "T" ]]; then
kill -CONT "$pid"
fi
kill -TERM "$pid"
# Wait 5s for process to exit
start="$(date +'%s')"
while kill -0 "$pid" 2> /dev/null; do
sleep 0.5
if [ "$(date +'%s')" -gt $((start + 5)) ]; then
break
fi
done
if kill -0 "$pid" 2> /dev/null; then
# If process is still running, force kill it
kill -KILL "$pid"
fi
}
case "$1" in
is-active)
systemctl is-active --quiet draft.service
;;
is-enabled)
systemctl is-enabled --quiet draft.service
;;
logs)
if [ $# -eq 2 ] && [[ "$2" == "-f" ]] || [[ "$2" == "--follow" ]]; then
journalctl --follow --all --unit draft.service
else
journalctl --no-pager --all --unit draft.service
fi
;;
start)
systemctl start draft.service
;;
stop)
systemctl stop draft.service
;;
enable)
systemctl enable draft.service
;;
disable)
systemctl disable draft.service
;;
apps)
find {/opt,}/etc/draft -maxdepth 1 -type f | while read -r file; do
grep 'name=' "$file" | sed 's|^name=||'
done
;;
close)
find {/opt,}/etc/draft -maxdepth 1 -type f | while read -r file; do
if [[ "$(grep 'name=' "$file" | sed 's|^name=||')" == "$2" ]]; then
term="$(grep 'term=' "$file" | sed 's|^term=||')"
if [ -z "$term" ]; then
echo "No term= configuration specified for ${2}"
exit 1
fi
$term
call="$(grep 'call=' "$file" | sed 's|^call=||')"
name="$(grep 'name=' "$file" | sed 's|^name=||')"
/opt/libexec/ps-procps-ng --ppid "$(draft_pid)" -o pid | tail -n +2 | while read -r pid; do
if [[ "$(tr -d '\0' < "/proc/${pid}/cmdline")" == "$call" ]]; then
kill_pid "$pid"
break
fi
done
fi
done
;;
running)
pid=$(draft_pid)
find {/opt,}/etc/draft -maxdepth 1 -type f | while read -r file; do
call="$(grep 'call=' "$file" | sed 's|^call=||')"
name="$(grep 'name=' "$file" | sed 's|^name=||')"
/opt/libexec/ps-procps-ng --ppid "$(draft_pid)" -o pid | tail -n +2 | while read -r pid; do
if [[ "$(tr -d '\0' < "/proc/${pid}/cmdline")" == "$call" ]]; then
echo "$name"
break
fi
done
done
;;
*)
echo "Draft does not support this method"
exit 1
;;
esac
16 changes: 11 additions & 5 deletions package/draft/package
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@
pkgnames=(draft)
pkgdesc="Launcher which wraps around the standard interface"
url=https://github.com/dixonary/draft-reMarkable
pkgver=0.2.0-22
pkgver=0.2.0-25
timestamp=2020-07-20T10:23Z
section="launchers"
maintainer="Mattéo Delabre <[email protected]>"
license=Apache-2.0
installdepends=(xochitl display)
installdepends=(xochitl display procps-ng-ps)
flags=(patch_rm2fb)

image=qt:v2.1
source=(
https://github.com/dixonary/draft-reMarkable/archive/5bd660a2fd07eba166c6110d2b48cfc58ee67e58.zip
draft.service
launcherctl-draft
)
sha256sums=(
c41d7a4fd537c54d787018fd764421dbf7dd64306ca800875283e05eef99173e
SKIP
SKIP
)

build() {
Expand All @@ -46,21 +48,25 @@ package() {
mv "$pkgdir"/opt/etc/draft/{99-,}shutdown

install -D -m 644 -t "$pkgdir"/lib/systemd/system "$srcdir"/draft.service
install -D -T -m 755 "$srcdir"/launcherctl-draft "$pkgdir"/opt/share/launcherctl/"$pkgname"
}

configure() {
systemctl daemon-reload

if ! is-enabled "$pkgname.service"; then
if ! launcherctl is-current-launcher "$pkgname"; then
echo ""
echo "Run the following command(s) to use $pkgname as your launcher"
how-to-enable "$pkgname.service"
echo "launcherctl switch-launcher --start $pkgname"
echo ""
fi
}

preremove() {
disable-unit "$pkgname.service"
# Just in case more than one launcher is active, do individual checks
if launcherctl is-active-launcher "$pkgname" || launcherctl is-enabled-launcher "$pkgname"; then
launcherctl switch-launcher --start xochitl
fi
}

postremove() {
Expand Down
13 changes: 13 additions & 0 deletions package/entware-rc/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Entware %I service
After=opt.mount

[Service]
ExecStart=/opt/etc/init.d/%I start
ExecStop=/opt/etc/init.d/%I stop
Type=forking
GuessMainPID=true
Restart=on-failure

[Install]
WantedBy=multi-user.target
38 changes: 38 additions & 0 deletions package/entware-rc/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2024 The Toltec Contributors
# SPDX-License-Identifier: MIT

archs=(rmall)
pkgnames=(entware-rc)
pkgdesc="Manage entware installed services"
url=https://toltec-dev.org/
pkgver=0.1-1
timestamp=2024-05-22T22:59:03Z
section="utils"
maintainer="Eeems <[email protected]>"
license=MIT
installdepends=()

source=(
[email protected]
rcctl
)
sha256sums=(
SKIP
SKIP
)

package() {
install -D -m 666 -t "$pkgdir"/lib/systemd/system/ "$srcdir"/[email protected]
install -D -m 755 -t "$pkgdir"/opt/bin/ "$srcdir"/rcctl
}

configure() {
systemctl daemon-reload
echo ""
echo "You can use rcctl to manage services installed by entware"
}

preremove() {
rcctl list | xargs -I {} systemctl disable --now entware-rc@{}
}
Loading

0 comments on commit 6099772

Please sign in to comment.