Compare commits

...

10 Commits

Author SHA1 Message Date
elseif
c756852094 modified: chr.sh 2026-07-09 12:37:54 +08:00
elseif
b7ee8aaa1a modified: chr.sh 2026-07-09 12:33:14 +08:00
elseif
1a5647bd98 modified: chr.sh 2026-07-09 12:31:45 +08:00
elseif
60709c4fd6 modified: README.md
modified:   README_EN.md
	modified:   README_PT.md
	deleted:    image/chr.png
	deleted:    image/x86.png
2026-07-09 12:28:10 +08:00
elseif
91f4eed086 modified: chr.sh 2026-07-09 11:59:57 +08:00
elseif
497ed531f3 modified: chr.sh 2026-07-09 11:45:01 +08:00
elseif
3bde30196c modified: chr.sh 2026-07-09 11:39:52 +08:00
elseif
8991f41f0b modified: chr.sh 2026-07-09 11:37:47 +08:00
elseif
dc20f46a94 modified: chr.sh 2026-07-09 11:33:26 +08:00
elseif
447f7990ae modified: chr.sh 2026-07-09 11:19:43 +08:00
6 changed files with 28 additions and 41 deletions

View File

@ -39,30 +39,23 @@ graph TD
![](image/install.png)
![](image/routeros.png)
### x86模式授权许可
![](image/x86.png)
### x86模式在线授权(v6.x)
![](image/renew_v6.png)
### Chr模式在线授权
![](image/renew.png)
### Chr模式授权许可
![](image/chr.png)
![](image/arm.png)
![](image/mips.png)
## 如何使用Shell
安装 option-{version}.npk 包
telnet到RouterOS,用户名devel,密码与admin的密码相同
要使用devel用户名登录必须安装option-{version}.npk包且启用。
在终端执行 /sh 进入shell
## 如何授权许可
进入shell
运行 keygen
参考上图。
安装 option-{version}.npk 包后,重启设备,会自动激活授权许可
Chr镜像支持在线授权许可
## 如何使用Python
安装 python3-{version}.npk 包
telnet到RouterOS,用户名devel,密码与admin的密码相同
在终端执行 /sh 进入shell
运行 python -V
### npk.py
对npk文件进行解包修改创建签名和验证

View File

@ -22,28 +22,23 @@ By proceeding, you acknowledge that:
![](image/install.png)
![](image/routeros.png)
### license RouterOS for x86.
![](image/x86.png)
### Renew license for x86 v6.x
![](image/renew_v6.png)
### Renew license for chr
![](image/renew.png)
### license RouterOS for chr
![](image/chr.png)
![](image/arm.png)
![](image/mips.png)
## How to use shell
install option-{version}.npk package
run telnet to routeros with username devel and password is same as admin
Enter the shell by executing /sh in the terminal.
## How to license RouterOS
telnet to routeros with username devel and password is same as admin
run keygen
chr mode could use renew lincense online
After installing the option-{version}.npk package, reboot the device. The license will be activated automatically.
CHR images support online license activation
## How to use python3
install python3-{version}.npk package
run telnet to routeros with username devel and password is same as admin
Enter the shell by executing /sh in the terminal.
run python -V
### npk.py
SignVerifyCreate, Extract npk file.

View File

@ -15,17 +15,12 @@
![](image/install.png)
![](image/routeros.png)
### Licenciar o RouterOS para x86
![](image/x86.png)
### Renovar a licença para x86 v6.x
![](image/renew_v6.png)
### Renovar a licença para CHR
![](image/renew.png)
### Licenciar o RouterOS para CHR
![](image/chr.png)
![](image/arm.png)
![](image/mips.png)
@ -33,20 +28,19 @@
## Como usar o shell
```bash
instale o pacote option-{versão}.npk
acesse via telnet o routeros com o usuário devel e a senha igual a do usuário admin
Execute `/sh` no terminal para entrar no Shell.
```
## Como licenciar o RouterOS
```bash
acesse via telnet o routeros com o usuário devel e a senha igual a do admin
execute o keygen
modo CHR pode usar a renovação de licença online
Após instalar o pacote `option-{version}.npk`, reinicie o dispositivo. A licença será ativada automaticamente.
Imagens CHR suportam ativação de licença online.
```
## Como usar o Python 3
```bash
instale o pacote python3-{versão}.npk
acesse via telnet o routeros com o usuário devel e a senha igual a do admin
Execute `/sh` no terminal para entrar no Shell.
execute `python -V`
```
@ -59,7 +53,12 @@ Assina, verifica, cria e extrai arquivos .npk
```bash
Altera a chave pública e assina arquivos .npk
```
### Como ativar o modo container sem reiniciar fisicamente
```bash
1. Instale o pacote `option.npk`.
2. Abra o terminal e execute: `system/device-mode/update container=yes`
3. Abra um novo terminal e execute: `system/shell cmd="reboot -f"`
```
## Thanks for sponsoring
[ZMTO](https://console.zmto.com/)

22
chr.sh
View File

@ -138,17 +138,14 @@ show_system_info() {
echo "$MSG_BOOTMODE $BOOT_MODE"
}
confirm_storge() {
if command -v lsblk >/dev/null 2>&1; then
STORAGE=$(lsblk -d -n -o NAME,TYPE | awk '$2=="disk"{print $1; exit}')
else
STORAGE=$(fdisk -l | awk '/^Disk \/dev/ {print $2; exit}' | sed 's#:##' | sed 's#/dev/##')
fi
confirm_storage() {
STORAGE=$(lsblk | grep disk | head -1 | awk '{print $1}')
ask_until "$MSG_STORAGE_DEVICE" "$STORAGE"
STORAGE=$resp
}
confirm_address() {
ETH=$(ip route show default | grep '^default' | sed -n 's/.* dev \([^\ ]*\) .*/\1/p')
MAC=$(cat /sys/class/net/$ETH/address | tr 'a-z' 'A-Z')
ADDRESS=$(ip addr show $ETH | grep global | cut -d' ' -f 6 | head -n 1)
GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
if [ -f "/etc/resolv.conf" ]; then
@ -291,22 +288,24 @@ download_image(){
}
create_autorun() {
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
LOOP=$(losetup -f)
if losetup -P "$LOOP" chr.img; then
sleep 1
MNT=/tmp/chr
mkdir -p $MNT
PARTITION=$([ "$V7" == 1 ] && echo "p2" || echo "p1")
if mount "${LOOP}${PARTITION}" "$MNT" 2>/dev/null; then
if mount "${LOOP}${PARTITION}" "$MNT"; then
confirm_address
RANDOM_ADMIN_PASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 16)
RANDOM_ADMIN_PASS=$(head -c 512 /dev/urandom | tr -dc 'A-HJ-KMNP-Za-hj-kmnp-z2-9' | head -c 16)
ask_until "$MSG_ADMIN_PASSWORD" "$RANDOM_ADMIN_PASS"
RANDOM_ADMIN_PASS=$resp
cat <<EOF > "$MNT/rw/autorun.scr"
/user set admin password="$RANDOM_ADMIN_PASS"
/ip dns set servers=$DNS
/ip address add address=$ADDRESS interface=ether1
/ip address add address=$ADDRESS interface=[/interface ethernet get [find mac-address=$MAC] name]
/ip route add gateway=$GATEWAY
EOF
cat "$MNT/rw/autorun.scr"
echo "$MSG_AUTO_RUN_FILE_CREATED"
umount $MNT
losetup -d "$LOOP"
@ -323,13 +322,14 @@ EOF
write_and_reboot() {
confirm_storge
confirm_storage
printf "$MSG_WARNING\n" "$STORAGE"
ask_yesno "$MSG_CONFIRM_CONTINUE"
if [ $? -ne 0 ]; then
echo "$MSG_OPERATION_ABORTED"
exit 1
fi
sync
dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync
echo "$MSG_REBOOTING"
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB