git: add workflow for auto mirroring git.yzbruh.space/YZBruh/pmt-renovated.

This commit is contained in:
2025-11-24 19:09:25 +03:00
parent ea7bbc254e
commit f30f733c73
2 changed files with 32 additions and 14 deletions

25
.github/workflows/fetch-changes.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Mirror External Repo to GitHub
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Mirror external repo
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
git clone --mirror https://git.yzbruh.space/YZBruh/pmt-renovated.git temp-mirror
cd temp-mirror
git remote add github https://github.com/ShawkTeam/pmt-renovated.git
git push --mirror github

View File

@@ -19,8 +19,7 @@ RELEASE="20250821"
echo() { command echo "[$THIS]: $@"; } echo() { command echo "[$THIS]: $@"; }
checks() checks() {
{
if ! curl "https://github.com" &>/dev/null; then if ! curl "https://github.com" &>/dev/null; then
echo "No internet connection!" echo "No internet connection!"
exit 1 exit 1
@@ -32,8 +31,7 @@ checks()
[ ! -f $PREFIX/bin/wget ] && pkg install -y wget [ ! -f $PREFIX/bin/wget ] && pkg install -y wget
} }
select_variant() select_variant() {
{
LINK=""; ARCH=""; VARIANT="" LINK=""; ARCH=""; VARIANT=""
if getprop ro.product.cpu.abi | grep "arm64-v8a" &>/dev/null; then ARCH="arm64-v8a" if getprop ro.product.cpu.abi | grep "arm64-v8a" &>/dev/null; then ARCH="arm64-v8a"
@@ -44,8 +42,7 @@ select_variant()
LINK="https://github.com/ShawkTeam/pmt-renovated/releases/download/${RELEASE}/pmt-${VARIANT}${ARCH}.zip" LINK="https://github.com/ShawkTeam/pmt-renovated/releases/download/${RELEASE}/pmt-${VARIANT}${ARCH}.zip"
} }
download() download() {
{
echo "Downloading pmt-${VARIANT}${ARCH}.zip (${RELEASE})" echo "Downloading pmt-${VARIANT}${ARCH}.zip (${RELEASE})"
if ! wget -O $PREFIX/tmp/pmt.zip "${LINK}" &>/dev/null; then if ! wget -O $PREFIX/tmp/pmt.zip "${LINK}" &>/dev/null; then
echo "Download failed! LINK=${LINK}" echo "Download failed! LINK=${LINK}"
@@ -60,8 +57,7 @@ download()
fi fi
} }
setup() setup() {
{
[ -f $PREFIX/tmp/pmt_static ] && mv $PREFIX/tmp/pmt_static $PREFIX/tmp/pmt [ -f $PREFIX/tmp/pmt_static ] && mv $PREFIX/tmp/pmt_static $PREFIX/tmp/pmt
set -e set -e
install -t $PREFIX/bin $PREFIX/tmp/pmt install -t $PREFIX/bin $PREFIX/tmp/pmt
@@ -72,21 +68,18 @@ setup()
echo "Installed successfully. Try running 'pmt' command." echo "Installed successfully. Try running 'pmt' command."
} }
uninstall() uninstall() {
{
rm -f $PREFIX/bin/pmt $PREFIX/lib/libhelper* $PREFIX/lib/libpartition_map* &>/dev/null rm -f $PREFIX/bin/pmt $PREFIX/lib/libhelper* $PREFIX/lib/libpartition_map* &>/dev/null
} }
is_installed() is_installed() {
{
if /system/bin/which pmt &>/dev/null; then if /system/bin/which pmt &>/dev/null; then
echo "PMT is already installed." echo "PMT is already installed."
exit 1 exit 1
fi fi
} }
cleanup() cleanup() {
{
rm -f $PREFIX/tmp/pmt* $PREFIX/tmp/lib* $PREFIX/tmp/*.zip &>/dev/null rm -f $PREFIX/tmp/pmt* $PREFIX/tmp/lib* $PREFIX/tmp/*.zip &>/dev/null
} }