From 5a751087370c64d0f155621bee427b908e466728 Mon Sep 17 00:00:00 2001 From: vnxme <46669194+vnxme@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:46:01 +0300 Subject: [PATCH] Introduce CUSTOM_LOGO_TEXT env variable --- .github/workflows/mikrotik_patch_6.yml | 1 + .github/workflows/mikrotik_patch_7.yml | 1 + patch.py | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mikrotik_patch_6.yml b/.github/workflows/mikrotik_patch_6.yml index 428f411..70cf384 100644 --- a/.github/workflows/mikrotik_patch_6.yml +++ b/.github/workflows/mikrotik_patch_6.yml @@ -27,6 +27,7 @@ env: CUSTOM_RENEW_URL: ${{ secrets.CUSTOM_RENEW_URL }} MIKRO_CLOUD_URL: ${{ secrets.MIKRO_CLOUD_URL }} CUSTOM_CLOUD_URL: ${{ secrets.CUSTOM_CLOUD_URL }} + CUSTOM_LOGO_TEXT: ${{ secrets.CUSTOM_LOGO_TEXT }} jobs: Set_BuildTime: diff --git a/.github/workflows/mikrotik_patch_7.yml b/.github/workflows/mikrotik_patch_7.yml index 4e89010..ddfe93c 100644 --- a/.github/workflows/mikrotik_patch_7.yml +++ b/.github/workflows/mikrotik_patch_7.yml @@ -26,6 +26,7 @@ env: CUSTOM_RENEW_URL: ${{ secrets.CUSTOM_RENEW_URL }} MIKRO_CLOUD_URL: ${{ secrets.MIKRO_CLOUD_URL }} CUSTOM_CLOUD_URL: ${{ secrets.CUSTOM_CLOUD_URL }} + CUSTOM_LOGO_TEXT: ${{ secrets.CUSTOM_LOGO_TEXT }} jobs: Set_BuildTime: diff --git a/patch.py b/patch.py index 4c984b2..00694d8 100644 --- a/patch.py +++ b/patch.py @@ -303,9 +303,10 @@ def patch_npk_package(package,key_dict): print(f"extract {squashfs_file} ...") run_shell_command(f"unsquashfs -d {extract_dir} {squashfs_file}") patch_squashfs(extract_dir,key_dict) - logo = os.path.join(extract_dir,"nova/lib/console/logo.txt") - run_shell_command(f"sudo sed -i '1d' {logo}") - run_shell_command(f"sudo sed -i '8s#.*# elseif@live.cn https://github.com/elseif/MikroTikPatch#' {logo}") + if ('CUSTOM_LOGO_TEXT' in os.environ) and (len(os.environ['CUSTOM_LOGO_TEXT']) > 0): + logo = os.path.join(extract_dir,"nova/lib/console/logo.txt") + run_shell_command(f"sudo sed -i '1d' {logo}") + run_shell_command(f"sudo sed -i '8s#.*#{os.environ['CUSTOM_LOGO_TEXT']}#' {logo}") print(f"pack {extract_dir} ...") run_shell_command(f"rm -f {squashfs_file}") run_shell_command(f"mksquashfs {extract_dir} {squashfs_file} -quiet -comp xz -no-xattrs -b 256k")