Skip to content

Instantly share code, notes, and snippets.

@azharimad
Created August 20, 2020 08:55
Show Gist options
  • Save azharimad/11cbe05286a5cd5b6f03ec1677394227 to your computer and use it in GitHub Desktop.
Save azharimad/11cbe05286a5cd5b6f03ec1677394227 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
chr_ver=6.45.9
chr_file=chr-$chr_ver.img
disk=/dev/vda
disk_size=$(parted $disk print | grep $disk | cut -d" " -f3)
echo "download CHR"
wget https://download.mikrotik.com/routeros/$chr_ver/$chr_file.zip && unzip $chr_file.zip && rm -f $chr_file.zip
echo "copy CHR image to $disk"
dd if=$chr_file of=$disk bs=1M
echo "resize $disk"
parted $disk resizepart 1 $disk_size
e2fsck -f -y ${disk}1
resize2fs ${disk}1
echo "check $disk"
parted $disk print
echo "done. please reboot the VM via Control Panel"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment