-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathchr-DO-centos8.sh
executable file
·27 lines (27 loc) · 1.04 KB
/
chr-DO-centos8.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#########################################################
## Script for replacing CentOS 8 to CHR on DigitalOcean
#########################################################
curl http://download2.mikrotik.com/routeros/6.40.9/chr-6.40.9.img.zip --output 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
/ip dns set servers=9.9.9.9
/ip dhcp-client set disabled=yes numbers=0
/ip service disable telnet
/ip service disable ftp
/ip service disable www
/ip service disable api
/ip service disable api-ssl
/user set 0 password=password
/system package update install
" > /mnt/rw/autorun.scr && \
umount /mnt && \
sleep 5 && \
echo u > /proc/sysrq-trigger && \
sleep 5 && \
dd if=chr.img bs=1024 of=/dev/vda && \
echo s > /proc/sysrq-trigger