Saturday, February 22, 2020

Install Mikrotik CHR from Ubuntu

#!/bin/bash
#
# SP8-CHR-2-DO run on Ubuntu 16.04.6
# Replace password in RMDPWD
#
apt-get update ; apt install -y qemu-utils pv screen ; modprobe nbd ; mkdir /mtksrc ;
screen ;
wget https://download.mikrotik.com/routeros/6.46.4/chr-6.46.4.img.zip -O CHR_SRC.zip
gunzip -c CHR_SRC.zip > CHR.img
qemu-img convert CHR.img -O qcow2 CHRS.qcow2
# Resize to 10G, please check your existing.
qemu-img resize CHRS.qcow2 10737418240
echo "Exporting disk image"
qemu-nbd -c /dev/nbd0  CHRS.qcow2
sleep 5
partprobe /dev/nbd0 ; mount /dev/nbd0p1 /mtksrc
#
IPADDR=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1`
GW=`ip route list | grep default | cut -d' ' -f 3`
RMDPWD="My-Password"
echo "/ip address add address=$IPADDR interface=[/interface ethernet find where name=ether1]
/ip route add gateway=$GW
/ip service disable telnet
/user set 0 name=root password=$RMDPWD
/ip dns set servers=1.1.1.1,8.8.8.8
/system package update install
 " > /mtksrc/rw/autorun.scr
umount /mtksrc
e2fsck -f -y /dev/nbd0p1 || true
resize2fs /dev/nbd0p1
sleep 1
echo "Image to GZip"
mount -t tmpfs tmpfs /mtksrc
pv /dev/nbd0 | gzip > /mtksrc/SP-CHR.gz
sleep 2
echo "Default password is : $PASSWORD"
echo "or try admin with no password"
sleep 1
echo u > /proc/sysrq-trigger
echo "Writing image, to target disk"
zcat /mtksrc/SP-CHR.gz | pv > /dev/vda
sleep 5
shutdown -r now
#Done

40 Hadist Seputar Keluarga Samawa (Bagian 3)

 ﷽ Ustadz Yusuf Abu Ubaidah As-Sidawi hafizahullohuta'ala Masjid Al-Aziz  Jl. Soekarno Hatta No. 662 Bandung Hadist 11 : Doa Orangtua Bu...