Skip to content

Instantly share code, notes, and snippets.

@Zobber
Created August 15, 2022 22:01
Show Gist options
  • Select an option

  • Save Zobber/24c8bdf1ac8f4f71edf35821a6c25847 to your computer and use it in GitHub Desktop.

Select an option

Save Zobber/24c8bdf1ac8f4f71edf35821a6c25847 to your computer and use it in GitHub Desktop.

Revisions

  1. Zobber created this gist Aug 15, 2022.
    12 changes: 12 additions & 0 deletions chr_mk.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    wget https://download.mikrotik.com/routeros/6.36.3/chr-6.36.3.img.zip -O chr.img.zip
    gunzip -c chr.img.zip > chr.img
    mount -o loop,offset=33554944 chr.img /mnt
    ADDRESS=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1`
    GATEWAY=`ip route list | grep default | cut -d' ' -f 3`
    echo "/ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1]
    /ip route add gateway=$GATEWAY
    " > /mnt/rw/autorun.scr
    umount /mnt
    echo u > /proc/sysrq-trigger
    dd if=chr.img bs=1024 of=/dev/vda
    reboot