├── .gitignore ├── README.md └── r86s-quick-installer ├── Makefile └── src ├── r86s-10g-test.sh ├── r86s-2.5g-test.sh ├── r86s-channel-publickey.pem ├── r86s-clean-emmc.sh ├── r86s-cpu-stress.sh ├── r86s-decrypt-info.sh ├── r86s-install-os-online.sh ├── r86s-nic-test-server.sh └── r86s-write-this-to-emmc.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | *.vscode-ctags 4 | 5 | # Object files 6 | *.o 7 | *.ko 8 | *.obj 9 | *.elf 10 | 11 | # Linker output 12 | *.ilk 13 | *.map 14 | *.exp 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | 26 | # Shared objects (inc. Windows DLLs) 27 | *.dll 28 | *.so 29 | *.so.* 30 | *.dylib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | *.i*86 37 | *.x86_64 38 | *.hex 39 | 40 | # Debug files 41 | *.dSYM/ 42 | *.su 43 | *.idb 44 | *.pdb 45 | 46 | # Kernel Module Compile Results 47 | *.mod* 48 | *.cmd 49 | .tmp_versions/ 50 | modules.order 51 | Module.symvers 52 | Mkfile.old 53 | dkms.conf 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # R86S-QuickInstaller 2 | R86S System Quick Installer 3 | This repo contains script code for some factory functions 4 | And record some suggest select and suggest remove package for R86S 5 | 6 | |Item|Info| 7 | | ---- | ---- | 8 | |r86s-clean-emmc.sh|Clean all data on emmc| 9 | |r86s-write-this-to-emmc.sh|Write this system to emmc| 10 | 11 | # Need select packages 12 | 14 | - pciutils: Pci devices info 15 | - usbutils: USB devices info 16 | - fdisk 17 | - igc: Intel I225/I226 NIC Driver 18 | - mlx4: CX341/CX342 NIC Driver 19 | - gdisk: change uuid for partition 20 | - lsblk: list block size for get dd size 21 | - useradd: add user for smb 22 | - smartctl: check nvme status 23 | - coreutils-nohup 24 | - tmux: a nice terminal 25 | - iperf3: 26 | - screen: 27 | - tcpdump: 28 | - shadow-utils 29 | - procps 30 | - procps-ng-watch 31 | - uuidgen 32 | - stress 33 | - luci-app-dockerman 34 | - luci-app-qbittorrent 35 | - luci-app-openvpn 36 | - resize2fs 37 | - ncdu 38 | - kmod-mt7921e 39 | - kmod-mt7921s 40 | - kmod-mt7921u 41 | - kmod-iwlwifi 42 | - iwlwifi-firmware-ax200 43 | - iwlwifi-firmware-ax210 44 | - iwlwifi-firmware-ax201 45 | - wpa-supplicant: Fix Intel WIFI Client 46 | - hostapd: AP Support For MT7921 47 | - kmod-ath10k 48 | - odhcp6c: ipv6 dhcp client 49 | - odhcpd: ipv6 dhcp server/relay 50 | - ip6tables: ipv6 firewall 51 | # Need remove packages 52 | Remove some package to optimization compile time. 53 | - automount 54 | - autosamba 55 | - unblockmusic 56 | - luci-app-vlmcsd 57 | - luci-app-wireguard 58 | - luci-app-adbyby-plus 59 | -------------------------------------------------------------------------------- /r86s-quick-installer/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=r86s-quick-installer 4 | PKG_VERSION:=1 5 | PKG_RELEASE:=1 6 | 7 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 8 | PKG_CONFIG_DEPENDS := 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | define Package/r86s-quick-installer 13 | SECTION:=base 14 | CATEGORY:=Network 15 | DEFAULT:=y 16 | TITLE:=R86S Quick System Installer 17 | URL:=https://github.com/R86S/R86S-QuickInstaller 18 | endef 19 | 20 | define Package/r86s-quick-installer/description 21 | A System Installer for R86S MINIPC 22 | endef 23 | 24 | define Build/Prepare 25 | mkdir -p $(PKG_BUILD_DIR) 26 | $(CP) ./src/* $(PKG_BUILD_DIR) 27 | chmod +x $(PKG_BUILD_DIR)/*.sh 28 | endef 29 | 30 | define Build/Compile 31 | endef 32 | 33 | define Package/r86s-quick-installer/install 34 | $(INSTALL_DIR) $(1)/usr/sbin 35 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-clean-emmc.sh $(1)/usr/sbin/ 36 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-decrypt-info.sh $(1)/usr/sbin/ 37 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-install-os-online.sh $(1)/usr/sbin/ 38 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-write-this-to-emmc.sh $(1)/usr/sbin/ 39 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-nic-test-server.sh $(1)/usr/sbin/ 40 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-10g-test.sh $(1)/usr/sbin/ 41 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-2.5g-test.sh $(1)/usr/sbin/ 42 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-cpu-stress.sh $(1)/usr/sbin/ 43 | $(INSTALL_DIR) $(1)/etc 44 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/r86s-channel-publickey.pem $(1)/etc/ 45 | endef 46 | 47 | $(eval $(call BuildPackage,r86s-quick-installer)) 48 | -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-10g-test.sh: -------------------------------------------------------------------------------- 1 | service network stop 2 | iptables -F 3 | ifconfig eth3 192.168.66.2 netmast 255.255.255.0 4 | ifconfig eth4 192.168.67.2 netmast 255.255.255.0 5 | echo 'while : 6 | do 7 | trap "echo Exited!; exit;" SIGINT SIGTERM 8 | iperf3 -c 192.168.66.1 9 | iperf3 -c 192.168.66.1 -R 10 | done' > /tmp/1_speed.sh 11 | 12 | echo 'while : 13 | do 14 | trap "echo Exited!; exit;" SIGINT SIGTERM 15 | iperf3 -c 192.168.67.1 --port 9999 16 | iperf3 -c 192.168.67.1 --port 9999 -R 17 | done' > /tmp/2_speed.sh 18 | tmux new-session -s "test-client" -d 'sh /tmp/1_speed.sh' 19 | tmux split-window -h 20 | tmux send-keys 'sh /tmp/2_speed.sh' 21 | tmux send-keys enter 22 | #tmux -2 attach-session -d 23 | tmux split-window -v 24 | tmux send-keys 'watch -n 1 sensors' 25 | tmux send-keys enter 26 | tmux selectp -t test-client.0 27 | tmux split-window -v 28 | echo 'cat /proc/cpuinfo | grep MHz' > /tmp/check_Mhz.sh 29 | tmux send-keys 'watch -n 1 sh /tmp/check_Mhz.sh' 30 | tmux send-keys enter 31 | screen tmux -2 attach-session -d -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-2.5g-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "TEST CLIENT MODE!!" 3 | echo "Reboot for come back normal setting" 4 | sleep 1 5 | /etc/init.d/network stop 6 | ifconfig eth0 192.168.60.2 netmask 255.255.255.0 7 | ifconfig eth1 192.168.61.2 netmask 255.255.255.0 8 | ifconfig eth2 192.168.62.2 netmask 255.255.255.0 9 | iptables -F 10 | 11 | echo 'while : 12 | do 13 | trap "echo Exited!; exit;" SIGINT SIGTERM 14 | echo "LOOP TEST" 15 | iperf3 -c 192.168.61.1 16 | iperf3 -c 192.168.61.1 -R 17 | done' > /tmp/1_speed.sh 18 | 19 | echo 'while : 20 | do 21 | trap "echo Exited!; exit;" SIGINT SIGTERM 22 | echo "LOOP TEST" 23 | iperf3 -c 192.168.62.1 --port 9999 24 | iperf3 -c 192.168.62.1 --port 9999 -R 25 | done' > /tmp/2_speed.sh 26 | tmux new-session -s "test-client" -d 'sh /tmp/1_speed.sh' 27 | tmux split-window -h 28 | tmux send-keys 'sh /tmp/2_speed.sh' 29 | tmux send-keys enter 30 | #tmux -2 attach-session -d 31 | tmux split-window -v 32 | tmux send-keys 'watch -n 1 sensors' 33 | tmux send-keys enter 34 | tmux selectp -t test-client.0 35 | tmux split-window -v 36 | echo 'cat /proc/cpuinfo | grep MHz' > /tmp/check_Mhz.sh 37 | tmux send-keys 'watch -n 1 sh /tmp/check_Mhz.sh' 38 | tmux send-keys enter 39 | echo 'while : 40 | do 41 | trap "echo Exited!; exit;" SIGINT SIGTERM 42 | echo "LOOP TEST" 43 | iperf3 -c 192.168.60.1 --port 19999 44 | iperf3 -c 192.168.60.1 --port 19999 -R 45 | done' > /tmp/3_speed.sh 46 | tmux selectp -t test-client.0 47 | tmux split-window -h 48 | tmux send-keys 'sh /tmp/3_speed.sh' 49 | tmux send-keys enter 50 | screen tmux -2 attach-session -d -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-channel-publickey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkdAw0t05lKg+6FlH5bUIVKa0Z 3 | 2JlRMf19iPOvlCBlkAjdrSo5FqA1RqHY72x4b69c5je8doWzgt+6a8QPbvbyz6Kt 4 | 5/arTrINrIaKCVVfa1ztSv0FuDhF8qipM9qRQ5MVCTQYUHP+o84vJrondlriH47z 5 | AqZVJbPG13Xu64vxQwIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-clean-emmc.sh: -------------------------------------------------------------------------------- 1 | echo WARNING!!!!!! 2 | echo Will Clean All Data On EMMC!!! 3 | echo 'Enter "confirm" to contine!:' 4 | now_input="1" 5 | read now_input 6 | if [ "$now_input" != "confirm" ]; 7 | then 8 | echo "Not confirm...Cancel..." 9 | exit 10 | fi 11 | echo Will Clean All Data On EMMC!!! 12 | echo '' 13 | echo '' 14 | echo '-----------------------------------' 15 | echo 'Enter "confirm" again to contine!!:' 16 | read now_input 17 | if [ "$now_input" != "confirm" ]; 18 | then 19 | echo "Not confirm...Cancel..." 20 | exit 21 | fi 22 | echo 'Do Clean EMMC....' 23 | # flush mmcblk0 24 | ( 25 | echo p 26 | echo g 27 | echo w 28 | ) | fdisk /dev/mmcblk0 29 | 30 | echo '' 31 | echo '' 32 | echo '-----------------------------------' 33 | echo 'OK!!!' -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-cpu-stress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 创建测试用得窗口 3 | echo 'cat /proc/cpuinfo | grep MHz' > /tmp/check_Mhz.sh 4 | tmux new-session -s "test-cpu" -d 'stress -c 4' 5 | tmux split-window -h 6 | tmux send-keys 'watch -n 1 sh /tmp/check_Mhz.sh' 7 | tmux send-keys enter 8 | tmux split-window -v 9 | tmux send-keys 'watch -n 1 sensors' 10 | tmux send-keys enter 11 | screen tmux -2 attach-session -d 12 | -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-decrypt-info.sh: -------------------------------------------------------------------------------- 1 | base64 -d | openssl rsautl -verify -pubin -inkey /etc/r86s-channel-publickey.pem -in - -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-install-os-online.sh: -------------------------------------------------------------------------------- 1 | set -u 2 | wget https://r86s.net/sysdl/sys_install.en -O /tmp/sys_install.en 3 | if [ "$?" != "0" ]; 4 | then 5 | echo "ERROR:" 6 | echo "Update install script online failed!" 7 | echo "Cancel..." 8 | exit 9 | fi 10 | cat /tmp/sys_install.en | /usr/sbin/r86s-decrypt-info.sh > /tmp/sys_install.sh 11 | 12 | if [ "$?" != "0" ]; 13 | then 14 | echo "ERROR:" 15 | echo "Update install script online failed!" 16 | echo "Cancel..." 17 | exit 18 | fi 19 | echo "-------------------------" 20 | echo "Start Online Script..." 21 | echo "-------------------------" 22 | sh /tmp/sys_install.sh -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-nic-test-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "TEST SERVER MODE!!" 3 | echo "Reboot for come back normal setting" 4 | sleep 1 5 | /etc/init.d/network stop 6 | iptables -F 7 | ifconfig eth0 192.168.60.1 netmask 255.255.255.0 8 | ifconfig eth1 192.168.61.1 netmask 255.255.255.0 9 | ifconfig eth2 192.168.62.1 netmask 255.255.255.0 10 | 11 | ifconfig eth3 192.168.66.1 netmask 255.255.255.0 12 | ifconfig eth4 192.168.67.1 netmask 255.255.255.0 13 | # 创建测试用得窗口 14 | #!/bin/sh 15 | tmux new-session -s "test-server" -d 'iperf3 -s' 16 | tmux split-window -h 17 | tmux send-keys 'iperf3 -s -p 9999' 18 | tmux send-keys enter 19 | tmux split-window -v 20 | tmux send-keys 'watch -n 1 sensors' 21 | tmux send-keys enter 22 | tmux selectp -t test-server.0 23 | tmux split-window -v 24 | echo 'cat /proc/cpuinfo | grep MHz' > /tmp/check_Mhz.sh 25 | tmux send-keys 'watch -n 1 sh /tmp/check_Mhz.sh' 26 | tmux send-keys enter 27 | tmux selectp -t test-server.0 28 | tmux split-window -h 29 | tmux send-keys 'iperf3 -s -p 19999' 30 | tmux send-keys enter 31 | screen tmux -2 attach-session -d 32 | -------------------------------------------------------------------------------- /r86s-quick-installer/src/r86s-write-this-to-emmc.sh: -------------------------------------------------------------------------------- 1 | echo Write This System To R86S EMMC 2 | # get devices of boot 3 | boot_device=`mount -l | grep /boot | awk 'NR==1{print $1}' | tr -d '0-9'` 4 | boot_data_size=`lsblk | grep 'sda2' | awk 'NR==1{print $4}' | tr -d 'A-Z'` 5 | let "dd_size=$boot_data_size+50" 6 | # should not write emmc to emmc 7 | cmp_res=`echo $boot_device | grep mmcblk` 8 | if [ "$cmp_res" != "" ] 9 | then 10 | echo "------------------------------" 11 | echo "Cannot write EMMC to EMMC!!!!!" 12 | echo "------------------------------" 13 | echo "Cancel..." 14 | sleep 1 15 | exit 16 | fi 17 | 18 | echo WARNING!!!!!! 19 | echo Will Clean All Data On EMMC!!! 20 | echo 'Enter "confirm" to contine!:' 21 | now_input="1" 22 | read now_input 23 | if [ "$now_input" != "confirm" ]; 24 | then 25 | echo "Not confirm...Cancel..." 26 | exit 27 | fi 28 | echo Will Clean All Data On EMMC!!! 29 | echo '' 30 | echo '' 31 | echo '-----------------------------------' 32 | echo 'Enter "confirm" again to contine!!:' 33 | read now_input 34 | if [ "$now_input" != "confirm" ]; 35 | then 36 | echo "Not confirm...Cancel..." 37 | exit 38 | fi 39 | echo "Umount exists emmc partition" 40 | # umount exists mmc mount 41 | for a_mount in `mount -l | grep /dev/mmc | awk '{print $1}'` 42 | do 43 | umount $a_mount 44 | done 45 | # flush mmcblk0 46 | echo 'Do Clean EMMC....' 47 | ( 48 | echo p 49 | echo g 50 | echo w 51 | ) | fdisk /dev/mmcblk0 > /dev/null 52 | # write our data to emmc 53 | 54 | mkdir /mnt/data 55 | 56 | echo 'Writing Data...' 57 | 58 | echo "Write $boot_device to /dev/mmcblk0" 59 | echo "DD SIZE: $dd_size" 60 | dd if=$boot_device of=/dev/mmcblk0 bs=1M count=$dd_size oflag=direct 61 | ( 62 | echo d 63 | echo 2 64 | echo n 65 | echo '' 66 | echo '' 67 | echo '' 68 | echo '' 69 | echo w 70 | ) | fdisk /dev/mmcblk0 71 | # umount exists mmc mount 72 | sleep 3 73 | for a_mount in `mount -l | grep /dev/mmc | awk '{print $1}'` 74 | do 75 | umount $a_mount 76 | done 77 | dd if=${boot_device}2 of=/dev/mmcblk0p2 78 | e2fsck -fp /dev/mmcblk0p2 79 | resize2fs -f /dev/mmcblk0p2 80 | 81 | #new uuid 82 | new_uuid=`uuidgen` 83 | 84 | mkdir -p /tmp/r86s-temp-boot 85 | mount /dev/mmcblk0p1 /tmp/r86s-temp-boot 86 | 87 | # change disk uuid for different from usb disk 88 | sed -i "s/root=PARTUUID=.\{36\}/root=PARTUUID=$new_uuid/g" /tmp/r86s-temp-boot/boot/grub/grub.cfg 89 | umount /tmp/r86s-temp-boot 90 | 91 | ( 92 | echo "x" 93 | echo "c" 94 | echo "2" 95 | echo $new_uuid 96 | echo "w" 97 | echo "y" 98 | ) | gdisk /dev/mmcblk0 99 | 100 | echo 'Done!' 101 | sleep 1 102 | 103 | echo '' 104 | echo '' 105 | echo '-----------------------------------' 106 | echo 'OK!!!' 107 | --------------------------------------------------------------------------------