Update chr.sh

Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
elseif 2025-08-27 16:12:13 +08:00 committed by GitHub
parent 36be15859e
commit 110cda779c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

3
chr.sh
View file

@ -51,6 +51,7 @@ else
fi
cd /tmp
unzip -p chr.img.zip > chr.img
RANDOM_PASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 12)
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
sleep 3
MNT=/tmp/chr
@ -60,8 +61,10 @@ if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
/ip address add address=$ADDRESS interface=ether1
/ip route add gateway=$GATEWAY
/ip dns set servers=$DNS
/user set admin password="$RANDOM_PASS"
EOF
echo "autorun.scr file created."
echo -e "admin password: \e[31m$RANDOM_PASS\e[0m"
umount $MNT
else
echo "Failed to mount partition 2, skipping autorun.scr creation."