#! /bin/bash ### BEGIN INIT INFO # Provides: armhwinfo # Required-Start: # Required-Stop: glibc # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Get some info about hardware for some ARM single board computers and set some basic things ### END INIT INFO TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX) trap "rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15 dmesg >"${TMPFILE}" SERVER_IP=$(hostname -I) CORES=$(grep -c ^processor /proc/cpuinfo) MEMTOTAL=$(( $(awk -F" " '/^MemTotal/ {print $2}' /sys/block/$i/queue/scheduler; echo -e "[\e[0;32m ok \x1B[0m] Setting cfg I/O scheduler for $i" # solid state drives elif [ "$ROTATE" = 0 ]; then echo noop > /sys/block/$i/queue/scheduler; echo -e "[\e[0;32m ok \x1B[0m] Setting noop I/O scheduler for $i" fi done if [ "$ARCH" = "armv7l" ]; then if [ $HARDWARE = "ODROID-XU3" ]; then ID="Odroid XU4" fi if [ $HARDWARE = "Marvell" ]; then ID="Clearfog" fi if [ $HARDWARE = "gs705a" ]; then ID="Guitar" fi if [ $HARDWARE = "sun8i" ]; then ID="Orange H3" if [ "$TERMINUS" != "" ]; then ID="Orange Pi+" if [ $MEMTOTAL -gt 1500 ]; then ID="Orange Pi+ 2" fi # redistribute USB irqs to dedicated cores echo 2 >/proc/irq/$(awk -F":" '/usb2/ {print $1}' /proc/irq/$(awk -F":" '/usb3/ {print $1}' /proc/irq/$(awk -F":" '/gmac0/ {print $1}' /proc/irq/$(awk -F":" '/usb2/ {print $1}' /proc/irq/$(awk -F":" '/usb3/ {print $1}' /proc/irq/$(awk -F":" '/usb4/ {print $1}' /proc/irq/$(awk -F":" '/eth0/ {print $1}' > /var/run/machine.id ;; stop|reload|restart|force-reload|status) echo -e "[\e[0;32m ok \x1B[0m] Stopping ARM hardware info ..." ;; *) exit 1 ;; esac