mirror of
https://github.com/elseif/MikroTikPatch.git
synced 2026-08-26 18:15:56 +00:00
Compare commits
163 Commits
7.20beta6
...
7.20rc2-ar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b92fc3fa6 | ||
|
|
0c92a04b58 | ||
|
|
296db5b558 | ||
|
|
49bbcb1983 | ||
|
|
f750442687 | ||
|
|
06bd69f331 | ||
|
|
e35cf5f74e | ||
|
|
e12e1aa67b | ||
|
|
6a8aaa89d8 | ||
|
|
495927d0de | ||
|
|
c73c6bacc8 | ||
|
|
8e7134e0a6 | ||
|
|
f4cc728789 | ||
|
|
8c3278f477 | ||
|
|
04a831b463 | ||
|
|
c75dd48261 | ||
|
|
6519ab2e12 | ||
|
|
ec1c0f1719 | ||
|
|
3de34ef556 | ||
|
|
8499e4591a | ||
|
|
f520ff799c | ||
|
|
ccb4220a61 | ||
|
|
8159018e3c | ||
|
|
dc30d89afb | ||
|
|
4472649719 | ||
|
|
fc469087be | ||
|
|
477fd66fe0 | ||
|
|
cd32348c52 | ||
|
|
37f92c3def | ||
|
|
2bb452b300 | ||
|
|
710921ef23 | ||
|
|
8bfcdfe5a8 | ||
|
|
2baf264aec | ||
|
|
fd6f36d484 | ||
|
|
2ab01e5328 | ||
|
|
16854dadf9 | ||
|
|
d981a4b137 | ||
|
|
378c9009b8 | ||
|
|
73f9ba0506 | ||
|
|
646f479290 | ||
|
|
e3b46ed7c3 | ||
|
|
1a66685cc4 | ||
|
|
cbd6ffa50c | ||
|
|
73d90b27e0 | ||
|
|
60728d6fe2 | ||
|
|
556cc81474 | ||
|
|
2286063b65 | ||
|
|
907b335d3a | ||
|
|
567819bec4 | ||
|
|
bbc6b854cd | ||
|
|
6f4c9b43fc | ||
|
|
659de9d659 | ||
|
|
78707050a0 | ||
|
|
cdb378b45d | ||
|
|
9b40d04e38 | ||
|
|
110cda779c | ||
|
|
36be15859e | ||
|
|
c40954115b | ||
|
|
2babd89f27 | ||
|
|
7a6e538834 | ||
|
|
a2f9af37ad | ||
|
|
6e630b852a | ||
|
|
4987501168 | ||
|
|
c2ec6d439c | ||
|
|
c5712825ba | ||
|
|
072417bf1b | ||
|
|
f2d18e32f6 | ||
|
|
7758330905 | ||
|
|
0ff47ed53e | ||
|
|
90dfb10d32 | ||
|
|
a217ae8df0 | ||
|
|
fa9c53bef1 | ||
|
|
18b6449701 | ||
|
|
d7517cb9f4 | ||
|
|
3a17176568 | ||
|
|
da3653fcb7 | ||
|
|
48bd5e9601 | ||
|
|
c0f53a242a | ||
|
|
8d18551f5b | ||
|
|
f29d91d1a4 | ||
|
|
89c13ae6fa | ||
|
|
e028fdd880 | ||
|
|
88ff1f7130 | ||
|
|
92f26c270e | ||
|
|
c1163894f3 | ||
|
|
5196f20043 | ||
|
|
bba676a2d6 | ||
|
|
259051906c | ||
|
|
2162e76e64 | ||
|
|
7c22877423 | ||
|
|
6a486adfc6 | ||
|
|
49608606f2 | ||
|
|
85a2526bcd | ||
|
|
b5049c0ebb | ||
|
|
15273578e8 | ||
|
|
a85cbf1548 | ||
|
|
7195dae015 | ||
|
|
5ef845c148 | ||
|
|
00a510fc1e | ||
|
|
3d491261f3 | ||
|
|
4ba3cc3f11 | ||
|
|
b5904ff5ae | ||
|
|
5a8e9d19b3 | ||
|
|
3c5ed64380 | ||
|
|
808b637ebd | ||
|
|
ced9e23040 | ||
|
|
4623e18824 | ||
|
|
87e7644916 | ||
|
|
40676b67af | ||
|
|
e674ef263a | ||
|
|
9cd8640e0a | ||
|
|
fcf7fddd2e | ||
|
|
bdb3de0777 | ||
|
|
923225902b | ||
|
|
3b4391d582 | ||
|
|
6c6899386b | ||
|
|
5220cb9d8e | ||
|
|
cfe551fdda | ||
|
|
241c81356b | ||
|
|
9cc2f9063d | ||
|
|
399c670504 | ||
|
|
ee6d299e9f | ||
|
|
0234cf6f75 | ||
|
|
9df0184656 | ||
|
|
5623d2215c | ||
|
|
7239cd4cdf | ||
|
|
b60cab8b45 | ||
|
|
e8b9bef9aa | ||
|
|
dc959f9b16 | ||
|
|
2ea2d3fbdf | ||
|
|
3d3f3fee33 | ||
|
|
8d411a43c6 | ||
|
|
d483639d46 | ||
|
|
4d09aa8aab | ||
|
|
8f59b90921 | ||
|
|
5d08e5308d | ||
|
|
18e256ff41 | ||
|
|
855fbc85d1 | ||
|
|
9715f13b6a | ||
|
|
b2893b91b7 | ||
|
|
988ded50c3 | ||
|
|
950505e0ab | ||
|
|
96c0fd251e | ||
|
|
d4dcf6dfeb | ||
|
|
65b7c57616 | ||
|
|
edb40667ef | ||
|
|
f98f599cb7 | ||
|
|
f28acb89ae | ||
|
|
259fb4bf2a | ||
|
|
8f15749897 | ||
|
|
9712d7d464 | ||
|
|
7bebf605a0 | ||
|
|
f018e0de99 | ||
|
|
7ef69a1e31 | ||
|
|
1ba7057fc7 | ||
|
|
8a52ef8df4 | ||
|
|
7292ad7a80 | ||
|
|
88de7162b7 | ||
|
|
f3497a9a4b | ||
|
|
702efdb828 | ||
|
|
a2038ece24 | ||
|
|
0b3fd16ba7 | ||
|
|
8367df6ef0 |
242
.github/workflows/mikrotik_patch_6.yml
vendored
242
.github/workflows/mikrotik_patch_6.yml
vendored
@@ -16,15 +16,20 @@ on:
|
||||
- stable
|
||||
- long-term
|
||||
version:
|
||||
description: "Version ('', 6.49.17, 6.49.18,...)"
|
||||
description: "Specify version (e.g., 6.49.19), empty for latest"
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
buildtime:
|
||||
description: "Build Time"
|
||||
description: "Custom build time, leave empty for now,when set specify version"
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
release:
|
||||
description: "Release to GitHub & Upload "
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -47,30 +52,50 @@ env:
|
||||
CUSTOM_CLOUD_URL: ${{ secrets.CUSTOM_CLOUD_URL }}
|
||||
|
||||
jobs:
|
||||
Set_BuildTime:
|
||||
Set_Variables:
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
BUILD_TIME: ${{ steps.set_buildtime.outputs.BUILD_TIME }}
|
||||
BUILD_TIME: ${{ steps.set_vars.outputs.BUILD_TIME }}
|
||||
RELEASE: ${{ steps.set_vars.outputs.RELEASE }}
|
||||
MATRIX_JSON: ${{ steps.set_vars.outputs.MATRIX_JSON }}
|
||||
steps:
|
||||
- name: Set build time
|
||||
id: set_buildtime
|
||||
- name: Set variables
|
||||
id: set_vars
|
||||
run: |
|
||||
_BUILD_TIME=${{ github.event.inputs.buildtime }}
|
||||
if [ -z "$_BUILD_TIME" ]; then
|
||||
echo "BUILD_TIME=$(date +'%s')" >> $GITHUB_OUTPUT
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
BUILD_TIME="${{ github.event.inputs.buildtime }}"
|
||||
RELEASE="${{ github.event.inputs.release }}"
|
||||
if [ -z "$BUILD_TIME" ]; then
|
||||
BUILD_TIME=$(date +'%s')
|
||||
fi
|
||||
if [ -z "$RELEASE" ]; then
|
||||
RELEASE=false
|
||||
fi
|
||||
ARCH="${{ github.event.inputs.arch }}"
|
||||
CHANNEL="${{ github.event.inputs.channel }}"
|
||||
MATRIX_JSON=$(jq -nc --arg arch "$ARCH" --arg channel "$CHANNEL" '[{arch: $arch, channel: $channel}]')
|
||||
else
|
||||
echo "BUILD_TIME=$_BUILD_TIME" >> $GITHUB_OUTPUT
|
||||
BUILD_TIME=$(date +'%s')
|
||||
RELEASE=true
|
||||
MATRIX_JSON='[{"arch":"x86","channel":"stable"},{"arch":"x86","channel":"long-term"}]'
|
||||
fi
|
||||
echo "BUILD_TIME=$BUILD_TIME" >> $GITHUB_OUTPUT
|
||||
echo "RELEASE=$RELEASE" >> $GITHUB_OUTPUT
|
||||
echo "MATRIX_JSON=$MATRIX_JSON" >> $GITHUB_OUTPUT
|
||||
echo "BUILD_TIME: $BUILD_TIME"
|
||||
echo "RELEASE: $RELEASE"
|
||||
echo "MATRIX_JSON: $MATRIX_JSON"
|
||||
|
||||
Patch_RouterOS:
|
||||
needs: Set_BuildTime
|
||||
needs: Set_Variables
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
channel: ${{ fromJSON(format('["{0}"]', github.event.inputs.channel || 'stable')) }}
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.Set_Variables.outputs.MATRIX_JSON) }}
|
||||
env:
|
||||
TZ: 'Asia/Shanghai'
|
||||
LATEST_VERSION: ""
|
||||
BUILD_TIME: ${{ needs.Set_Variables.outputs.BUILD_TIME }}
|
||||
RELEASE: ${{ needs.Set_Variables.outputs.RELEASE }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -84,13 +109,19 @@ jobs:
|
||||
id: get_latest
|
||||
run: |
|
||||
echo $(uname -a)
|
||||
LATEST_VERSION=${{ github.event.inputs.version }}
|
||||
if [ -z "$_LATEST_VERSION" ]; then
|
||||
LATEST_VERSION=$(wget -nv -O - https://${{ env.MIKRO_UPGRADE_URL }}/routeros/NEWEST6.${{ matrix.channel }} | cut -d ' ' -f1)
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||
LATEST_VERSION="${{ github.event.inputs.version }}"
|
||||
else
|
||||
read LATEST_VERSION BUILD_TIME <<< "$(wget -nv -O - "https://${{ env.MIKRO_UPGRADE_URL }}/routeros/NEWEST6.${{ matrix.channel }}")"
|
||||
fi
|
||||
else
|
||||
read LATEST_VERSION BUILD_TIME <<< "$(wget -nv -O - "https://${{ env.MIKRO_UPGRADE_URL }}/routeros/NEWEST6.${{ matrix.channel }}")"
|
||||
fi
|
||||
echo Build Time:$BUILD_TIME
|
||||
echo Latest Version:$LATEST_VERSION
|
||||
if [ "${{ github.event_name }}" == "schedule" ]; then
|
||||
_LATEST_VERSION=$(wget -nv -O - https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/NEWEST6.${{ matrix.channel }} | cut -d ' ' -f1)
|
||||
_LATEST_VERSION=$(wget -nv -O - https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/NEWEST6.${{ matrix.channel }} | cut -d ' ' -f1)
|
||||
if [ "$_LATEST_VERSION" == "$LATEST_VERSION" ]; then
|
||||
echo "No new version found"
|
||||
echo "has_new_version=false" >> $GITHUB_OUTPUT
|
||||
@@ -98,46 +129,29 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
echo "has_new_version=true" >> $GITHUB_OUTPUT
|
||||
BUILD_TIME=${{ needs.Set_BuildTime.outputs.BUILD_TIME }}
|
||||
echo Build Time:$BUILD_TIME
|
||||
wget -nv -O CHANGELOG https://${{ env.MIKRO_UPGRADE_URL }}/routeros/$LATEST_VERSION/CHANGELOG
|
||||
cat CHANGELOG
|
||||
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=${BUILD_TIME}" >> $GITHUB_ENV
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
has_patched_npk=false
|
||||
if wget -nv --spider https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/$LATEST_VERSION/routeros-x86-$LATEST_VERSION.npk; then
|
||||
echo "RouterOS NPK file exists, attempting to download..."
|
||||
if wget -nv -O routeros-x86-$LATEST_VERSION.npk https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/$LATEST_VERSION/routeros-x86-$LATEST_VERSION.npk; then
|
||||
echo "RouterOS NPK file downloaded successfully."
|
||||
if wget -nv --spider https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/$LATEST_VERSION/system-$LATEST_VERSION.npk; then
|
||||
echo "System NPK file exists, attempting to download..."
|
||||
if wget -nv -O system-$LATEST_VERSION.npk https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/$LATEST_VERSION/system-$LATEST_VERSION.npk; then
|
||||
has_patched_npk=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "has_patched_npk=$has_patched_npk" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Squashfs
|
||||
- name: Get loader patch files
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
run: |
|
||||
wget -nv -O loader.7z https://${{ env.CUSTOM_UPGRADE_URL }}/routeros/loader.7z
|
||||
sudo apt-get install -y p7zip-full > /dev/null
|
||||
7z x -p"${{ secrets.LOADER_7Z_PASSWORD }}" loader.7z >> /dev/null
|
||||
rm loader.7z
|
||||
|
||||
|
||||
- name: Create Squashfs for option and python3
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
id: cache-squashfs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
option.sfs
|
||||
key: busybox-squashfs
|
||||
|
||||
- name: Create Squashfs for option
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-squashfs.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
sudo mkdir -p ./option-root/bin/
|
||||
sudo cp busybox/busybox_x86 ./option-root/bin/busybox
|
||||
sudo chmod +x ./option-root/bin/busybox
|
||||
sudo cp keygen/keygen_x86 ./option-root/bin/keygen
|
||||
sudo chmod +x ./option-root/bin/keygen
|
||||
|
||||
sudo chmod +x ./busybox/busybox_x86
|
||||
COMMANDS=$(./busybox/busybox_x86 --list)
|
||||
for cmd in $COMMANDS; do
|
||||
@@ -145,7 +159,14 @@ jobs:
|
||||
done
|
||||
sudo mksquashfs option-root option.sfs -quiet -comp xz -no-xattrs -b 256k
|
||||
sudo rm -rf option-root
|
||||
|
||||
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20250708/cpython-3.11.13+20250708-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
|
||||
sudo tar -xf cpython.tar.gz
|
||||
sudo rm cpython.tar.gz
|
||||
sudo rm -rf ./python/include
|
||||
sudo rm -rf ./python/share
|
||||
sudo mksquashfs python python3.sfs -quiet -comp xz -no-xattrs -b 256k
|
||||
sudo rm -rf ./python
|
||||
|
||||
- name: Cache mikrotik-${{ env.LATEST_VERSION }}.iso
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
id: cache-mikrotik
|
||||
@@ -160,7 +181,7 @@ jobs:
|
||||
run: |
|
||||
sudo wget -nv -O mikrotik.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION.iso
|
||||
|
||||
|
||||
|
||||
- name: Patch mikrotik-${{ env.LATEST_VERSION }}.iso
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
run: |
|
||||
@@ -172,20 +193,27 @@ jobs:
|
||||
sudo rsync -a ./iso/ ./new_iso/
|
||||
sudo umount ./iso
|
||||
sudo rm -rf ./iso
|
||||
if [ "${{ steps.get_latest.outputs.has_patched_npk }}" == "false" ]; then
|
||||
sudo mv ./new_iso/system-$LATEST_VERSION.npk ./
|
||||
sudo -E python3 patch.py npk system-$LATEST_VERSION.npk
|
||||
else
|
||||
sudo -E python3 npk.py sign system-$LATEST_VERSION.npk system-$LATEST_VERSION.npk
|
||||
sudo mv ./new_iso/system-$LATEST_VERSION.npk ./
|
||||
sudo -E python3 patch.py npk system-$LATEST_VERSION.npk
|
||||
NPK_FILES=$(find ./new_iso -type f -name "*.npk")
|
||||
if [ -z "$NPK_FILES" ]; then
|
||||
echo "No .npk files found in iso, downloading..."
|
||||
URL="https://download.mikrotik.com/routeros/$LATEST_VERSION/all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip"
|
||||
TMP_ZIP="./all_packages.zip"
|
||||
sudo wget -nv -O "$TMP_ZIP" "$URL"
|
||||
sudo unzip -o "$TMP_ZIP" -d ./new_iso
|
||||
sudo rm -f "$TMP_ZIP"
|
||||
NPK_FILES=$(find ./new_iso -type f -name "*.npk")
|
||||
fi
|
||||
if [ -n "$NPK_FILES" ]; then
|
||||
for file in $NPK_FILES; do
|
||||
sudo -E python3 npk.py sign "$file" "$file"
|
||||
done
|
||||
fi
|
||||
sudo cp -f system-$LATEST_VERSION.npk ./new_iso/
|
||||
sudo -E python3 patch.py kernel ./new_iso/isolinux/initrd.rgz
|
||||
NPK_FILES=$(find ./new_iso/*.npk)
|
||||
for file in $NPK_FILES; do
|
||||
sudo -E python3 npk.py sign $file $file
|
||||
done
|
||||
sudo cp system-$LATEST_VERSION.npk ./new_iso/
|
||||
#sudo -E python3 npk.py create ./new_iso/gps-$LATEST_VERSION.npk ./option-$LATEST_VERSION.npk option ./option.sfs -desc="busybox"
|
||||
#sudo cp option-$LATEST_VERSION.npk ./new_iso/
|
||||
# sudo -E python3 npk.py create ./new_iso/gps-$LATEST_VERSION.npk ./option-$LATEST_VERSION.npk option ./option.sfs -desc="busybox"
|
||||
# sudo cp option-$LATEST_VERSION.npk ./new_iso/
|
||||
sudo mkisofs -o mikrotik-$LATEST_VERSION.iso \
|
||||
-V "MikroTik $LATEST_VERSION" \
|
||||
-sysid "" -preparer "MiKroTiK" \
|
||||
@@ -204,7 +232,7 @@ jobs:
|
||||
sudo rm -rf ./new_iso
|
||||
|
||||
- name: Create install-image-${{ env.LATEST_VERSION }}.img
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.get_latest.outputs.has_patched_npk == 'true'
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
run: |
|
||||
sudo modprobe nbd
|
||||
sudo apt-get update
|
||||
@@ -261,16 +289,10 @@ jobs:
|
||||
sudo -E python3 patch.py block /dev/nbd0p1 boot/initrd.rgz
|
||||
sudo mount /dev/nbd0p1 ./chr
|
||||
sudo cp ./all_packages/dude-$LATEST_VERSION.npk ./chr/var/pdb/dude/image
|
||||
if [ "${{ steps.get_latest.outputs.has_patched_npk }}" == "false" ]; then
|
||||
sudo -E python3 patch.py npk ./chr/var/pdb/routeros-x86/image
|
||||
sudo cp ./chr/var/pdb/routeros-x86/image ./all_packages/routeros-x86-$LATEST_VERSION.npk
|
||||
else
|
||||
sudo -E python3 npk.py sign routeros-x86-$LATEST_VERSION.npk routeros-x86-$LATEST_VERSION.npk
|
||||
sudo cp -f routeros-x86-$LATEST_VERSION.npk ./chr/var/pdb/routeros-x86/image
|
||||
sudo cp routeros-x86-$LATEST_VERSION.npk ./all_packages/routeros-x86-$LATEST_VERSION.npk
|
||||
fi
|
||||
#sudo mkdir -p ./chr/var/pdb/option
|
||||
#sudo cp ./all_packages/option-$LATEST_VERSION.npk ./chr/var/pdb/option/image
|
||||
sudo -E python3 patch.py npk ./chr/var/pdb/routeros-x86/image
|
||||
sudo cp ./chr/var/pdb/routeros-x86/image ./all_packages/routeros-x86-$LATEST_VERSION.npk
|
||||
# sudo mkdir -p ./chr/var/pdb/option
|
||||
# sudo cp ./all_packages/option-$LATEST_VERSION.npk ./chr/var/pdb/option/image
|
||||
sudo umount ./chr
|
||||
sudo qemu-nbd -d /dev/nbd0
|
||||
sudo rm -rf ./chr
|
||||
@@ -297,29 +319,59 @@ jobs:
|
||||
cd ./all_packages
|
||||
sudo zip ../all_packages-x86-$LATEST_VERSION.zip *.npk
|
||||
cd ..
|
||||
|
||||
- name: Upload Files
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
|
||||
- name: Prepare for Upload
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
sudo mkdir -p ./publish/$LATEST_VERSION
|
||||
sudo cp CHANGELOG ./publish/$LATEST_VERSION/
|
||||
sudo cp ./all_packages/*.npk ./publish/$LATEST_VERSION/
|
||||
# sudo cp mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}.iso ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp chr-${{ env.LATEST_VERSION }}*.zip ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp netinstall-${{ env.LATEST_VERSION }}.* ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp install-image-${{ env.LATEST_VERSION }}.zip ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
echo $LATEST_VERSION $BUILD_TIME | sudo tee ./publish/NEWEST6.${{ matrix.channel }}
|
||||
|
||||
- name: Upload Files
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
if [ "${{ steps.get_latest.outputs.has_patched_npk }}" == "false" ]; then
|
||||
OUTDIR="$LATEST_VERSION-UNDONE"
|
||||
else
|
||||
OUTDIR="$LATEST_VERSION"
|
||||
fi
|
||||
sudo mkdir -p ./publish/$OUTDIR
|
||||
sudo cp CHANGELOG ./publish/$OUTDIR/
|
||||
sudo cp ./all_packages/*.npk ./publish/$OUTDIR/
|
||||
sudo chown -R root:root ./publish/
|
||||
|
||||
LOCAL_PATH=./publish/$LATEST_VERSION
|
||||
REMOTE_PATH=${{ secrets.SSH_DIRECTORY }}
|
||||
SERVER=${{ secrets.SSH_SERVER }}
|
||||
USER=${{ secrets.SSH_USERNAME }}
|
||||
PASS=${{ secrets.SSH_PASSWORD }}
|
||||
PORT=${{ secrets.SSH_PORT }}
|
||||
CHANNEL=${{ matrix.channel }}
|
||||
|
||||
sudo apt-get install -y lftp ssh sshpass > /dev/null 2>&1
|
||||
sudo -E lftp -u ${{ secrets.SSH_USERNAME }},'${{ secrets.SSH_PASSWORD }}' sftp://${{ secrets.SSH_SERVER }}:${{ secrets.SSH_PORT }} <<EOF
|
||||
|
||||
sudo -E lftp -u "$USER","$PASS" sftp://$SERVER:$PORT <<EOF
|
||||
set sftp:auto-confirm yes
|
||||
mirror --reverse --verbose --only-newer ./publish ${{ secrets.SSH_DIRECTORY }}
|
||||
mirror --reverse --verbose --only-newer ./publish "$REMOTE_PATH"
|
||||
bye
|
||||
EOF
|
||||
sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_SERVER }} "echo $LATEST_VERSION $BUILD_TIME | tee /rw/disk/${{ secrets.SSH_DIRECTORY }}/NEWEST6.${{ matrix.channel }}; chown -R 32768:32768 /rw/disk/${{ secrets.SSH_DIRECTORY }}/"
|
||||
sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no -p $PORT $USER@$SERVER \
|
||||
"echo $LATEST_VERSION $BUILD_TIME | tee /rw/disk/$REMOTE_PATH/NEWEST6.$CHANNEL; chown -R 32768:32768 /rw/disk/$REMOTE_PATH/"
|
||||
|
||||
|
||||
# - name: Upload to R2 Bucket
|
||||
# if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
# uses: ryand56/r2-upload-action@latest
|
||||
# with:
|
||||
# r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
# r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
# r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
# r2-bucket: routeros
|
||||
# source-dir: ./publish
|
||||
# destination-dir: ./routeros
|
||||
# keep-file-fresh: true
|
||||
# output-file-url: false
|
||||
|
||||
|
||||
- name: Clear Cloudflare cache
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
curl --request POST --url "https://api.cloudflare.com/client/v4/zones/fe6831ed6dc9e6235e69ef2a31f2e7fe/purge_cache" \
|
||||
--header "Authorization: Bearer 9GDQkzU51QXaqzp1qMjyFKpyeJyOdnNoG9GZQaGP" \
|
||||
@@ -327,8 +379,9 @@ jobs:
|
||||
--data '{"purge_everything": true}'
|
||||
|
||||
- name: Delete Release tag ${{ env.LATEST_VERSION }}
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.get_latest.outputs.has_patched_npk == 'true'
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
sed -i "1i Build Time:$BUILD_TIME" CHANGELOG
|
||||
HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
||||
RELEASE_INFO=$(curl -s -H $HEADER https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION)
|
||||
RELEASE_ID=$(echo $RELEASE_INFO | jq -r '.id')
|
||||
@@ -342,8 +395,9 @@ jobs:
|
||||
echo "Release not found for tag: $LATEST_VERSION)"
|
||||
fi
|
||||
|
||||
- name: Create Release tag ${{ env.LATEST_VERSION }}
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.get_latest.outputs.has_patched_npk == 'true'
|
||||
|
||||
- name: Create Release tag ${{ env.LATEST_VERSION }}
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: "RouterOS ${{ env.LATEST_VERSION }}"
|
||||
@@ -357,3 +411,13 @@ jobs:
|
||||
install-image-${{ env.LATEST_VERSION }}.zip
|
||||
routeros-x86-${{ env.LATEST_VERSION }}.npk
|
||||
all_packages-x86-${{ env.LATEST_VERSION }}.zip
|
||||
|
||||
- name: Upload Files as Artifact (No Release)
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'false'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mikrotik-${{ env.LATEST_VERSION }}
|
||||
path: |
|
||||
all_packages-x86-${{ env.LATEST_VERSION }}.zip
|
||||
mikrotik-${{ env.LATEST_VERSION }}.iso
|
||||
chr-${{ env.LATEST_VERSION }}*.zip
|
||||
|
||||
217
.github/workflows/mikrotik_patch_7.yml
vendored
217
.github/workflows/mikrotik_patch_7.yml
vendored
@@ -159,18 +159,8 @@ jobs:
|
||||
7z x -p"${{ secrets.LOADER_7Z_PASSWORD }}" loader.7z >> /dev/null
|
||||
rm loader.7z
|
||||
|
||||
- name: Cache Squashfs
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
id: cache-squashfs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
python3.sfs
|
||||
option.sfs
|
||||
key: busybox-python3-squashfs-${{ matrix.arch }}
|
||||
|
||||
- name: Create Squashfs for option and python3
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-squashfs.outputs.cache-hit != 'true'
|
||||
if: steps.get_latest.outputs.has_new_version == 'true'
|
||||
run: |
|
||||
sudo mkdir -p ./option-root/bin/
|
||||
if [ "${{ matrix.arch }}" == "x86" ]; then
|
||||
@@ -221,6 +211,7 @@ jobs:
|
||||
path: |
|
||||
mikrotik.iso
|
||||
key: mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}
|
||||
restore-keys: mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}
|
||||
|
||||
- name: Get mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}.iso
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-mikrotik.outputs.cache-hit != 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
|
||||
@@ -240,10 +231,21 @@ jobs:
|
||||
sudo rm -rf ./iso
|
||||
sudo mv ./new_iso/routeros-$LATEST_VERSION$ARCH.npk ./
|
||||
sudo -E python3 patch.py npk routeros-$LATEST_VERSION$ARCH.npk
|
||||
NPK_FILES=$(find ./new_iso/*.npk)
|
||||
for file in $NPK_FILES; do
|
||||
sudo -E python3 npk.py sign $file $file
|
||||
done
|
||||
NPK_FILES=$(find ./new_iso -type f -name "*.npk")
|
||||
if [ -z "$NPK_FILES" ]; then
|
||||
echo "No .npk files found in iso, downloading..."
|
||||
URL="https://download.mikrotik.com/routeros/$LATEST_VERSION/all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip"
|
||||
TMP_ZIP="./all_packages.zip"
|
||||
sudo wget -nv -O "$TMP_ZIP" "$URL"
|
||||
sudo unzip -o "$TMP_ZIP" -d ./new_iso
|
||||
sudo rm -f "$TMP_ZIP"
|
||||
NPK_FILES=$(find ./new_iso -type f -name "*.npk")
|
||||
fi
|
||||
if [ -n "$NPK_FILES" ]; then
|
||||
for file in $NPK_FILES; do
|
||||
sudo -E python3 npk.py sign "$file" "$file"
|
||||
done
|
||||
fi
|
||||
sudo cp -f routeros-$LATEST_VERSION$ARCH.npk ./new_iso/
|
||||
sudo -E python3 npk.py create ./new_iso/gps-$LATEST_VERSION$ARCH.npk ./option-$LATEST_VERSION$ARCH.npk option ./option.sfs -desc="busybox"
|
||||
sudo cp option-$LATEST_VERSION$ARCH.npk ./new_iso/
|
||||
@@ -300,6 +302,7 @@ jobs:
|
||||
path: |
|
||||
chr.img
|
||||
key: chr-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img
|
||||
restore-keys: chr-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img
|
||||
|
||||
- name: Get chr-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-chr-img.outputs.cache-hit != 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
|
||||
@@ -312,6 +315,99 @@ jobs:
|
||||
- name: Create chr-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
|
||||
run: |
|
||||
OVF_TEMPLATE='<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Envelope vmw:buildId="build-18663434" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<References>
|
||||
<File ovf:href="{VMDK_FILE}" ovf:id="file1" ovf:size="{FILE_SIZE}"/>
|
||||
</References>
|
||||
<DiskSection>
|
||||
<Info>Virtual disk information</Info>
|
||||
<Disk ovf:capacity="{CAPACITY_MB}" ovf:capacityAllocationUnits="byte * 2^20" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="{POPULATED_SIZE}"/>
|
||||
</DiskSection>
|
||||
<NetworkSection>
|
||||
<Info>The list of logical networks</Info>
|
||||
<Network ovf:name="VM Network">
|
||||
<Description>The VM Network network</Description>
|
||||
</Network>
|
||||
</NetworkSection>
|
||||
<VirtualSystem ovf:id="vm">
|
||||
<Info>A virtual machine</Info>
|
||||
<Name>MikroTik_RouterOS_CHR</Name>
|
||||
<OperatingSystemSection ovf:id="100" vmw:osType="other3xLinux64Guest">
|
||||
<Info>The kind of installed guest operating system</Info>
|
||||
</OperatingSystemSection>
|
||||
<VirtualHardwareSection>
|
||||
<Info>Virtual hardware requirements</Info>
|
||||
<System>
|
||||
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
|
||||
<vssd:InstanceID>0</vssd:InstanceID>
|
||||
<vssd:VirtualSystemIdentifier>MikroTik_RouterOS_CHR</vssd:VirtualSystemIdentifier>
|
||||
<vssd:VirtualSystemType>vmx-10</vssd:VirtualSystemType>
|
||||
</System>
|
||||
<Item>
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>1024MB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>IDE Controller</rasd:Description>
|
||||
<rasd:ElementName>ideController0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:ResourceType>5</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:ElementName>disk0</rasd:ElementName>
|
||||
<rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
|
||||
<rasd:InstanceID>4</rasd:InstanceID>
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AddressOnParent>1</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
|
||||
<rasd:Connection>VM Network</rasd:Connection>
|
||||
<rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description>
|
||||
<rasd:ElementName>ethernet0</rasd:ElementName>
|
||||
<rasd:InstanceID>5</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
<vmw:Config ovf:required="false" vmw:key="slotInfo.pciSlotNumber" vmw:value="160"/>
|
||||
<vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>video</rasd:ElementName>
|
||||
<rasd:InstanceID>6</rasd:InstanceID>
|
||||
<rasd:ResourceType>24</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>vmci</rasd:ElementName>
|
||||
<rasd:InstanceID>7</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>1</rasd:ResourceType>
|
||||
</Item>
|
||||
<vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="{FIRMWARE_TYPE}"/>
|
||||
</VirtualHardwareSection>
|
||||
<AnnotationSection ovf:required="false">
|
||||
<Info>A human-readable annotation</Info>
|
||||
<Annotation>MikroTik RouterOS CHR v7.19.4</Annotation>
|
||||
</AnnotationSection>
|
||||
</VirtualSystem>
|
||||
</Envelope>'
|
||||
sudo modprobe nbd
|
||||
sudo apt-get install -y qemu-utils > /dev/null
|
||||
truncate --size 128M chr-$LATEST_VERSION$ARCH.img
|
||||
@@ -345,9 +441,10 @@ jobs:
|
||||
sudo shred -v -n 1 -z /dev/nbd1p2
|
||||
sudo mkfs.ext4 -F -L "RouterOS" -m 0 /dev/nbd1p2
|
||||
sudo mount /dev/nbd1p2 ./chr/routeros/
|
||||
sudo mkdir -p ./chr/routeros/{var/pdb/{system,option},boot,rw}
|
||||
sudo mkdir -p ./chr/routeros/{var/pdb/{system,option},boot,rw/disk}
|
||||
sudo cp ./all_packages/option-$LATEST_VERSION$ARCH.npk ./chr/routeros/var/pdb/option/image
|
||||
sudo cp ./all_packages/routeros-$LATEST_VERSION$ARCH.npk ./chr/routeros/var/pdb/system/image
|
||||
echo -e '#!/bin/sh\n# This script will be executed *before* RouterOS *loader* start.\n# You can put your own initialization stuff in here\n' | sudo tee ./chr/routeros/rw/disk/rc.local
|
||||
sudo umount /dev/nbd1p2
|
||||
sudo qemu-nbd -d /dev/nbd1
|
||||
sudo rm -rf ./chr
|
||||
@@ -357,7 +454,27 @@ jobs:
|
||||
sudo qemu-img convert -f raw -O vpc chr-$LATEST_VERSION$ARCH-legacy-bios.img chr-$LATEST_VERSION$ARCH-legacy-bios.vhd
|
||||
sudo qemu-img convert -f raw -O vhdx chr-$LATEST_VERSION$ARCH-legacy-bios.img chr-$LATEST_VERSION$ARCH-legacy-bios.vhdx
|
||||
sudo qemu-img convert -f raw -O vdi chr-$LATEST_VERSION$ARCH-legacy-bios.img chr-$LATEST_VERSION$ARCH-legacy-bios.vdi
|
||||
|
||||
|
||||
sudo qemu-img convert -f raw -O vmdk -o subformat=streamOptimized chr-$LATEST_VERSION$ARCH-legacy-bios.img chr-$LATEST_VERSION$ARCH-legacy-bios-disk1.vmdk
|
||||
VMDK=chr-$LATEST_VERSION$ARCH-legacy-bios-disk1.vmdk
|
||||
OVF=chr-$LATEST_VERSION$ARCH-legacy-bios.ovf
|
||||
OVA=chr-$LATEST_VERSION$ARCH-legacy-bios.ova
|
||||
FILE_SIZE=$(stat -c %s "$VMDK")
|
||||
VIRTUAL_SIZE=$(qemu-img info --output=json "$VMDK" | jq '.["virtual-size"]' | head -n 1)
|
||||
CAPACITY_MB=$((VIRTUAL_SIZE / 1024 / 1024))
|
||||
POPULATED_SIZE=$FILE_SIZE
|
||||
FIRMWARE_TYPE="bios"
|
||||
echo "$OVF_TEMPLATE" | sudo sed -e "s|{VMDK_FILE}|$VMDK|g" \
|
||||
-e "s|{FILE_SIZE}|$FILE_SIZE|g" \
|
||||
-e "s|{CAPACITY_MB}|$CAPACITY_MB|g" \
|
||||
-e "s|{POPULATED_SIZE}|$POPULATED_SIZE|g" \
|
||||
-e "s|{FIRMWARE_TYPE}|$FIRMWARE_TYPE|g" |sudo tee $OVF
|
||||
sudo tar -cvf "$OVA" "$OVF" "$VMDK"
|
||||
sudo rm $VMDK
|
||||
sudo rm $OVF
|
||||
sudo zip $OVA.zip $OVA
|
||||
sudo rm $OVA
|
||||
|
||||
sudo zip chr-$LATEST_VERSION$ARCH-legacy-bios.qcow2.zip chr-$LATEST_VERSION$ARCH-legacy-bios.qcow2
|
||||
sudo zip chr-$LATEST_VERSION$ARCH-legacy-bios.vmdk.zip chr-$LATEST_VERSION$ARCH-legacy-bios.vmdk
|
||||
sudo zip chr-$LATEST_VERSION$ARCH-legacy-bios.vhd.zip chr-$LATEST_VERSION$ARCH-legacy-bios.vhd
|
||||
@@ -393,11 +510,31 @@ jobs:
|
||||
sudo qemu-nbd -d /dev/nbd0
|
||||
|
||||
sudo qemu-img convert -f raw -O qcow2 chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.qcow2
|
||||
sudo qemu-img convert -f raw -O vmdk chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.vmdk
|
||||
sudo qemu-img convert -f raw -O vmdk chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.vmdk
|
||||
sudo qemu-img convert -f raw -O vpc chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.vhd
|
||||
sudo qemu-img convert -f raw -O vhdx chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.vhdx
|
||||
sudo qemu-img convert -f raw -O vdi chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH.vdi
|
||||
|
||||
sudo qemu-img convert -f raw -O vmdk -o subformat=streamOptimized chr-$LATEST_VERSION$ARCH.img chr-$LATEST_VERSION$ARCH-disk1.vmdk
|
||||
VMDK=chr-$LATEST_VERSION$ARCH-disk1.vmdk
|
||||
OVF=chr-$LATEST_VERSION$ARCH.ovf
|
||||
OVA=chr-$LATEST_VERSION$ARCH.ova
|
||||
FILE_SIZE=$(stat -c %s "$VMDK")
|
||||
VIRTUAL_SIZE=$(qemu-img info --output=json "$VMDK" | jq '.["virtual-size"]' | head -n 1)
|
||||
CAPACITY_MB=$((VIRTUAL_SIZE / 1024 / 1024))
|
||||
POPULATED_SIZE=$FILE_SIZE
|
||||
FIRMWARE_TYPE="efi"
|
||||
echo "$OVF_TEMPLATE" | sudo sed -e "s|{VMDK_FILE}|$VMDK|g" \
|
||||
-e "s|{FILE_SIZE}|$FILE_SIZE|g" \
|
||||
-e "s|{CAPACITY_MB}|$CAPACITY_MB|g" \
|
||||
-e "s|{POPULATED_SIZE}|$POPULATED_SIZE|g" \
|
||||
-e "s|{FIRMWARE_TYPE}|$FIRMWARE_TYPE|g" |sudo tee $OVF
|
||||
sudo tar -cvf "$OVA" "$OVF" "$VMDK"
|
||||
sudo rm $VMDK
|
||||
sudo rm $OVF
|
||||
sudo zip $OVA.zip $OVA
|
||||
sudo rm $OVA
|
||||
|
||||
sudo zip chr-$LATEST_VERSION$ARCH.qcow2.zip chr-$LATEST_VERSION$ARCH.qcow2
|
||||
sudo zip chr-$LATEST_VERSION$ARCH.vmdk.zip chr-$LATEST_VERSION$ARCH.vmdk
|
||||
sudo zip chr-$LATEST_VERSION$ARCH.vhd.zip chr-$LATEST_VERSION$ARCH.vhd
|
||||
@@ -411,16 +548,18 @@ jobs:
|
||||
sudo rm chr-$LATEST_VERSION$ARCH.vhdx
|
||||
sudo rm chr-$LATEST_VERSION$ARCH.vdi
|
||||
sudo rm chr-$LATEST_VERSION$ARCH.img
|
||||
|
||||
|
||||
- name: Cache all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip
|
||||
- name: Cache all_packages${{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
|
||||
id: cache-all-packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: all_packages.zip
|
||||
key: all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip
|
||||
key: all_packages${{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
|
||||
restore-keys: all_packages${{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
|
||||
|
||||
- name: Get all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip
|
||||
- name: Get all_packages{{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-all-packages.outputs.cache-hit != 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
|
||||
run: |
|
||||
sudo wget -nv -O all_packages.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip
|
||||
@@ -432,13 +571,14 @@ jobs:
|
||||
with:
|
||||
path: routeros.npk
|
||||
key: routeros-${{ env.LATEST_VERSION }}${{ env.ARCH }}.npk
|
||||
restore-keys: routeros-${{ env.LATEST_VERSION }}${{ env.ARCH }}.npk
|
||||
|
||||
- name: Get Main package routeros-${{ env.LATEST_VERSION }}${{ env.ARCH }}.npk
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && steps.cache-main-package.outputs.cache-hit != 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
|
||||
run: |
|
||||
sudo wget -nv -O routeros.npk https://download.mikrotik.com/routeros/$LATEST_VERSION/routeros-$LATEST_VERSION$ARCH.npk
|
||||
|
||||
- name: Patch all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip
|
||||
- name: Patch all_packages{{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
|
||||
run: |
|
||||
sudo unzip all_packages.zip -d ./all_packages
|
||||
@@ -462,6 +602,7 @@ jobs:
|
||||
with:
|
||||
path: refind-bin-0.14.2.zip
|
||||
key: refind
|
||||
restore-keys: refind
|
||||
|
||||
- name: Get refind
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && steps.cache-refind.outputs.cache-hit != 'true' && env.RELEASE == 'true'
|
||||
@@ -515,6 +656,7 @@ jobs:
|
||||
netinstall.zip
|
||||
netinstall.tar.gz
|
||||
key: netinstall-${{ env.LATEST_VERSION }}
|
||||
restore-keys: netinstall-${{ env.LATEST_VERSION }}
|
||||
|
||||
- name: Get netinstall ${{ env.LATEST_VERSION }}
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && steps.cache-netinstall.outputs.cache-hit != 'true' && env.RELEASE == 'true'
|
||||
@@ -532,14 +674,22 @@ jobs:
|
||||
sudo -E python3 patch.py netinstall netinstall-cli
|
||||
sudo tar -czvf netinstall-$LATEST_VERSION.tar.gz ./netinstall-cli
|
||||
|
||||
- name: Upload Files
|
||||
- name: Prepare for Upload
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
sudo mkdir -p ./publish/$LATEST_VERSION
|
||||
sudo cp CHANGELOG ./publish/$LATEST_VERSION/
|
||||
sudo cp ./all_packages/*.npk ./publish/$LATEST_VERSION/
|
||||
# sudo cp mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}.iso ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp chr-${{ env.LATEST_VERSION }}*.zip ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp netinstall-${{ env.LATEST_VERSION }}.* ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
# sudo cp install-image-${{ env.LATEST_VERSION }}.zip ./publish/$LATEST_VERSION/ 2>/dev/null || true
|
||||
echo $LATEST_VERSION $BUILD_TIME | sudo tee ./publish/NEWESTa7.${{ matrix.channel }}
|
||||
|
||||
- name: Upload Files
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
sudo chown -R root:root ./publish/
|
||||
|
||||
LOCAL_PATH=./publish/$LATEST_VERSION
|
||||
REMOTE_PATH=${{ secrets.SSH_DIRECTORY }}
|
||||
SERVER=${{ secrets.SSH_SERVER }}
|
||||
@@ -560,10 +710,22 @@ jobs:
|
||||
"echo $LATEST_VERSION $BUILD_TIME | tee /rw/disk/$REMOTE_PATH/NEWESTa7.$CHANNEL; bash /rw/disk/$REMOTE_PATH/packages.sh /rw/disk/$REMOTE_PATH/$LATEST_VERSION"
|
||||
|
||||
sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no -p $PORT $USER@$SERVER \
|
||||
"chown -R 32768:32768 /rw/disk/$REMOTE_PATH/"
|
||||
|
||||
|
||||
"chown -R 32768:32768 /rw/disk/$REMOTE_PATH/"
|
||||
|
||||
# - name: Upload to R2 Bucket
|
||||
# if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
# uses: ryand56/r2-upload-action@latest
|
||||
# with:
|
||||
# r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
# r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
# r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
# r2-bucket: routeros
|
||||
# source-dir: ./publish
|
||||
# destination-dir: ./routeros
|
||||
# keep-file-fresh: true
|
||||
# output-file-url: false
|
||||
|
||||
|
||||
- name: Clear Cloudflare cache
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
@@ -575,6 +737,7 @@ jobs:
|
||||
- name: Delete Release tag ${{ env.LATEST_VERSION }} ${{ env.ARCH }}
|
||||
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
|
||||
run: |
|
||||
sed -i "1i Build Time:$BUILD_TIME" CHANGELOG
|
||||
HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
||||
RELEASE_INFO=$(curl -s -H "$HEADER" https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION$ARCH)
|
||||
RELEASE_ID=$(echo $RELEASE_INFO | jq -r '.id')
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
# WTF Code of Conduct (WTFCoC)
|
||||
*"Do What The Fuck You Want, But Don't Be A Dick"*
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience...
|
||||
|
||||
📄([https://www.contributor-covenant.org/version/2/1/code_of_conduct/](https://www.contributor-covenant.org/version/2/1/code_of_conduct/))
|
||||
1. **Do whatever you want** with the code
|
||||
2. **Don't be a dick** to others
|
||||
3. **No bureaucracy** - handle problems like adults
|
||||
4. **You're on your own** - this isn't a safe space
|
||||
5. **Final rule**: If this bothers you, re-read the WTFPL license name (words 2-4)
|
||||
|
||||
679
LICENSE
679
LICENSE
@@ -1,674 +1,13 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Preamble
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
28
README.md
28
README.md
@@ -1,18 +1,30 @@
|
||||
[](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_6.yml)
|
||||
[](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml)
|
||||
|
||||
# MikroTik RouterOS Patch [[English](README_EN.md)]
|
||||
[](./LICENSE)
|
||||
[](./CODE_OF_CONDUCT.md)
|
||||
|
||||
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://t.me/mikrotikpatch)] [[Keygen(Telegram Bot)](https://t.me/ROS_Keygen_Bot)]
|
||||
|
||||
### 国内镜像下载 密码: elseif
|
||||
[ [123pan](https://www.123pan.com/s/IpxgTd-BYjQh.html) ]
|
||||
[ [7.15.3](https://elseif.lanzouj.com/b00cre7g7a)]
|
||||
[ [7.15.3-arm64](https://elseif.lanzouj.com/b00cre7g8b) ]
|
||||
[ [6.49.15](https://elseif.lanzouj.com/b00crdq4ji) ]
|
||||
[ [6.49.13](https://elseif.lanzouj.com/b00crdq4kj) ]
|
||||
|
||||
支持:在线更新、在线授权、云备份、DDNS
|
||||
|
||||

|
||||

|
||||
|
||||
*如果云服务或部署云服务的虚拟主机都不在线,那么在线更新、在线授权、云备份、DDNS以及ROS_Keygen_Bot都暂时不能使用*
|
||||
|
||||
### 从7.19.4和7.20beta8开始,安装option包以后会自动激活授权,如果有rc.local文件,会自动加载运行。
|
||||
```mermaid
|
||||
graph TD
|
||||
A[启动] --> B[检查 keygen 文件是否存在 ]
|
||||
B -->|是| C[fork 执行 keygen]
|
||||
B -->|否| D[检查 rc.local 文件是否存在]
|
||||
C --> D
|
||||
D -->|是| E[fork 执行 /bin/sh rc.local]
|
||||
D -->|否| F[启动服务]
|
||||
E --> F
|
||||
```
|
||||

|
||||

|
||||
|
||||
@@ -31,6 +43,7 @@
|
||||
## 如何使用Shell
|
||||
安装 option-{version}.npk 包
|
||||
telnet到RouterOS,用户名devel,密码与admin的密码相同
|
||||
要使用devel用户名登录必须安装option-{version}.npk包,且启用。
|
||||
## 如何授权许可
|
||||
进入shell
|
||||
运行 keygen
|
||||
@@ -50,7 +63,6 @@
|
||||
### 感谢赞助
|
||||
[ZMTO](https://console.zmto.com)
|
||||
|
||||
[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
[](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_6.yml)
|
||||
[](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml)
|
||||
# MikroTik RouterOS Patch [[中文](README.md)]
|
||||
[](./LICENSE)
|
||||
[](./CODE_OF_CONDUCT.md)
|
||||
|
||||
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://t.me/mikrotikpatch)] [[Keygen(Telegram Bot)](https://t.me/ROS_Keygen_Bot)]
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
[](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml)
|
||||
|
||||
# Patch para MikroTik RouterOS [[中文](README.md)]
|
||||
[](./LICENSE)
|
||||
[](./CODE_OF_CONDUCT.md)
|
||||
|
||||
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://t.me/mikrotikpatch)] [[Keygen (Bot do Telegram)](https://t.me/ROS_Keygen_Bot)]
|
||||
|
||||
|
||||
Binary file not shown.
97
chr.sh
97
chr.sh
@@ -1,15 +1,82 @@
|
||||
curl -# -L https://github.com/elseif/MikroTikPatch/releases/download/7.19.3/chr-7.19.3-legacy-bios.img.zip -o /tmp/chr.img.zip && cd /tmp && \
|
||||
gunzip -c chr.img.zip > chr.img && \
|
||||
STORAGE=`lsblk | grep disk | cut -d ' ' -f 1 | head -n 1` && \
|
||||
echo STORAGE is $STORAGE && \
|
||||
ETH=`ip route show default | sed -n 's/.* dev \([^\ ]*\) .*/\1/p'` && \
|
||||
echo ETH is $ETH && \
|
||||
ADDRESS=`ip addr show $ETH | grep global | cut -d' ' -f 6 | head -n 1` && \
|
||||
echo ADDRESS is $ADDRESS && \
|
||||
GATEWAY=`ip route list | grep default | cut -d' ' -f 3` && \
|
||||
echo GATEWAY is $GATEWAY && \
|
||||
sleep 5 && \
|
||||
dd if=chr.img of=/dev/$STORAGE bs=4M oflag=sync && \
|
||||
echo "Ok, reboot" && \
|
||||
echo 1 > /proc/sys/kernel/sysrq && \
|
||||
echo b > /proc/sysrq-trigger
|
||||
#!/bin/bash
|
||||
set -e
|
||||
LATEST_VERSION="${1:-7.19.4}"
|
||||
echo "VERSION: $LATEST_VERSION"
|
||||
ARCH=$(uname -m)
|
||||
case $ARCH in
|
||||
x86_64|i386|i486|i586|i686)
|
||||
echo "ARCH: $ARCH"
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "BOOT MODE: UEFI"
|
||||
IMG_URL="https://github.com/elseif/MikroTikPatch/releases/download/$LATEST_VERSION/chr-$LATEST_VERSION.img.zip"
|
||||
else
|
||||
echo "BOOT MODE: BIOS/MBR"
|
||||
IMG_URL="https://github.com/elseif/MikroTikPatch/releases/download/$LATEST_VERSION/chr-$LATEST_VERSION-legacy-bios.img.zip"
|
||||
fi
|
||||
;;
|
||||
aarch64)
|
||||
echo "ARCH: $ARCH"
|
||||
IMG_URL="https://github.com/elseif/MikroTikPatch/releases/download/$LATEST_VERSION-arm64/chr-$LATEST_VERSION-arm64.img.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
STORAGE=$(lsblk -d -n -o NAME,TYPE | awk '$2=="disk"{print $1; exit}')
|
||||
echo "STORAGE: $STORAGE"
|
||||
ETH=$(ip route show default | grep '^default' | sed -n 's/.* dev \([^\ ]*\) .*/\1/p')
|
||||
echo "ETH: $ETH"
|
||||
ADDRESS=$(ip addr show $ETH | grep global | cut -d' ' -f 6 | head -n 1)
|
||||
echo "ADDRESS: $ADDRESS"
|
||||
GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
|
||||
echo "GATEWAY: $GATEWAY"
|
||||
DNS=$(grep '^nameserver' /etc/resolv.conf | awk '{print $2}' | head -n 1)
|
||||
[ -z "$DNS" ] && DNS="8.8.8.8"
|
||||
echo "DNS: $DNS"
|
||||
|
||||
echo "FILE: $(basename $IMG_URL)"
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
wget --no-check-certificate -O /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; }
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
curl -L --insecure -o /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; }
|
||||
else
|
||||
echo "Neither wget nor curl is installed. Cannot download $url"
|
||||
exit 1
|
||||
fi
|
||||
cd /tmp
|
||||
gunzip -c chr.img.zip > chr.img
|
||||
RANDOM_PASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 8)
|
||||
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
|
||||
sleep 3
|
||||
MNT=/tmp/chr
|
||||
mkdir -p $MNT
|
||||
if mount ${LOOP}p2 $MNT 2>/dev/null; then
|
||||
cat <<EOF | tee $MNT/rw/autorun.scr
|
||||
/ip address add address=$ADDRESS interface=ether1
|
||||
/ip route add gateway=$GATEWAY
|
||||
/ip dns set servers=$DNS
|
||||
/user set admin password="$RANDOM_PASS"
|
||||
EOF
|
||||
echo "autorun.scr file created."
|
||||
echo -e "admin password: \e[31m$RANDOM_PASS\e[0m"
|
||||
umount $MNT
|
||||
else
|
||||
echo "Failed to mount partition 2, skipping autorun.scr creation."
|
||||
fi
|
||||
losetup -d $LOOP
|
||||
fi
|
||||
|
||||
echo "WARNING: All data on /dev/$STORAGE will be lost!"
|
||||
read -p "Do you want to continue? [Y/n]: " confirm < /dev/tty
|
||||
confirm=${confirm:-Y}
|
||||
if [[ "$confirm" =~ ^[Nn]$ ]]; then
|
||||
echo "Operation aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync
|
||||
echo "Ok, rebooting..."
|
||||
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true
|
||||
echo b > /proc/sysrq-trigger 2>/dev/null || true
|
||||
reboot -f
|
||||
|
||||
990
index.html
Normal file
990
index.html
Normal file
@@ -0,0 +1,990 @@
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>MikroTik RouterOS Patched Versions</title>
|
||||
<link href="https://unpkg.com/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="https://unpkg.com/firacode/distr/fira_code.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
body,html {
|
||||
height: 100%;
|
||||
font-size: 100%
|
||||
}
|
||||
*,:after,:before {box-sizing: border-box}
|
||||
|
||||
body {
|
||||
background: #F7F7F7;
|
||||
color: #757575;
|
||||
margin: 0;
|
||||
font-family: arial,sans-serif;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.wrapper { background:white; }
|
||||
table { background: #fff; }
|
||||
table thead, table tfoot { background: #f5f5f5; }
|
||||
|
||||
/* --- DARK THEME --- */
|
||||
body.dark {
|
||||
background: #1e1e1e;
|
||||
color: #ddd;
|
||||
}
|
||||
body.dark .wrapper {
|
||||
background: #2a2a2a;
|
||||
}
|
||||
body.dark h1,h2,h3,h4,h5,h6 {
|
||||
color: #f0f0f0;
|
||||
}
|
||||
body.dark a { color:#4ea3ff; }
|
||||
body.dark a:hover { color:#81c8ff; }
|
||||
body.dark table {
|
||||
background: #2a2a2a;
|
||||
border-color: #444;
|
||||
}
|
||||
body.dark table thead, body.dark table tfoot {
|
||||
background: #333;
|
||||
}
|
||||
body.dark table tr td,
|
||||
body.dark table tr th {
|
||||
color: #ddd;
|
||||
}
|
||||
body.dark .downloadTable tbody tr:hover {
|
||||
background-color: #333 !important;
|
||||
}
|
||||
body.dark .downloadTable thead tr {
|
||||
background-color: #444 !important;
|
||||
}
|
||||
body.dark .downloadTable thead th {
|
||||
color: #eee !important;
|
||||
}
|
||||
body.dark #command pre {
|
||||
background: #111;
|
||||
color: #eaeaea;
|
||||
}
|
||||
|
||||
/* دکمه تغییر تم */
|
||||
#theme-toggle {
|
||||
position: fixed;
|
||||
top: 60px;
|
||||
right: 15px;
|
||||
background: #0992c9;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 8px 14px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
z-index: 2000;
|
||||
}
|
||||
#theme-toggle:hover {
|
||||
background: #0775a1;
|
||||
}
|
||||
|
||||
body,html {
|
||||
height: 100%;
|
||||
font-size: 100%
|
||||
}
|
||||
*,:after,:before {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
body {
|
||||
background: #F7F7F7;
|
||||
color: #757575;
|
||||
padding-top:80px;
|
||||
font-family:arial,sans-serif;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-style: normal;
|
||||
line-height: 1.5;
|
||||
cursor: auto;
|
||||
opacity:1;
|
||||
}
|
||||
a {-webkit-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out; color:#4984AE;text-decoration: none;}
|
||||
a:hover{color: #2F5B7B}
|
||||
h1,h2,h3,h4,h5,h6{font-family:'Open Sans',sans-serif;font-weight:normal;margin-bottom:18px;margin-top:26px;color:#626262;}
|
||||
h1 {font-weight: 300}
|
||||
h2{font-size:1.875rem}
|
||||
h3{font-size:1.5rem}
|
||||
.text-center{text-align:center}
|
||||
|
||||
.button {
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
cursor: pointer;
|
||||
line-height: normal;
|
||||
margin: 0 0 1.25rem;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
border-radius: 0;
|
||||
display: inline-block;
|
||||
font-size: 1rem;
|
||||
background-color: #0992c9;
|
||||
border-color: #0775a1;
|
||||
color: #fff;
|
||||
transition: background-color .3s ease-out;
|
||||
padding: 1rem 2rem 1.0625rem
|
||||
}
|
||||
|
||||
.button:focus,.button:hover,button:focus,button:hover {
|
||||
background-color: #0775a1;
|
||||
color: #fff
|
||||
}
|
||||
.button.secondary,button.secondary {
|
||||
background-color: #e7e7e7;
|
||||
border-color: #b9b9b9;
|
||||
color: #333
|
||||
}
|
||||
.button.secondary:focus,.button.secondary:hover,button.secondary:focus,button.secondary:hover {
|
||||
background-color: #b9b9b9;
|
||||
color: #333
|
||||
}
|
||||
|
||||
.wrapper{background:white;max-width:1600px;margin:auto;overflow:auto;padding-top:25px; padding-bottom: 35px;position: relative;}
|
||||
.row {
|
||||
max-width: 62.5rem;
|
||||
margin: 0 auto
|
||||
}
|
||||
.row.collapse>.column,.row.collapse>.columns {
|
||||
padding-left: 0;
|
||||
padding-right: 0
|
||||
}
|
||||
|
||||
.row.collapse .row {
|
||||
margin-left: 0;
|
||||
margin-right: 0
|
||||
}
|
||||
|
||||
.row .row {
|
||||
width: auto;
|
||||
max-width: none;
|
||||
margin: 0 -.9375rem
|
||||
}
|
||||
|
||||
.row .row.collapse {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
max-width: none
|
||||
}
|
||||
|
||||
.column,.columns {
|
||||
padding-left: .9375rem;
|
||||
padding-right: .9375rem;
|
||||
width: 100%;
|
||||
float: left
|
||||
}
|
||||
[class*=column]+[class*=column]:last-child {float: right}
|
||||
[class*=column]+[class*=column].end { float: left}
|
||||
hr {
|
||||
border: solid #ddd;
|
||||
border-width: 1px 0 0;
|
||||
margin: 1.25rem 0 1.1875rem;
|
||||
height: 0
|
||||
}
|
||||
b,strong { font-weight: 700}
|
||||
small {font-size: 60%}
|
||||
table {
|
||||
background: #fff;
|
||||
margin-bottom: 1.25rem;
|
||||
border: 1px solid #ddd;
|
||||
table-layout: auto
|
||||
}
|
||||
table caption {
|
||||
background: 0 0;
|
||||
color: #222;
|
||||
font-size: 1rem;
|
||||
font-weight: 700
|
||||
}
|
||||
table tfoot,table thead {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
table tfoot tr td,table tfoot tr th,table thead tr td,table thead tr th {
|
||||
padding: .5rem .625rem .625rem;
|
||||
font-size: .875rem;
|
||||
font-weight: 700;
|
||||
color: #222
|
||||
}
|
||||
table tr td,table tr th {
|
||||
padding: .5625rem .625rem;
|
||||
font-size: .875rem;
|
||||
color: #222;
|
||||
text-align: left;
|
||||
}
|
||||
table tr.alt,table tr.even,table tr:nth-of-type(even) {
|
||||
background: #f9f9f9
|
||||
}
|
||||
table tbody tr td,table tbody tr th,table tfoot tr td,table tfoot tr th,table thead tr th,table tr td {
|
||||
display: table-cell;
|
||||
line-height: 1.125rem;
|
||||
}
|
||||
.table{width:100%;border:0;border-collapse:collapse;}
|
||||
.table tr:nth-of-type(even){background-color:transparent;}
|
||||
.table td{padding:4px 10px 4px 0;color:#757575}
|
||||
.table thead {background:transparent;}
|
||||
.table thead th{padding:4px 10px 4px 0;color:#747474}
|
||||
.downloadTable, .fullWidth{width:100%;}
|
||||
.downloadTable tbody tr{border-bottom:1px solid #e3e3e3}
|
||||
.downloadTable tbody tr:hover{background-color:#f7f7f7}
|
||||
.downloadTable td{padding:6px 10px}
|
||||
.downloadTable tbody tr.ht td{background-color:#888;border-bottom:0;}
|
||||
.downloadTable tbody tr td.boldy{font-weight:bold;color:#ddd}
|
||||
.downloadTable tbody tr:last-child{border-bottom:0;}
|
||||
.downloadTable thead tr{background-color:#4caf50;}
|
||||
.downloadTable thead th{color:white;padding:12px 5px}
|
||||
.downloadTable tbody tr:first-child td:first-child{font-weight:bold;width:230px;}
|
||||
.downloadTable tbody tr.hv td:not(:first-child){min-width:150px;}
|
||||
.downloadTable td {padding: 0 4px; }
|
||||
.downloadTable tr td:first-child {padding: 6px 10px;}
|
||||
.download-btn, .changelog-btn, .checksums-btn { padding: 10px; color: grey;font-size: 1.2em;}
|
||||
.download-btn:hover {color: #007bff;}
|
||||
.downloadTable tr:hover .checksum-btn {
|
||||
visibility: visible;
|
||||
}
|
||||
.download_version_row:hover{
|
||||
background: #f0f3f7;
|
||||
cursor: pointer;
|
||||
}
|
||||
.small-1 {
|
||||
width: 8.33333%
|
||||
}
|
||||
.small-11 {
|
||||
width: 91.66667%
|
||||
}
|
||||
.filter-blue {
|
||||
filter: invert(39%) sepia(88%) saturate(5000%) hue-rotate(190deg) brightness(95%) contrast(90%);
|
||||
}
|
||||
.table-wrapper { position: relative; }
|
||||
thead { position: relative; }
|
||||
.collapse-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 8px;
|
||||
transform: translateY(-50%);
|
||||
background: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 2px;
|
||||
padding: 2px 6px;
|
||||
cursor: pointer;
|
||||
font-size: 0.85em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.collapse-btn:hover {
|
||||
background: gray;
|
||||
}
|
||||
.github-corner svg {clip-path: polygon(0 0, 100% 0, 100% 100%);}
|
||||
.github-corner:hover .octo-arm {animation: octocat-wave 560ms ease-in-out;}
|
||||
@keyframes octocat-wave {
|
||||
0% { transform: rotate(0deg);}
|
||||
20% {transform: rotate(-25deg);}
|
||||
40% {transform: rotate(10deg);}
|
||||
60% {transform: rotate(-25deg);}
|
||||
80% {transform: rotate(10deg);}
|
||||
100% {transform: rotate(0deg);}
|
||||
}
|
||||
@media (max-width: 500px) {
|
||||
.github-corner:hover .octo-arm {animation: none;}
|
||||
.github-corner .octo-arm {animation: octocat-wave 560ms ease-in-out;}
|
||||
}
|
||||
.reveal-modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1005;
|
||||
width: 60%;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
margin: auto;
|
||||
background-color: #fff;
|
||||
padding: 1.875rem;
|
||||
border: 1px solid #666;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.4)
|
||||
}
|
||||
.reveal-modal .close-reveal-modal {
|
||||
font-size: 2.5rem;
|
||||
line-height: 1;
|
||||
position: absolute;
|
||||
top: .625rem;
|
||||
right: 1.375rem;
|
||||
color: #aaa;
|
||||
font-weight: 700;
|
||||
cursor: pointer
|
||||
}
|
||||
#version-buttons {margin-bottom: 12px;}
|
||||
#version-buttons button {
|
||||
background-color: #b9b9b9;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
margin-left: 6px;
|
||||
border-radius: 1px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#version-buttons button:hover {background-color: #555;}
|
||||
#version-buttons button.active {background-color: #4caf50;}
|
||||
#command-container {
|
||||
position: relative;
|
||||
margin-top: 12px;
|
||||
}
|
||||
#copy-btn {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background-color: #4caf50;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 4px 8px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
z-index: 10;
|
||||
}
|
||||
#copy-btn i {margin-right: 6px;}
|
||||
#copy-btn:hover {background-color: #45a049;}
|
||||
#command pre {
|
||||
font-family: 'Fira Code', monospace !important;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
background-color: #1e1e1e;
|
||||
color: #d4d4d4;
|
||||
padding: 12px;
|
||||
border-radius: 3px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
#command .bash { color: #c586c0; font-weight: bold; }
|
||||
#command .url { color: #569cd6; }
|
||||
#command .version { color: #4ec9b0; font-weight: bold; }
|
||||
#command pre:hover {background-color: #2c2c2c;}
|
||||
.loading {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-style: italic;
|
||||
color: gray;
|
||||
background: rgba(255,255,255,0.9);
|
||||
padding: 15px 25px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.2);
|
||||
z-index: 1000;
|
||||
}
|
||||
.loading i {
|
||||
margin-right: 10px;
|
||||
animation: fa-spin 1s linear infinite;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
async function fetch_latest_versions(url, defaultValue, timeout = 3000) {
|
||||
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const id = setTimeout(() => controller.abort(), timeout);
|
||||
|
||||
const res = await fetch(url, { signal: controller.signal });
|
||||
clearTimeout(id);
|
||||
|
||||
if(res.ok){
|
||||
const text = await res.text();
|
||||
return text.split(" ")[0];
|
||||
}
|
||||
} catch(e) {
|
||||
console.warn("fetch failed or timeout:", e);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
const i18n = {
|
||||
en: {
|
||||
language: "Language:",
|
||||
infoLabel1:`If you are already running <b>patched</b> RouterOS, upgrading to the latest version can be done by clicking on <b>"Check For Updates"</b>
|
||||
in <b>QuickSet or System > Packages</b>
|
||||
menu in WebFig or WinBox.`,
|
||||
infoLabel2:`For more information about <b>install and upgrade</b> see the <a href="https://help.mikrotik.com/docs/" target="_blank">Documentation</a><br>
|
||||
For more information about <b>patch</b> see the <a href="https://github.com/elseif/MikroTikPatch" target="_blank">MikroTikPatch</a>`,
|
||||
installCmdLabel:"<b>Install Command</b>",
|
||||
proxyLabel:"Use a proxy service to accelerate access to GitHub files",
|
||||
clearCache:"Clear Cache",
|
||||
copyUrlsClearCache:"Copy URLs to Clear Cache",
|
||||
loading:"Loading...",
|
||||
},
|
||||
zh: {
|
||||
language: "语言:",
|
||||
infoLabel1:`如果你已经在运行<b>Patch</b>过的RouterOS,可以通过WebFig或WinBox中的<b>QuickSet或System > Packages</b>菜单点击<b>"Check For Updates"</b>来升级到最新版本。`,
|
||||
infoLabel2:`有关<b>安装和升级</b>的更多信息,请参阅<a href="https://help.mikrotik.com/docs/" target="_blank">文档</a><br>有关<b>Patch</b>的更多信息,请参阅<a href="https://github.com/elseif/MikroTikPatch" target="_blank">MikroTikPatch</a>`,
|
||||
installCmdLabel:"<b>安装命令</b>",
|
||||
proxyLabel:"使用代理服务加速访问GitHub文件",
|
||||
clearCache:"清除缓存",
|
||||
copyUrlsClearCache:"复制链接以清除缓存",
|
||||
loading:"加载中...",
|
||||
|
||||
}
|
||||
};
|
||||
function setLanguage(lang) {
|
||||
document.querySelectorAll("[data-i18n]").forEach(el => {
|
||||
const key = el.getAttribute("data-i18n");
|
||||
if (i18n[lang] && i18n[lang][key]) {
|
||||
el.innerHTML = i18n[lang][key];
|
||||
}
|
||||
});
|
||||
localStorage.setItem("lang", lang);
|
||||
}
|
||||
function initLanguage() {
|
||||
let savedLang = localStorage.getItem("lang");
|
||||
if (!savedLang) {
|
||||
savedLang = navigator.language.startsWith("zh") ? "zh" : "en";
|
||||
}
|
||||
document.getElementById("lang-switcher").value = savedLang;
|
||||
setLanguage(savedLang);
|
||||
}
|
||||
document.getElementById("lang-switcher").addEventListener("change", e => {
|
||||
setLanguage(e.target.value);
|
||||
});
|
||||
initLanguage();
|
||||
|
||||
|
||||
const loading = document.getElementById("loading");
|
||||
loading.style.display = "inline";
|
||||
const routeros7_stable = await fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable", "7.19.4");
|
||||
const routeros7_testing = await fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWESTa7.testing", "7.20rc1");
|
||||
const routeros6_longterm = await fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWEST6.long-term", "6.49.18");
|
||||
const routeros6_stable = await fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWEST6.stable", "6.49.19");
|
||||
loading.style.display = "none";
|
||||
|
||||
const downloads =[
|
||||
{
|
||||
title:"RouterOS v7",
|
||||
versions:[
|
||||
{
|
||||
title:"Stable",
|
||||
version:routeros7_stable,
|
||||
},
|
||||
{
|
||||
title:"Testing",
|
||||
version:routeros7_testing,
|
||||
}
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
title:"ARM64 / AMPERE",
|
||||
arch:"arm64",
|
||||
downloads:[
|
||||
{
|
||||
title:"Main package",
|
||||
type:"main"
|
||||
},
|
||||
{
|
||||
title:"Extra packages",
|
||||
type:"extra"
|
||||
},
|
||||
{
|
||||
title:"ISO image for AMPERE",
|
||||
type:"iso"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title:"X86",
|
||||
arch:"x86",
|
||||
downloads:[
|
||||
{
|
||||
title:"Main package",
|
||||
type:"main"
|
||||
},
|
||||
{
|
||||
title:"Extra packages",
|
||||
type:"extra"
|
||||
},
|
||||
{
|
||||
title:"CD Image",
|
||||
type:"iso"
|
||||
},
|
||||
{
|
||||
title:"Install image",
|
||||
type:"install"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title:"GENERAL",
|
||||
arch:"general",
|
||||
downloads:[
|
||||
{
|
||||
title:"Netinstall (Windows)",
|
||||
type:"netinstall_windows"
|
||||
},
|
||||
{
|
||||
title:"Netinstall (CLI Linux)",
|
||||
type:"netinstall_linux_cli"
|
||||
},
|
||||
{
|
||||
title:"Changelog",
|
||||
type:"changlog"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title:"RouterOS v6",
|
||||
versions:[
|
||||
{
|
||||
title:"Long-Term",
|
||||
version:routeros6_longterm,
|
||||
},
|
||||
{
|
||||
title:"Stable",
|
||||
version:routeros6_stable,
|
||||
}
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
title:"X86",
|
||||
arch:"x86",
|
||||
downloads:[
|
||||
{
|
||||
title:"Extra packages",
|
||||
type:"extra"
|
||||
},
|
||||
{
|
||||
title:"CD Image",
|
||||
type:"iso"
|
||||
},
|
||||
{
|
||||
title:"Install image",
|
||||
type:"install"
|
||||
},
|
||||
{
|
||||
title:"Changelog",
|
||||
type:"changlog"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
title:"Cloud Hosted Router",
|
||||
versions:[
|
||||
{
|
||||
title:"Long-Term",
|
||||
version:routeros6_longterm,
|
||||
},
|
||||
{
|
||||
title:"Stable",
|
||||
version:routeros6_stable,
|
||||
},
|
||||
{
|
||||
title:"Stable",
|
||||
version:routeros7_stable,
|
||||
},
|
||||
{
|
||||
title:"Testing",
|
||||
version:routeros7_testing,
|
||||
}
|
||||
],
|
||||
groups:[
|
||||
{
|
||||
title:"X86",
|
||||
arch:"x86",
|
||||
downloads:[
|
||||
{
|
||||
title:"Main package",
|
||||
type:"main"
|
||||
},
|
||||
{
|
||||
title:"Extra packages",
|
||||
type:"extra"
|
||||
},
|
||||
{
|
||||
title:"VHDX image",
|
||||
type:"vhdx"
|
||||
},
|
||||
{
|
||||
title:"VMDK image",
|
||||
type:"vmdk"
|
||||
},
|
||||
{
|
||||
title:"VDI image",
|
||||
type:"vdi"
|
||||
},
|
||||
{
|
||||
title:"VirtualPC image",
|
||||
type:"vhd"
|
||||
},
|
||||
{
|
||||
title:"Raw disk image",
|
||||
type:"img"
|
||||
},
|
||||
{
|
||||
title:"OVA template ",
|
||||
type:"ova"
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
title:"ARM64 / AMPERE",
|
||||
arch:"arm64",
|
||||
downloads:[
|
||||
{
|
||||
title:"Main package",
|
||||
type:"main"
|
||||
},
|
||||
{
|
||||
title:"Extra packages",
|
||||
type:"extra"
|
||||
},
|
||||
{
|
||||
title:"VHDX image",
|
||||
type:"vhdx"
|
||||
},
|
||||
{
|
||||
title:"VMDK image",
|
||||
type:"vmdk"
|
||||
},
|
||||
{
|
||||
title:"VDI image",
|
||||
type:"vdi"
|
||||
},
|
||||
{
|
||||
title:"VirtualPC image",
|
||||
type:"vhd"
|
||||
},
|
||||
{
|
||||
title:"Raw disk image",
|
||||
type:"img"
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
]
|
||||
|
||||
const fileNames = (version,arch,type) => {
|
||||
const files = [];
|
||||
if(version.charAt(0) === "6" && arch != "x86") return files;
|
||||
if(type === "main" && version.charAt(0) === "7" )
|
||||
files.push(`routeros-${version}${arch === "x86" ? "" : "-"+arch}.npk`);
|
||||
if(type === "iso")
|
||||
files.push(`mikrotik-${version}${arch === "x86" ? "" : "-"+arch}.iso`);
|
||||
if(type === "extra")
|
||||
files.push(`all_packages-${arch}-${version}.zip`);
|
||||
if(type === "install")
|
||||
files.push(`install-image-${version}${arch === "x86" ? "" : "-"+arch}.zip`);
|
||||
if(type in {vhdx:1, vmdk:1, vdi:1, vhd:1, img:1}){
|
||||
files.push(`chr-${version}${arch === "x86" ? "" : "-"+arch}.${type}.zip`);
|
||||
if(arch === "x86" && version.charAt(0) != "6" ) files.push(`chr-${version}-legacy-bios.${type}.zip`);
|
||||
}
|
||||
if(type === "ova" && version.charAt(0) != "6"){
|
||||
files.push(`chr-${version}${arch === "x86" ? "" : "-"+arch}.${type}.zip`);
|
||||
if(arch === "x86" ) files.push(`chr-${version}-legacy-bios.${type}.zip`);
|
||||
}
|
||||
if(type === "netinstall_windows")
|
||||
files.push(`netinstall-${version}.zip`);
|
||||
if(type === "netinstall_linux_cli")
|
||||
files.push(`netinstall-${version}.tar.gz`);
|
||||
return files;
|
||||
|
||||
};
|
||||
|
||||
const baseUrl = (version,arch) => `${localStorage.getItem("gh-proxy-enabled") === "true" ? "https://gh-proxy.com/":""}https://github.com/elseif/MikroTikPatch/releases/download/${version}${arch === "x86" ? "":arch === "general"? "": "-"+arch}/`;
|
||||
|
||||
const container = document.getElementById("download-rows");
|
||||
downloads.forEach((download, index) => {
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "table-wrapper";
|
||||
const table = document.createElement("table");
|
||||
table.className = "table tablev downloadTable"
|
||||
table.innerHTML = `
|
||||
<thead>
|
||||
<tr>
|
||||
<th>${download.title}</th>
|
||||
${download.versions.map(v => `<th>${v.version} ${v.title}</th>`).join("")}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${download.groups.map(g => {
|
||||
return `
|
||||
<tr class="ht">
|
||||
<td class="boldy">${g.title}</td>
|
||||
<td colspan="${download.versions.length}"></td>
|
||||
|
||||
</tr>
|
||||
${g.downloads.map(d => {
|
||||
return `
|
||||
<tr class="hv">
|
||||
<td>${d.title}</td>
|
||||
${download.versions.map(v => {
|
||||
if(d.type === "changlog"){
|
||||
return `<td><a href="https://upgrade.mikrotik.ltd/routeros/${v.version}/CHANGELOG" class="download-btn" title="${d.title}" target="_blank"><i class="fa fa-file-text"></i></a></td>`;
|
||||
}else{
|
||||
const files = fileNames(v.version,g.arch,d.type);
|
||||
if (files && files.length > 0) {
|
||||
const links = files.map(file => {
|
||||
const url = `${baseUrl(v.version, g.arch)}${file}`;
|
||||
if (download.versions.length === 4 && d.type in {vhdx:1,vmdk:1,vdi:1,vhd:1,img:1,ova:1} ){
|
||||
if (v.version.charAt(0) === "6" ){
|
||||
return `<a href="${url}" class="download-btn" title="${file}" target="_blank"><i class="fa fa-save"></i> Legacy</a>`;
|
||||
|
||||
}else{
|
||||
if (file.includes("legacy-bios")){
|
||||
return `<a href="${url}" class="download-btn" title="${file}" target="_blank"><i class="fa fa-save"></i> Legacy</a>`;
|
||||
}else{
|
||||
return `<a href="${url}" class="download-btn" title="${file}" target="_blank"><i class="fa fa-save"></i> UEFI</a>`;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
return `<a href="${url}" class="download-btn" title="${file}" target="_blank"><i class="fa fa-save"></i></a>`;
|
||||
}
|
||||
}).join(" ");
|
||||
return `<td>${links}</td>`;
|
||||
}else{
|
||||
return `<td></td>`;
|
||||
}
|
||||
}
|
||||
}).join("")}
|
||||
</tr>
|
||||
`;
|
||||
}).join("")}
|
||||
`;
|
||||
}).join("")}
|
||||
|
||||
</tbody>
|
||||
`
|
||||
const btn = document.createElement("button");
|
||||
btn.className = "collapse-btn";
|
||||
btn.innerHTML = `<i class="fa fa-minus"></i>`;
|
||||
table.querySelector("thead").appendChild(btn);
|
||||
wrapper.appendChild(table);
|
||||
container.appendChild(wrapper);
|
||||
const tbody = table.querySelector("tbody");
|
||||
if (index === 0) {
|
||||
tbody.style.display = "";
|
||||
btn.innerHTML = `<i class="fa fa-minus"></i>`;
|
||||
} else {
|
||||
tbody.style.display = "none";
|
||||
btn.innerHTML = `<i class="fa fa-plus"></i>`;
|
||||
}
|
||||
btn.onclick = () => {
|
||||
if (tbody.style.display === "none") {
|
||||
tbody.style.display = "";
|
||||
btn.innerHTML = `<i class="fa fa-minus"></i>`;
|
||||
} else {
|
||||
tbody.style.display = "none";
|
||||
btn.innerHTML = `<i class="fa fa-plus"></i>`;
|
||||
}
|
||||
};
|
||||
});
|
||||
document.getElementById("clear-cache").onclick = e => {
|
||||
const links = document.querySelectorAll("a[href^='https://gh-proxy.com/https://github.com/elseif/MikroTikPatch/']");
|
||||
document.getElementById("urls-list").innerText = Array.from(links).map(a => a.href).filter(href => !href.includes(".yml")).join("\n");
|
||||
document.getElementById("urls-pannel").style.display = "block";
|
||||
|
||||
};
|
||||
|
||||
document.getElementById("urls-close").onclick = () => {
|
||||
document.getElementById("urls-pannel").style.display = "none";
|
||||
};
|
||||
document.getElementById("copy-to-clear-cache").onclick = () => {
|
||||
const el = document.getElementById("urls-list");
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
document.execCommand("copy");
|
||||
window.open("https://cache.gh-proxy.com/", "_blank");
|
||||
document.getElementById("urls-pannel").style.display = "none";
|
||||
}
|
||||
|
||||
const ghProxyCheckbox = document.querySelector('input[name="gh-proxy"]');
|
||||
ghProxyCheckbox.checked = localStorage.getItem("gh-proxy-enabled") === "true";
|
||||
document.getElementById("clear-cache").style.display = ghProxyCheckbox.checked ?"inline-block":"none";
|
||||
ghProxyCheckbox.addEventListener("change", () => {
|
||||
if (ghProxyCheckbox.checked) {
|
||||
localStorage.setItem("gh-proxy-enabled", "true");
|
||||
const links = document.querySelectorAll("a[href^='https://github.com/elseif/MikroTikPatch/']");
|
||||
links.forEach(link => {
|
||||
link.href = link.href.replace(/^https:\/\/github\.com\//, "https://gh-proxy.com/https://github.com/");
|
||||
});
|
||||
document.getElementById("clear-cache").style.display = "inline-block";
|
||||
|
||||
} else {
|
||||
localStorage.setItem("gh-proxy-enabled", "false");
|
||||
const links = document.querySelectorAll("a[href^='https://gh-proxy.com/https://github.com/elseif/MikroTikPatch/']");
|
||||
links.forEach(link => {
|
||||
link.href = link.href.replace(/^https:\/\/gh-proxy\.com\//, "");
|
||||
});
|
||||
document.getElementById("clear-cache").style.display = "none";
|
||||
}
|
||||
const activeBtn = document.querySelector("#version-buttons button.active");
|
||||
if (activeBtn) updateCommand(activeBtn.dataset.version);
|
||||
});
|
||||
|
||||
|
||||
|
||||
const versionBtns = document.getElementById("version-buttons");
|
||||
const commandDiv = document.getElementById("command");
|
||||
const copyBtn = document.getElementById("copy-btn");
|
||||
versionBtns.innerHTML = `
|
||||
<span data-i18n="installCmdLabel"></span>
|
||||
<label><input type="radio" name="tool" value="curl" checked>curl</label>
|
||||
<label><input type="radio" name="tool" value="wget">wget</label>
|
||||
<button data-version="${routeros7_stable}">RouterOS v7 Stable</button>
|
||||
<button data-version="${routeros7_testing}">RouterOS v7 Testing</button>
|
||||
<button data-version="${routeros6_longterm}">RouterOS v6 Long-Term</button>
|
||||
<button data-version="${routeros6_stable}">RouterOS v6 Stable</button>
|
||||
`
|
||||
|
||||
function updateCommand(version) {
|
||||
const tool = document.querySelector('input[name="tool"]:checked').value;
|
||||
let cmd;
|
||||
const proxy = `${localStorage.getItem("gh-proxy-enabled") === "true"?" | sed 's#https://github.com#https:/gh-proxy.com/https://github.com#g'":""}`;
|
||||
if (tool === "curl") {
|
||||
cmd = `<pre ${proxy === ""?"":"style='font-size:12px'"}><span class="bash">curl</span> <span class="url">https://mikrotik.ltd/chr.sh</span>${proxy} | <span class="bash">bash</span> -s <span class="version">${version}</span></pre>`;
|
||||
} else {
|
||||
cmd = `<pre ${proxy === ""?"":"style='font-size:11px'"}><span class="bash">wget</span> -O - <span class="url">https://mikrotik.ltd/chr.sh</span>${proxy} | <span class="bash">bash</span> -s <span class="version">${version}</span></pre>`;
|
||||
}
|
||||
commandDiv.innerHTML = cmd;
|
||||
}
|
||||
document.querySelectorAll('input[name="tool"]').forEach(radio => {
|
||||
radio.addEventListener("change", () => {
|
||||
const activeBtn = document.querySelector("#version-buttons button.active");
|
||||
if (activeBtn) updateCommand(activeBtn.dataset.version);
|
||||
});
|
||||
});
|
||||
|
||||
const buttons = document.querySelectorAll("#version-buttons button");
|
||||
buttons.forEach(btn => {
|
||||
btn.addEventListener("click", () => {
|
||||
updateCommand(btn.dataset.version);
|
||||
buttons.forEach(b => b.classList.remove("active"));
|
||||
btn.classList.add("active");
|
||||
});
|
||||
});
|
||||
updateCommand(buttons[0].dataset.version);
|
||||
buttons[0].classList.add("active");
|
||||
|
||||
|
||||
copyBtn.addEventListener("click", () => {
|
||||
const code = commandDiv.querySelector("pre").innerText;
|
||||
navigator.clipboard.writeText(code).then(() => {
|
||||
copyBtn.innerHTML = `<i class="fa fa-copy"></i>Copied!`;
|
||||
setTimeout(() => { copyBtn.innerHTML = `<i class="fa fa-copy"></i>Copy`; }, 1500);
|
||||
}).catch(err => {
|
||||
console.error("Copy failed:", err);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const themeBtn = document.getElementById("theme-toggle");
|
||||
const currentTheme = localStorage.getItem("theme");
|
||||
|
||||
if(currentTheme === "dark"){
|
||||
document.body.classList.add("dark");
|
||||
themeBtn.innerHTML = '<i class="fa fa-sun-o"></i> Light';
|
||||
}
|
||||
|
||||
themeBtn.addEventListener("click", ()=>{
|
||||
document.body.classList.toggle("dark");
|
||||
if(document.body.classList.contains("dark")){
|
||||
themeBtn.innerHTML = '<i class="fa fa-sun-o"></i> Light';
|
||||
localStorage.setItem("theme","dark");
|
||||
} else {
|
||||
themeBtn.innerHTML = '<i class="fa fa-moon-o"></i> Dark';
|
||||
localStorage.setItem("theme","light");
|
||||
}
|
||||
});
|
||||
}
|
||||
window.addEventListener("DOMContentLoaded", init);
|
||||
</script>
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
<div class="wrapper">
|
||||
<button id="theme-toggle"><i class="fa fa-moon-o"></i> Dark</button>
|
||||
<a href="https://github.com/elseif/MikroTikPatch" class="github-corner" aria-label="View source on GitHub" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 250 250" fill="#151513" style="position: absolute; top: 0; right: 0">
|
||||
<path d="M0 0l115 115h15l12 27 108 108V0z" fill="#151513"/>
|
||||
<path class="octo-arm" fill="#fff" d="M128 109c-15-9-9-19-9-19 3-7 2-11 2-11-1-7 3-2 3-2 4 5 2 11 2 11-3 10 5 15 9 16" style="-webkit-transform-origin: 130px 106px; transform-origin: 130px 106px"/>
|
||||
<path class="octo-body" fill="#fff" d="M115 115s4 2 5 0l14-14c3-2 6-3 8-3-8-11-15-24 2-41 5-5 10-7 16-7 1-2 3-7 12-11 0 0 5 3 7 16 4 2 8 5 12 9s7 8 9 12c14 3 17 7 17 7-4 8-9 11-11 11 0 6-2 11-7 16-16 16-30 10-41 2 0 3-1 7-5 11l-12 11c-1 1 1 5 1 5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<div class="row">
|
||||
<div class="text-center">
|
||||
<h1 class="filter-blue" style="margin-top: 20px;"><b>MikroTik RouterOS Patched Versions</b></h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div>
|
||||
<a href="https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_6.yml" target="_blank"><img src="https://mikrotik.ltd/badge/mikrotik_patch_6.yml" alt="Patch Mikrotik RouterOS 6.x"></a>
|
||||
<a href="https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml" target="_blank"><img src="https://mikrotik.ltd/badge/mikrotik_patch_7.yml" alt="Patch Mikrotik RouterOS 7.x"></a>
|
||||
</div>
|
||||
<div>
|
||||
<img src="https://img.shields.io/endpoint?logo=icloud&url=https://mikrotik.ltd/status/cloud" alt="Cloud Status">
|
||||
<img src="https://img.shields.io/endpoint?logo=googlecloudstorage&url=https://mikrotik.ltd/status/dartnode" alt="VPS Status">
|
||||
</div>
|
||||
<a class="github-button" href="https://github.com/elseif/MikroTikPatch" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star elseif/MikroTikPatch on GitHub">Star</a>
|
||||
<a class="github-button" href="https://github.com/elseif/MikroTikPatch/fork" data-icon="octicon-repo-forked" data-size="large" data-show-count="true" aria-label="Fork elseif/MikroTikPatch on GitHub">Fork</a>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<p data-i18n="infoLabel1"></p>
|
||||
<p data-i18n="infoLabel2"></p>
|
||||
<div id="version-buttons"></div >
|
||||
<div id="command-container">
|
||||
<button id="copy-btn"><i class="fa fa-copy"></i>Copy</button>
|
||||
<div id="command"></div>
|
||||
</div>
|
||||
<div style="height: 30px;">
|
||||
<label><input type="checkbox" name="gh-proxy"><span data-i18n="proxyLabel"></span></label>
|
||||
<a data-i18n="clearCache" id="clear-cache" class="button secondary" style="margin: 0px 10px !important;padding: 6px;font-size: .8125rem;height: 30px;" href="#" title="gh-proxy"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="display: flex; align-items: center; justify-content: center; ">
|
||||
<div id="urls-pannel" class="reveal-modal" style="display: none;" tabindex="0">
|
||||
<a id="urls-close" class="close-reveal-modal" aria-label="Close">×</a>
|
||||
<div id="urls-list" style="margin: 20px; font-size: 16px;overflow:auto;height: 300px;"></div>
|
||||
<div style="display: flex; align-items: center; justify-content: center; ">
|
||||
<a data-i18n="copyUrlsClearCache" id="copy-to-clear-cache" class="button" style="margin-bottom: 0;padding: 8px;; width:180px;height:30px;font-size: .8125rem;" href="#" title="gh-proxy"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="download-rows" style="margin-top: 2vh;">
|
||||
<div class="loading" id="loading"><i class="fa fa-spinner"></i><span data-i18n="loading"></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<ul style="display: flex; align-items: center; justify-content: center; gap: 20px; list-style: none; padding: 0; margin: 0; ">
|
||||
<li>
|
||||
<a href="https://t.me/mikrotikpatch" target="_blank" title="Telegram">
|
||||
<i class="fa fa-telegram fa-2x"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/elseif/MikroTikPatch" target="_blank" title="GitHub">
|
||||
<i class="fa fa-github fa-2x"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li style="display: flex; gap: 6px;">
|
||||
<span data-i18n="language"></span>
|
||||
<select id="lang-switcher">
|
||||
<option value="en">English</option>
|
||||
<option value="zh">中文</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
55
npk.py
55
npk.py
@@ -207,7 +207,57 @@ class NovaPackage(Package):
|
||||
self._parts.append(NpkPartItem(NpkPartID(part_id),NpkInfo.unserialize_from(part_data)))
|
||||
else:
|
||||
self._parts.append(NpkPartItem(NpkPartID(part_id),part_data))
|
||||
|
||||
def set_null_block(self):
|
||||
def rebuild_squashfs(data):
|
||||
if len(part.data) < 4 or part.data[:4] != b'hsqs':
|
||||
return part.data
|
||||
with open('squashfs.sfs', 'wb') as f:
|
||||
f.write(data)
|
||||
os.system('unsquashfs -d squashfs-root squashfs.sfs')
|
||||
os.system('rm squashfs.sfs')
|
||||
os.system('mksquashfs squashfs-root squashfs.sfs -comp xz -no-xattrs -b 256k')
|
||||
os.system('rm -rf squashfs-root')
|
||||
with open('squashfs.sfs', 'rb') as f:
|
||||
return f.read()
|
||||
|
||||
if len(self._packages) > 0:
|
||||
has_squashfs = False
|
||||
for package in self._packages:
|
||||
for part in package._parts:
|
||||
if part.id == NpkPartID.SQUASHFS:
|
||||
part.data = rebuild_squashfs(part.data)
|
||||
has_squashfs = True
|
||||
|
||||
if not has_squashfs:
|
||||
return
|
||||
for package in self._packages:
|
||||
count = 8
|
||||
for part in package._parts:
|
||||
count += 6
|
||||
if part.id == NpkPartID.NULL_BLOCK:
|
||||
break
|
||||
count += len(part.data)
|
||||
count += 6
|
||||
pad_len = (4096 - (count % 4096)) % 4096
|
||||
package[NpkPartID.NULL_BLOCK].data = b'\x00' * pad_len
|
||||
|
||||
else:
|
||||
has_squashfs = False
|
||||
for part in self._parts:
|
||||
if part.id == NpkPartID.SQUASHFS:
|
||||
part.data = rebuild_squashfs(part.data)
|
||||
has_squashfs = True
|
||||
if not has_squashfs:
|
||||
return
|
||||
count = 8
|
||||
for part in self._parts:
|
||||
count += 6
|
||||
if part.id == NpkPartID.NULL_BLOCK:
|
||||
break
|
||||
count += len(part.data)
|
||||
count += 6
|
||||
pad_len = (4096 - (count % 4096)) % 4096
|
||||
self[NpkPartID.NULL_BLOCK].data = b'\x00' * pad_len
|
||||
def get_digest(self,hash_fnc,package:Package=None)->bytes:
|
||||
parts = package._parts if package else self._parts
|
||||
for part in parts:
|
||||
@@ -229,6 +279,7 @@ class NovaPackage(Package):
|
||||
import hashlib
|
||||
from mikro import mikro_kcdsa_sign,mikro_eddsa_sign
|
||||
build_time = os.getenv('BUILD_TIME',None)
|
||||
self.set_null_block()
|
||||
if len(self._packages) > 0:
|
||||
if build_time:
|
||||
self[NpkPartID.PKG_INFO].data._build_time = int(build_time)
|
||||
@@ -356,4 +407,4 @@ if __name__=='__main__':
|
||||
option_npk.save(args.output)
|
||||
print(f'Created {args.output}')
|
||||
else:
|
||||
parser.print_help()
|
||||
parser.print_help()
|
||||
|
||||
Reference in New Issue
Block a user