modified: .github/workflows/mikrotik_patch.yml

This commit is contained in:
zyb 2024-06-24 15:30:39 +08:00
parent 6420ceb0a5
commit cdca1ee5ef

View File

@ -14,6 +14,7 @@ jobs:
env: env:
TZ: 'Asia/Shanghai' TZ: 'Asia/Shanghai'
steps: steps:
- name: Create squashfs for option npk - name: Create squashfs for option npk
run: | run: |
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE
@ -87,24 +88,30 @@ jobs:
echo Latest Version:$LATEST_VERSION echo Latest Version:$LATEST_VERSION
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
- name: Get netinstall-${{ env.LATEST_VERSION }}.zip - name: Cache
id: cache
uses: actions/cache@v4
with:
path: |
netinstall-${{ env.LATEST_VERSION }}.zip
mikrotik-${{ env.LATEST_VERSION }}.iso
key: ${{ runner.os }}-${{ env.LATEST_VERSION }}
- name: Get netinstall-${{ env.LATEST_VERSION }}.zip and mikrotik-${{ env.LATEST_VERSION }}.iso
if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
sudo wget -nv -O netinstall-$LATEST_VERSION.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/netinstall-$LATEST_VERSION.zip sudo wget -nv -O netinstall-$LATEST_VERSION.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/netinstall-$LATEST_VERSION.zip
sudo unzip netinstall-$LATEST_VERSION.zip sudo wget -nv -O mikrotik-$LATEST_VERSION.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION.iso
sudo rm netinstall-$LATEST_VERSION.zip
- name: Patch netinstall.exe - name: Patch netinstall.exe
run: | run: |
sudo -E python3 patch.py netinstall netinstall.exe sudo -E python3 patch.py netinstall netinstall.exe
sudo zip netinstall-$LATEST_VERSION.zip ./netinstall.exe sudo zip netinstall-$LATEST_VERSION.zip ./netinstall.exe
- name: Get mikrotik-${{ env.LATEST_VERSION }}.iso
run: |
sudo wget -nv -O mikrotik-$LATEST_VERSION.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION.iso
- name: Patch mikrotik-${{ env.LATEST_VERSION }}.iso - name: Patch mikrotik-${{ env.LATEST_VERSION }}.iso
run: | run: |
sudo apt-get install -y mkisofs > /dev/null sudo apt-get install -y mkisofs > /dev/null
sudo unzip netinstall-$LATEST_VERSION.zip
sudo mkdir ./iso sudo mkdir ./iso
sudo mount -o loop,ro mikrotik-$LATEST_VERSION.iso ./iso sudo mount -o loop,ro mikrotik-$LATEST_VERSION.iso ./iso
sudo mkdir ./new_iso sudo mkdir ./new_iso
@ -112,7 +119,6 @@ jobs:
sudo rsync -a ./iso/ ./new_iso/ sudo rsync -a ./iso/ ./new_iso/
sudo umount ./iso sudo umount ./iso
sudo rm -rf ./iso sudo rm -rf ./iso
sudo rm -f mikrotik-$LATEST_VERSION.iso
sudo mv ./new_iso/routeros-$LATEST_VERSION.npk ./ sudo mv ./new_iso/routeros-$LATEST_VERSION.npk ./
sudo -E python3 patch.py npk routeros-$LATEST_VERSION.npk sudo -E python3 patch.py npk routeros-$LATEST_VERSION.npk
sudo cp keygen.zip ./new_iso/ sudo cp keygen.zip ./new_iso/
@ -227,9 +233,10 @@ jobs:
sudo mount /dev/nbd0 ./install sudo mount /dev/nbd0 ./install
sudo mkdir -p ./install/EFI/BOOT sudo mkdir -p ./install/EFI/BOOT
sudo wget -nv -O refind-bin-0.14.2.zip https://nchc.dl.sourceforge.net/project/refind/0.14.2/refind-bin-0.14.2.zip sudo wget -nv -O refind-bin-0.14.2.zip https://nchc.dl.sourceforge.net/project/refind/0.14.2/refind-bin-0.14.2.zip
sudo unzip -q refind-bin-0.14.2.zip sudo unzip refind-bin-0.14.2.zip refind-bin-0.14.2/refind/refind_x64.efi
sudo rm refind-bin-0.14.2.zip sudo rm refind-bin-0.14.2.zip
sudo cp refind-bin-0.14.2/refind/refind_x64.efi ./install/EFI/BOOT/BOOTX64.EFI sudo cp refind-bin-0.14.2/refind/refind_x64.efi ./install/EFI/BOOT/BOOTX64.EFI
sudo rm -rf refind-bin-0.14.2
echo -e 'timeout 0\ntextonly\ntextmode 0\nshowtools shutdown, reboot, exit\nmenuentry "Install RouterOS" {\n\tloader /linux\n\toptions "load_ramdisk=1 root=/dev/ram0 -install -hdd"\n}\ndefault_selection /EFI/BOOT/BOOTX64.EFI' \ echo -e 'timeout 0\ntextonly\ntextmode 0\nshowtools shutdown, reboot, exit\nmenuentry "Install RouterOS" {\n\tloader /linux\n\toptions "load_ramdisk=1 root=/dev/ram0 -install -hdd"\n}\ndefault_selection /EFI/BOOT/BOOTX64.EFI' \
> refind.conf > refind.conf
sudo cp refind.conf ./install/EFI/BOOT/ sudo cp refind.conf ./install/EFI/BOOT/
@ -254,31 +261,6 @@ jobs:
sudo zip install-image-$LATEST_VERSION.zip ./install-image-$LATEST_VERSION.img sudo zip install-image-$LATEST_VERSION.zip ./install-image-$LATEST_VERSION.img
sudo rm ./install-image-$LATEST_VERSION.img sudo rm ./install-image-$LATEST_VERSION.img
# - name: Get install-image-${{ env.LATEST_VERSION }}.img
# run: |
# sudo wget -nv -O install-image-$LATEST_VERSION.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/install-image-$LATEST_VERSION.zip
# sudo unzip install-image-$LATEST_VERSION.zip
# sudo rm install-image-$LATEST_VERSION.zip
# - name: Patch install-image-${{ env.LATEST_VERSION }}.img
# run: |
# sudo mkdir ./install
# sudo mount -o loop install-image-$LATEST_VERSION.img ./install
# sudo rm ./install/1.npk
# NPK_FILES=$(find ./install/*.npk)
# for file in $NPK_FILES; do
# sudo -E python3 npk.py sign $file $file
# done
# sudo cp routeros-$LATEST_VERSION.npk ./install/1.npk
# sudo cp keygen.zip ./install/
# sudo cp option-$LATEST_VERSION.npk ./install/100.npk
# sudo cp python3-$LATEST_VERSION.npk ./install/101.npk
# sudo cp linux ./install/
# sudo umount ./install
# sudo rm -rf ./install
# sudo zip install-image-$LATEST_VERSION.zip ./install-image-$LATEST_VERSION.img
# sudo rm ./install-image-$LATEST_VERSION.img
- name: Delete Release tag ${{ env.LATEST_VERSION }} - name: Delete Release tag ${{ env.LATEST_VERSION }}
run: | run: |
HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}" HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}"