Bump to next branch

Host: Ubuntu 21.04
This commit is contained in:
orangepi-xunlong
2022-03-07 16:26:01 +08:00
parent 812e231da2
commit 206214916c
615 changed files with 61837 additions and 2426 deletions

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env bash
# With offloading enabled, Samba becomes completely useless - transfers to a Windows PC freezes randomly
# Disabling offloading should solve this - all RK3399
IFACE=$1
EVENT=$2
if [[ "$EVENT" != "up" ]]; then
exit 1
fi
if linux-version compare $(uname -r | cut -d '.' -f1,2) gt 4.4; then
exit 1
fi
ETHTOOL=/sbin/ethtool
[ -f $ETHTOOL ] || exit 2
[ -d /sys/devices/platform/fe300000.ethernet/net/$IFACE ] || exit 3
$ETHTOOL -K $IFACE rx off tx off
exit 0

View File

@@ -1,2 +1,3 @@
Acquire::GzipIndexes "true";
Acquire::CompressionTypes::Order:: "gz";
APT::Compressor::gzip::Cost "10";

View File

@@ -19,4 +19,5 @@ APT::Periodic::AutocleanInterval "120";
// Define basic patterns
Unattended-Upgrade::Origins-Pattern {
"origin=${distro_id},codename=${distro_codename}";
"origin=OrangePi";
};

View File

@@ -1,2 +1,4 @@
#!/bin/sh
# Only run on systems where logrotate is a cron job
systemctl is-active --quiet logrotate.timer && exit 0
/usr/lib/orangepi/orangepi-ramlog write >/dev/null 2>&1

View File

@@ -1,6 +1,20 @@
# add space-separated list of MOTD script names (without number) to exclude them from MOTD
# Example:
# MOTD_DISABLE="header tips updates"
# ONE_WIRE="yes" show 1-wire temperature sensor if attached
# PRIMARY_DIRECTION="rx" show daily traffic stats, options: "rx", "tx", "both", "off", vnstat needs to be installed
MOTD_DISABLE=""
ONE_WIRE="" # yes = show 1-wire temperature sensor if attached
ONE_WIRE=""
HIDE_IP_PATTERN="^dummy0|^lo"
PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | egrep "enp|eth" | head -1)"
PRIMARY_DIRECTION="rx"
STORAGE=/dev/sda1
# Temperature offset in Celcius degrees
CPU_TEMP_OFFSET=0
# Define where red color is used
CPU_TEMP_LIMIT=60
HDD_TEMP_LIMIT=60
AMB_TEMP_LIMIT=40

View File

@@ -1,7 +1,7 @@
# configuration values for the orangepi-ram-logging service
#
# enable the orangepi-ram-logging service?
ENABLED=true
ENABLED=false
#
# size of the tmpfs mount -- please keep in mind to adjust /etc/default/orangepi-zram-config too when increasing
SIZE=50M
@@ -10,3 +10,15 @@ SIZE=50M
# requires rsync installed, may provide better performance
# due to copying only new and changed files
USE_RSYNC=true
# If USE_RSYNC is true, additional options may be specified for the rsync
# commands used to synchronize logs to disk from RAM (XTRA_RSYNC_TO) or from
# disk to RAM (XTRA_RSYNC_FROM). These are bash arrays to make specifying
# multiple arguments easy even in the presence of whitespace.
XTRA_RSYNC_TO=(
## If you use log rotation programs that datestamp their logs (e.g., runit's
## svlogd or daemontools' multilog), deleting log files while synchronizing is
## likely a good idea.
# --delete
)
XTRA_RSYNC_FROM=()

View File

@@ -1,7 +1,10 @@
# configuration values for the orangepi-zram-config service
#
# enable the orangepi-zram-config service?
ENABLED=true
ENABLED=false
# Zram swap enabled by default, unless set to disabled
# SWAP=false
# percentage of zram used as swap compared to physically available DRAM.
# Huge overcommitment (300) is possible and sometimes desirable. See
@@ -28,6 +31,9 @@ ENABLED=true
# Which algorithm to choose for zram based /tmp
# TMP_ALGORITHM=zstd
# Size for zram based /tmp, total memory / 2 by default
# TMP_SIZE=500M
# If defined a separate partition will be used as zram backing device. Be CAREFUL
# which partition you assign and read starting from CONFIG_ZRAM_WRITEBACK in
# https://www.kernel.org/doc/Documentation/blockdev/zram.txt

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Copy splash file to initrd
#
mkdir -p "${DESTDIR}"/lib/firmware
splashfile=/lib/firmware/bootsplash.orangepi
if [ -f "${splashfile}" ]; then
cp "${splashfile}" "${DESTDIR}"/lib/firmware
fi
exit 0

View File

@@ -7,5 +7,4 @@ tempname="/boot/uInitrd-$1"
mkimage -A $INITRD_ARCH -O linux -T ramdisk -C gzip -n uInitrd -d $2 $tempname > /dev/null
ln -sf $(basename $tempname) /boot/uInitrd > /dev/null 2>&1 || mv $tempname /boot/uInitrd
exit 0

View File

@@ -0,0 +1 @@
options 8189fs rtw_power_mgnt=0 rtw_enusbss=0

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
@@ -8,8 +8,17 @@
# only do this for interactive shells
if [ "$-" != "${-#*i}" ]; then
printf "\n"
OutstandingPackages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs 2>/dev/null)"
if [ -f "/var/run/.reboot_required" ]; then
printf "[\e[0;91m Kernel was updated, please reboot\x1B[0m ]\n\n"
printf "\n[\e[0;91m Kernel was updated, please reboot\x1B[0m ]\n\n"
elif [ "X${OutstandingPackages}" != "X" ]; then
# No kernel update involved, just regular packages like e.g. dbus require a reboot
Packages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs | sort | uniq | tr '\n' ',' | sed -e 's/,/, /g' -e 's/,\ $//')"
OlderThanOneDay=$(find /var/run/reboot-required -mtime +1)
if [ "X${OlderThanOneDay}" = "X" ]; then
printf "\n[\e[0;92m some packages require a reboot (${Packages})\x1B[0m ]\n\n"
else
printf "\n[\e[0;91m some packages require a reboot since more than 1 day (${Packages})\x1B[0m ]\n\n"
fi
fi
fi

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any

View File

@@ -20,10 +20,10 @@ update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=AllCPUs Memory Swap CpuTemp
left_meter_modes=1 1 1 2
right_meters=OrangePiversion Hostname Tasks LoadAverage Uptime CpuFreq Eth0 Eth0stat
right_meter_modes=2 2 2 2 2 2 2 2
left_meters=AllCPUs Memory Swap CpuFreq CpuTemp
left_meter_modes=1 1 1 2 2
right_meters=OSversion Hostname Tasks LoadAverage Uptime
right_meter_modes=2 2 2 2 2
# SBC hardware and Kernel specific path.
# Editable manually.
BoardName=

View File

@@ -0,0 +1,42 @@
# This is used to change the default configuration of Realtek USB ethernet adapters
ACTION!="add", GOTO="usb_realtek_net_end"
SUBSYSTEM!="usb", GOTO="usb_realtek_net_end"
ENV{DEVTYPE}!="usb_device", GOTO="usb_realtek_net_end"
# Modify this to change the default value
ENV{REALTEK_NIC_MODE}="1"
# Realtek
ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="0bda", ATTR{idProduct}=="8155", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="0bda", ATTR{idProduct}=="8153", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="0bda", ATTR{idProduct}=="8152", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
# Samsung
ATTR{idVendor}=="04e8", ATTR{idProduct}=="a101", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
# Lenovo
ATTR{idVendor}=="17ef", ATTR{idProduct}=="304f", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="3052", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="3054", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="3057", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="3082", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="7205", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="720a", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="720b", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="720c", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="721e", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="a359", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
ATTR{idVendor}=="17ef", ATTR{idProduct}=="a387", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
# TP-LINK
ATTR{idVendor}=="2357", ATTR{idProduct}=="0601", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
# Nvidia
ATTR{idVendor}=="0955", ATTR{idProduct}=="09ff", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
# LINKSYS
ATTR{idVendor}=="13b1", ATTR{idProduct}=="0041", ATTR{bConfigurationValue}!="$env{REALTEK_NIC_MODE}", ATTR{bConfigurationValue}="$env{REALTEK_NIC_MODE}"
LABEL="usb_realtek_net_end"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
@@ -23,4 +23,4 @@ done
KERNELID=$(uname -r)
TERM=linux toilet -f standard -F metal $(echo $BOARD_NAME | sed 's/Orange Pi/OPi/')
echo -e "Welcome to \e[0;91mOrange Pi \x1B[0m$(if [[ $ID == debian ]]; then echo ${PRETTY_NAME##*\(} | sed -e 's/^.*Linux //' | sed "s/\/.*//" | sed 's|)||'; else echo -n ${VERSION_CODENAME^};fi) with \e[0;91mLinux $KERNELID\x1B[0m\n"
echo -e "Welcome to \e[0;91mOrange Pi ${VERSION} ${DISTRIBUTION_CODENAME^}\x1B[0m with $([[ $BRANCH == edge ]] && echo -e "\e[0;91mbleeding\x1B[0m edge " )\e[0;91mLinux $KERNELID\x1B[0m\n"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
@@ -11,13 +11,19 @@
# generate system information
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
THIS_SCRIPT="sysinfo"
MOTD_DISABLE=""
STORAGE=/dev/sda1
SHOW_IP_PATTERN="^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*"
CPU_TEMP_LIMIT=45
# don't change default values - they are lost on upgrades. Use /etc/default/orangepi-motd for your values
MOTD_DISABLE=""
PRIMARY_INTERFACE="eth0"
PRIMARY_DIRECTION="rx"
STORAGE=/dev/sda1
HIDE_IP_PATTERN="^dummy0|^lo"
CPU_TEMP_LIMIT=60
# Temperature offset in Celcius degrees
CPU_TEMP_OFFSET=0
HDD_TEMP_LIMIT=60
AMB_TEMP_LIMIT=40
[[ -f /etc/default/orangepi-motd ]] && . /etc/default/orangepi-motd
@@ -33,10 +39,10 @@ function display() {
# battery red color is opposite, lower number
if [[ "$1" == "Battery" ]]; then local great="<"; else local great=">"; fi
if [[ -n "$2" && "$2" > "0" && (( "${2%.*}" -ge "$4" )) ]]; then
printf "%-14s%s" "$1:"
printf "%-14s" "$1:"
if awk "BEGIN{exit ! ($2 $great $3)}"; then echo -ne "\e[0;91m $2"; else echo -ne "\e[0;92m $2"; fi
printf "%-1s%s\x1B[0m" "$5"
printf "%-11s%s\t" "$6"
printf "%-1s\x1B[0m" "$5"
printf "%-11s\t" "$6"
return 1
fi
} # display
@@ -54,6 +60,8 @@ function getboardtemp() {
# fallback to PMIC temperature
board_temp=$(awk '{printf("%d",$1/1000)}' </etc/orangepimonitor/datasources/pmictemp)
fi
# Some boards, such as the Orange Pi Zero LTS, report shifted CPU temperatures
board_temp=$((board_temp + CPU_TEMP_OFFSET))
} # getboardtemp
function batteryinfo() {
@@ -79,8 +87,8 @@ function batteryinfo() {
read status_battery_connected < $legacy_dir/axp20x-battery/present
if [[ "$status_battery_connected" == "1" ]]; then
status_battery_text=" "$(awk '{print tolower($0)}' < $legacy_dir/axp20x-battery/status)
read status_ac_connect < $legacy_dir/axp813-ac/present
read battery_percent< $legacy_dir/axp20x-battery/capacity
read status_ac_connect < $legacy_dir/axp813-ac/present
read battery_percent< $legacy_dir/axp20x-battery/capacity
fi
elif [[ -e "$legacy_dir/battery" ]]; then
if [[ (("$(cat $legacy_dir/battery/voltage_now)" -gt "5" )) ]]; then
@@ -98,10 +106,9 @@ function ambienttemp() {
amb_temp=$(awk '{printf("%d",$1/1000)}' <<<${raw_temp})
echo $amb_temp
elif [[ -d $W1_DIR && $ONE_WIRE == yes ]]; then
device=$(ls -1 $W1_DIR | grep -Eo '^[0-9]{1,4}' | head -1)
device=$(ls -1 $W1_DIR | grep -E '^[0-9]{1,4}' | head -1)
if [[ -n $device ]]; then
if [[ -d ${W1_DIR}${device}/hwmon/hwmon0 ]]; then hwmon=0; else hwmon=1; fi
read raw_temp < ${W1_DIR}${device}/hwmon/hwmon${hwmon}/temp1_input 2>/dev/null
read raw_temp < ${W1_DIR}${device}/hwmon/$(ls -1 ${W1_DIR}${device}/hwmon)/temp1_input 2>/dev/null
amb_temp=$(awk '{printf("%d",$1/1000)}' <<<${raw_temp})
echo $amb_temp
fi
@@ -123,20 +130,15 @@ function ambienttemp() {
fi
} # ambienttemp
#function get_ip_addresses() {
# # return up to 2 IPv4 address(es) comma separated
# hostname -I | tr " " "\n" | \
# grep -E "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" | \
# tail -n2 | sed ':a;N;$!ba;s/\n/,/g'
#} # get_ip_addresses
function get_ip_addresses() {
local ips=()
for f in /sys/class/net/*; do
local intf=$(basename $f)
# match only interface names starting with e (Ethernet), br (bridge), w (wireless), r (some Ralink drivers use ra<number> format)
if [[ $intf =~ $SHOW_IP_PATTERN ]]; then
local tmp=$(ip -4 addr show dev $intf | awk '/inet/ {print $2}' | cut -d'/' -f1)
# match only interface names "dummy0" and "lo"
if [[ $intf =~ $HIDE_IP_PATTERN ]]; then
continue
else
local tmp=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | cut -d'/' -f1)
# add both name and IP - can be informative but becomes ugly with long persistent/predictable device names
#[[ -n $tmp ]] && ips+=("$intf: $tmp")
# add IP only
@@ -155,9 +157,15 @@ function storage_info() {
if [[ -n "${StorageInfo}" && ${RootInfo} != *$STORAGE* ]]; then
storage_usage=$(awk '/\// {print $(NF-1)}' <<<${StorageInfo} | sed 's/%//g')
storage_total=$(awk '/\// {print $(NF-4)}' <<<${StorageInfo})
if [[ -n "$(command -v smartctl)" ]]; then
DISK="${STORAGE::-1}"
storage_temp+=$(smartctl -l scttempsts $DISK 2> /dev/null | grep -i 'Current Temperature:' | awk '{print $(NF-1)}')
fi
fi
} # storage_info
# query various systems and send some stuff to the background for overall faster execution.
# Works only with ambienttemp and batteryinfo since A20 is slow enough :)
amb_temp=$(ambienttemp &)
@@ -165,7 +173,7 @@ ip_address=$(get_ip_addresses &)
batteryinfo
storage_info
getboardtemp
critical_load=$(( 1 + $(grep -c processor /proc/cpuinfo) / 2 ))
critical_load=80
# get uptime, logged in users and load in one take
UPTIME=$(LC_ALL=C uptime)
@@ -175,33 +183,102 @@ users=${UPT2//*','}
users=${users//' '}
time=${UPT2%','*}
time=${time//','}
time=$(echo $time | xargs)
load=${UPTIME#*'load average: '}
load=${load//','}
load=$(echo $load | cut -d" " -f1)
[[ $load == 0.0* ]] && load=0.10
cpucount=$(grep -c processor /proc/cpuinfo)
load=$(awk '{printf("%.0f",($1/$2) * 100)}' <<< "$load $cpucount")
# memory and swap
mem_info=$(LC_ALL=C free -w 2>/dev/null | grep "^Mem" || LC_ALL=C free | grep "^Mem")
memory_usage=$(awk '{printf("%.0f",(($2-($4+$6+$7))/$2) * 100)}' <<<${mem_info})
memory_total=$(awk '{printf("%d",$2/1024)}' <<<${mem_info})
mem_info=$(echo $mem_info | awk '{print $2}')
memory_total=$(( mem_info / 1024 ))
swap_info=$(LC_ALL=C free -m | grep "^Swap")
swap_usage=$( (awk '/Swap/ { printf("%3.0f", $3/$2*100) }' <<<${swap_info} 2>/dev/null || echo 0) | tr -c -d '[:digit:]')
swap_total=$(awk '{print $(2)}' <<<${swap_info})
# display info
display "System load" "${load%% *}" "${critical_load}" "0" "" "${load#* }"
printf "Up time: \x1B[92m%s\x1B[0m\t\t" "$time"
display "System load" "${load%% *}" "${critical_load}" "0" "%" ""
printf "Up time: \x1B[92m%s\x1B[0m\t" "$time"
display "Local users" "${users##* }" "3" "2" ""
echo "" # fixed newline
display "Memory usage" "$memory_usage" "70" "0" " %" " of ${memory_total}MB"
display "Zram usage" "$swap_usage" "75" "0" " %" " of $swap_total""Mb"
printf "IP: "
if [[ ${memory_total} -gt 1000 ]]; then
memory_total=$(awk '{printf("%.2f",$1/1024)}' <<<${memory_total})"G"
else
memory_total+="M"
fi
if [[ ${swap_total} -gt 500 ]]; then
swap_total=$(awk '{printf("%.2f",$1/1024)}' <<<${swap_total})"G"
else
swap_total+="M"
fi
display "Memory usage" "$memory_usage" "70" "0" "%" " of ${memory_total}"
display "Zram usage" "$swap_usage" "75" "0" "%" " of ${swap_total}"
printf "IP: "
printf "\x1B[92m%s\x1B[0m" "$ip_address"
echo "" # fixed newline
a=0;b=0;c=0
display "CPU temp" "$board_temp" $CPU_TEMP_LIMIT "0" "°C" "" ; a=$?
display "Ambient temp" "$amb_temp" $AMB_TEMP_LIMIT "0" "°C" "" ; b=$?
(( ($a+$b) >0 )) && echo "" # new line only if some value is displayed
display "CPU temp" "$board_temp" $CPU_TEMP_LIMIT "0" "°C" ""
display "Ambient temp" "$amb_temp" $AMB_TEMP_LIMIT "0" "°C" ""
display "Usage of /" "$root_usage" "90" "1" "%" " of $root_total"
display "storage/" "$storage_usage" "90" "1" "%" " of $storage_total"
display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text"
echo ""
echo "" # fixed newline
a=0
display "storage/" "$storage_usage" "90" "1" "%" " of $storage_total" ; a=$((a+$?))
display "storage temp" "$storage_temp" $HDD_TEMP_LIMIT "0" "°C" "" ; a=$((a+$?))
display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text" ; a=$((a+$?))
(( $a > 0 )) && echo "" # new line only if some value is displayed
# Check whether PRIMARY_INTERFACE exist in /var/lib/vnstat/
PRIMARY_INTERFACE=$(comm -12 <(ls -1 /var/lib/vnstat/ 2> /dev/null) <(echo "$PRIMARY_INTERFACE" | sed 's/+/\n/g') | sed -n -e 'H;${x;s/\n/+/g;s/^+//;p;}')
line=0
if [[ $(command -v vnstat) && -n $PRIMARY_INTERFACE ]]; then
traffic=$(vnstat -i $PRIMARY_INTERFACE --oneline | cut -d";" -f4,5)
traffic_rx=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/')
traffic_tx=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/')
[[ "$traffic" == *"Not enough"* ]] && { traffic_tx="n/a "; traffic_rx="n/a "; }
case $PRIMARY_DIRECTION in
tx)
printf "TX today: \x1B[92m%s\x1B[0m \t" "$traffic_tx"
line=$((line+1))
;;
rx)
printf "RX today: \x1B[92m%s\x1B[0m \t" "$traffic_rx"
line=$((line+1))
;;
both)
printf "TX today: \x1B[92m%s\x1B[0m \t" "$traffic_tx"
printf "RX today: \x1B[92m%s\x1B[0m \t" "$traffic_rx"
line=$((line+1))
;;
*) #off or whatever
;;
esac
fi
if [[ $(command -v zpool) ]]; then
zpoolstatus="$(zpool status </dev/stdin 2>&1 )"
if [[ -n $(echo $zpoolstatus | grep 'not loaded') ]]; then
:
elif [[ -n $(echo $zpoolstatus | grep 'degraded\|OFFLINE') ]]; then
printf "ZFS pool: "
echo -ne "\e[0;91mDegraded\x1B[0m"
line=$((line+1))
elif [[ -n $(echo $zpoolstatus | grep 'no pools available') ]]; then
printf "ZFS pool: "
echo -ne "n/a"
line=$((line+1))
else
printf "ZFS pool: "
echo -ne "\e[0;92mOnline\x1B[0m"
line=$((line+1))
fi
fi
[[ $line -ne 0 ]] && echo ""
echo ""

View File

@@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# DO NOT EDIT THIS FILE but add config options to /etc/default/orangepi-motd
# any changes will be lost on board support package update
THIS_SCRIPT="tips"
MOTD_DISABLE=""
[[ -f /etc/default/orangepi-motd ]] && . /etc/default/orangepi-motd
for f in $MOTD_DISABLE; do
[[ $f == $THIS_SCRIPT ]] && exit 0
done
quotes="/etc/update-motd.d/quotes.txt"
if [[ -f $quotes ]]; then
random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1)
quote=$(sed -n -e "$random_line"p $quotes)
[[ -n $quote ]] && echo -e "\e[93mTip of the day:\e[39m $quote\n"
fi

View File

@@ -0,0 +1,29 @@
#!/bin/bash
#
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# DO NOT EDIT THIS FILE but add config options to /etc/default/orangepi-motd
# any changes will be lost on board support package update
THIS_SCRIPT="updates"
MOTD_DISABLE=""
[[ -f /etc/default/orangepi-motd ]] && . /etc/default/orangepi-motd
for f in $MOTD_DISABLE; do
[[ $f == $THIS_SCRIPT ]] && exit 0
done
NUM_UPDATES=0
[[ -f /var/cache/apt/archives/updates.number ]] && . /var/cache/apt/archives/updates.number
if [[ $NUM_UPDATES -gt 0 ]]; then
echo -e "[\e[31m $NUM_SECURITY_UPDATES security updates available, $NUM_UPDATES updates total\e[0m: \e[1mapt upgrade\e[0m ]"
echo -e "Last check: \e[92m$DATE\e[0m"
echo
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) Authors: http://www.armbian.com/authors
# Copyright (c) Authors: https://www.armbian.com/authors
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any