Convert all os_ variables to uppercase

This commit is contained in:
Calin Crisan 2019-01-12 13:45:30 +02:00
parent 0a8edd5a0d
commit d907029ee4
42 changed files with 113 additions and 112 deletions

View File

@ -28,7 +28,7 @@ GUARD_SIZE="10" # MB
DISK_SIZE=$((ROOT_START + ROOT_SIZE + GUARD_SIZE)) DISK_SIZE=$((ROOT_START + ROOT_SIZE + GUARD_SIZE))
COMMON_DIR=$(cd $IMG_DIR/../../../board/common; pwd) COMMON_DIR=$(cd $IMG_DIR/../../../board/common; pwd)
OS_NAME=$(source $COMMON_DIR/overlay/etc/version && echo $os_short_name) OS_NAME=$(source $COMMON_DIR/overlay/etc/version && echo $OS_SHORT_NAME)
# boot filesystem # boot filesystem
msg "creating boot loop device" msg "creating boot loop device"
@ -73,19 +73,19 @@ tar -xpsf $ROOT_SRC -C $ROOT
if [ -f $ROOT/etc/version ]; then if [ -f $ROOT/etc/version ]; then
if [ -n "$THINGOS_NAME" ]; then if [ -n "$THINGOS_NAME" ]; then
msg "setting OS name to $THINGOS_NAME" msg "setting OS name to $THINGOS_NAME"
sed -ri "s/os_name=\".*\"/os_name=\"$THINGOS_NAME\"/" $ROOT/etc/version sed -ri "s/OS_NAME=\".*\"/OS_NAME=\"$THINGOS_NAME\"/" $ROOT/etc/version
fi fi
if [ -n "$THINGOS_SHORT_NAME" ]; then if [ -n "$THINGOS_SHORT_NAME" ]; then
msg "setting OS short name to $THINGOS_SHORT_NAME" msg "setting OS short name to $THINGOS_SHORT_NAME"
sed -ri "s/os_short_name=\".*\"/os_short_name=\"$THINGOS_SHORT_NAME\"/" $ROOT/etc/version sed -ri "s/OS_SHORT_NAME=\".*\"/OS_SHORT_NAME=\"$THINGOS_SHORT_NAME\"/" $ROOT/etc/version
fi fi
if [ -n "$THINGOS_PREFIX" ]; then if [ -n "$THINGOS_PREFIX" ]; then
msg "setting OS prefix to $THINGOS_PREFIX" msg "setting OS prefix to $THINGOS_PREFIX"
sed -ri "s/os_prefix=\".*\"/os_prefix=\"$THINGOS_PREFIX\"/" $ROOT/etc/version sed -ri "s/OS_PREFIX=\".*\"/OS_PREFIX=\"$THINGOS_PREFIX\"/" $ROOT/etc/version
fi fi
if [ -n "$THINGOS_VERSION" ]; then if [ -n "$THINGOS_VERSION" ]; then
msg "setting OS version to $THINGOS_VERSION" msg "setting OS version to $THINGOS_VERSION"
sed -ri "s/os_version=\".*\"/os_version=\"$THINGOS_VERSION\"/" $ROOT/etc/version sed -ri "s/OS_VERSION=\".*\"/OS_VERSION=\"$THINGOS_VERSION\"/" $ROOT/etc/version
fi fi
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
mount_fs() { mount_fs() {
msg_begin "Mounting filesystems" msg_begin "Mounting filesystems"
@ -22,8 +22,8 @@ remount_rw() {
} }
mk_tty_login() { mk_tty_login() {
test -z "$os_tty_login" && os_tty_login=tty1 test -z "$OS_TTY_LOGIN" && OS_TTY_LOGIN=tty1
ln -sf /dev/$os_tty_login /dev/ttylogin ln -sf /dev/$OS_TTY_LOGIN /dev/ttylogin
} }
case "$1" in case "$1" in
@ -31,8 +31,8 @@ case "$1" in
mount_fs mount_fs
# we need to source conf again, now that /data is available # we need to source conf again, now that /data is available
test -n "$os_debug" || source /etc/init.d/os_conf test -n "$OS_DEBUG" || source /etc/init.d/os_conf
test "$os_debug" == "true" && remount_rw test "$OS_DEBUG" == "true" && remount_rw
mk_tty_login mk_tty_login
;; ;;

View File

@ -5,7 +5,7 @@ BOOT_MODULES_FILE="/boot/modules"
MODULES_FILE="/data/etc/modules" MODULES_FILE="/data/etc/modules"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)

View File

@ -5,7 +5,7 @@ BOOT_HOSTNAME_FILE="/boot/hostname"
HOSTNAME_FILE="/data/etc/hostname" HOSTNAME_FILE="/data/etc/hostname"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)
@ -16,7 +16,7 @@ case "$1" in
if [[ -f $HOSTNAME_FILE ]]; then if [[ -f $HOSTNAME_FILE ]]; then
hostname=$(cat $HOSTNAME_FILE) hostname=$(cat $HOSTNAME_FILE)
else else
hostname="$os_prefix-$board_sn" hostname="$OS_PREFIX-$BOARD_SN"
fi fi
/bin/hostname $hostname /bin/hostname $hostname

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
DMESG_LOG="/var/log/dmesg.log" DMESG_LOG="/var/log/dmesg.log"
@ -10,7 +10,7 @@ case "$1" in
msg_begin "Starting syslogd" msg_begin "Starting syslogd"
syslogd syslogd
test $? == 0 && msg_done || msg_fail test $? == 0 && msg_done || msg_fail
echo "---- booting $os_name $os_version ----" >> $DMESG_LOG echo "---- booting $OS_NAME $OS_VERSION ----" >> $DMESG_LOG
dmesg -T -w >> $DMESG_LOG & dmesg -T -w >> $DMESG_LOG &
;; ;;

View File

@ -5,7 +5,7 @@ CONF=/etc/udev/udev.conf
test -f $CONF || exit 0 test -f $CONF || exit 0
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
source $CONF source $CONF

View File

@ -2,7 +2,7 @@
test -c /dev/watchdog || exit 0 test -c /dev/watchdog || exit 0
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)

View File

@ -5,7 +5,7 @@ VERSION_FILE="/data/etc/version"
POST_UPGRADE_DIR="/usr/share/post-upgrade" POST_UPGRADE_DIR="/usr/share/post-upgrade"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
hash=$(md5sum $VERSION_FILE 2>/dev/null | cut -d ' ' -f 1) hash=$(md5sum $VERSION_FILE 2>/dev/null | cut -d ' ' -f 1)
sys_hash=$(md5sum $SYS_VERSION_FILE 2>/dev/null | cut -d ' ' -f 1) sys_hash=$(md5sum $SYS_VERSION_FILE 2>/dev/null | cut -d ' ' -f 1)
@ -23,8 +23,8 @@ function version_gt() {
} }
function run_post_upgrade() { function run_post_upgrade() {
version="$(source $VERSION_FILE 2>/dev/null && echo $os_version)" version="$(source $VERSION_FILE 2>/dev/null && echo $OS_VERSION)"
sys_version="$(source $SYS_VERSION_FILE 2>/dev/null && echo $os_version)" sys_version="$(source $SYS_VERSION_FILE 2>/dev/null && echo $OS_VERSION)"
versions=$(ls -1 $POST_UPGRADE_DIR | cut -d '.' -f 1) versions=$(ls -1 $POST_UPGRADE_DIR | cut -d '.' -f 1)
for v in $versions; do for v in $versions; do

View File

@ -10,7 +10,7 @@ test -f $BTCONF || test -f $BOOT_BTCONF || test -f $SYS_BTCONF || exit 0
test -x /usr/bin/dbus-daemon || exit 0 test -x /usr/bin/dbus-daemon || exit 0
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
start() { start() {
mkdir -p /tmp/dbus mkdir -p /tmp/dbus

View File

@ -13,7 +13,7 @@ link_watch=yes
link_watch_timeout=20 link_watch_timeout=20
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
test -f $CONF || exit 0 test -f $CONF || exit 0

View File

@ -13,7 +13,7 @@ BOOT_WATCH_CONF="/boot/watch.conf"
WATCH_CONF="/data/etc/watch.conf" WATCH_CONF="/data/etc/watch.conf"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $WATCH_CONF $SYS_WATCH_CONF $BOOT_WATCH_CONF prepare_conf $WATCH_CONF $SYS_WATCH_CONF $BOOT_WATCH_CONF
source $WATCH_CONF source $WATCH_CONF
@ -25,11 +25,11 @@ ssid=$(cat $CONF | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
test -n "$ssid" || exit 0 test -n "$ssid" || exit 0
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
connected() { connected() {
ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1 ip link show dev $OS_WLAN 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
} }
watch() { watch() {
@ -51,13 +51,13 @@ watch() {
} }
start() { start() {
test -n "$os_country" && iw reg set $os_country test -n "$OS_COUNTRY" && iw reg set $OS_COUNTRY
msg_begin "Starting wpa_supplicant" msg_begin "Starting wpa_supplicant"
# wait up to 5 seconds for interface # wait up to 5 seconds for interface
count=0 count=0
while ! ifconfig $os_wlan >/dev/null 2>&1; do while ! ifconfig $OS_WLAN >/dev/null 2>&1; do
sleep 1 sleep 1
count=$(($count + 1)) count=$(($count + 1))
if [[ $count -ge 5 ]]; then if [[ $count -ge 5 ]]; then
@ -66,11 +66,11 @@ start() {
fi fi
done done
module=$(basename $(readlink /sys/class/net/$os_wlan/device/driver/module 2>/dev/null) 2>/dev/null) module=$(basename $(readlink /sys/class/net/$OS_WLAN/device/driver/module 2>/dev/null) 2>/dev/null)
iwconfig $os_wlan power off &> /dev/null iwconfig $OS_WLAN power off &> /dev/null
iw $os_wlan set power_save off &> /dev/null iw $OS_WLAN set power_save off &> /dev/null
$PROG -i$os_wlan -c$CONF -D$DRIVER -B &> $LOG $PROG -i$OS_WLAN -c$CONF -D$DRIVER -B &> $LOG
count=0 count=0
while true; do while true; do
sleep 1 sleep 1

View File

@ -10,7 +10,7 @@ PROVIDER="mobile"
WATCH_CONF="/data/etc/watch.conf" WATCH_CONF="/data/etc/watch.conf"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
@ -19,11 +19,11 @@ test -e $CONF/apn || exit 0
source $WATCH_CONF source $WATCH_CONF
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
connected() { connected() {
ifconfig | grep $os_ppp &>/dev/null && return 0 || return 1 ifconfig | grep $OS_PPP &>/dev/null && return 0 || return 1
} }
watch() { watch() {

View File

@ -5,7 +5,7 @@ BOOT_CONF="/boot/bluetooth.conf"
CONF="/data/etc/bluetooth.conf" CONF="/data/etc/bluetooth.conf"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
test -f $CONF || exit 0 test -f $CONF || exit 0

View File

@ -9,7 +9,7 @@ WATCH_CONF="/data/etc/watch.conf"
LINK_NEGO_TIMEOUT=10 LINK_NEGO_TIMEOUT=10
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
source $WATCH_CONF source $WATCH_CONF
@ -23,7 +23,7 @@ watch_eth() {
count=0 count=0
while true; do while true; do
sleep 5 sleep 5
if [[ "$(cat /sys/class/net/$os_eth/operstate 2>/dev/null)" == "up" ]]; then if [[ "$(cat /sys/class/net/$OS_ETH/operstate 2>/dev/null)" == "up" ]]; then
count=0 count=0
else else
if [[ $count -lt $link_watch_timeout ]]; then if [[ $count -lt $link_watch_timeout ]]; then
@ -62,31 +62,31 @@ start_lo() {
start_wlan() { start_wlan() {
msg_begin "Configuring wireless network" msg_begin "Configuring wireless network"
if ! ifconfig $os_wlan &>/dev/null; then if ! ifconfig $OS_WLAN &>/dev/null; then
msg_fail "no device" msg_fail "no device"
return 1 return 1
fi fi
if [[ "$(cat /sys/class/net/$os_wlan/carrier 2>/dev/null)" != "1" ]]; then if [[ "$(cat /sys/class/net/$OS_WLAN/carrier 2>/dev/null)" != "1" ]]; then
msg_fail "no link" msg_fail "no link"
return 1 return 1
fi fi
if [[ -n "$mtu" ]]; then if [[ -n "$mtu" ]]; then
ip link set mtu $mtu dev $os_wlan ip link set mtu $mtu dev $OS_WLAN
fi fi
if [[ -n "$static_ip" ]]; then if [[ -n "$static_ip" ]]; then
msg_done $static_ip msg_done $static_ip
ifconfig $os_wlan $static_ip up ifconfig $OS_WLAN $static_ip up
static_ip="" # won't be used again static_ip="" # won't be used again
else else
msg_done dhcp msg_done dhcp
dhclient -cf "$DH_CONF" $os_wlan dhclient -cf "$DH_CONF" $OS_WLAN
fi fi
if [[ "$ip_watch" == "true" ]] && ip addr show dev $os_wlan | grep inet &>/dev/null; then if [[ "$ip_watch" == "true" ]] && ip addr show dev $OS_WLAN | grep inet &>/dev/null; then
watch_ip $os_wlan & watch_ip $OS_WLAN &
fi fi
} }
@ -96,7 +96,7 @@ start_eth() {
# wait for driver # wait for driver
w=3 w=3
count=0 count=0
while ! ifconfig $os_eth >/dev/null 2>&1; do while ! ifconfig $OS_ETH >/dev/null 2>&1; do
sleep 1 sleep 1
count=$(($count + 1)) count=$(($count + 1))
if [[ $count -ge $w ]]; then if [[ $count -ge $w ]]; then
@ -106,12 +106,12 @@ start_eth() {
done done
# bring it up # bring it up
ifconfig $os_eth up ifconfig $OS_ETH up
# wait for operstate # wait for operstate
w=3 w=3
count=0 count=0
while [[ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]]; do while [[ "$(cat /sys/class/net/$OS_ETH/operstate 2>&1)" == "unknown" ]]; do
sleep 1 sleep 1
count=$(($count + 1)) count=$(($count + 1))
if [[ $count -ge $w ]]; then if [[ $count -ge $w ]]; then
@ -123,7 +123,7 @@ start_eth() {
# wait for link # wait for link
test "$link_watch" == "true" || LINK_NEGO_TIMEOUT=5 test "$link_watch" == "true" || LINK_NEGO_TIMEOUT=5
count=0 count=0
while [[ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]]; do while [[ "$(cat /sys/class/net/$OS_ETH/carrier 2>&1)" != "1" ]]; do
sleep 1 sleep 1
count=$(($count + 1)) count=$(($count + 1))
if [[ $count -ge $LINK_NEGO_TIMEOUT ]]; then if [[ $count -ge $LINK_NEGO_TIMEOUT ]]; then
@ -133,24 +133,24 @@ start_eth() {
done done
if [[ -n "$mtu" ]]; then if [[ -n "$mtu" ]]; then
ip link set mtu $mtu dev $os_eth ip link set mtu $mtu dev $OS_ETH
fi fi
if [[ -n "$static_ip" ]]; then if [[ -n "$static_ip" ]]; then
msg_done $static_ip msg_done $static_ip
ifconfig $os_eth $static_ip up ifconfig $OS_ETH $static_ip up
static_ip="" # won't be used again static_ip="" # won't be used again
else else
msg_done dhcp msg_done dhcp
dhclient -cf "$DH_CONF" $os_eth dhclient -cf "$DH_CONF" $OS_ETH
fi fi
if [[ "$link_watch" == "true" ]]; then if [[ "$link_watch" == "true" ]]; then
watch_eth & watch_eth &
fi fi
if [[ "$ip_watch" == "true" ]] && ip addr show dev $os_eth | grep inet &>/dev/null; then if [[ "$ip_watch" == "true" ]] && ip addr show dev $OS_ETH | grep inet &>/dev/null; then
watch_ip $os_eth & watch_ip $OS_ETH &
fi fi
} }
@ -160,12 +160,12 @@ start() {
start_lo start_lo
test "$os_networkless" == "true" && return 0 test "$OS_NETWORKLESS" == "true" && return 0
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
test -n "$ssid" && start_wlan && wlan_ok="ok" test -n "$ssid" && start_wlan && wlan_ok="ok"
test -r /data/etc/ppp/modem && ifconfig | grep $os_ppp &>/dev/null && ppp_ok="ok" test -r /data/etc/ppp/modem && ifconfig | grep $OS_PPP &>/dev/null && ppp_ok="ok"
# if wifi or ppp link ok, start eth in background # if wifi or ppp link ok, start eth in background
if [[ "$wlan_ok" == "ok" ]] || [[ "$ppp_ok" == "ok" ]]; then if [[ "$wlan_ok" == "ok" ]] || [[ "$ppp_ok" == "ok" ]]; then

View File

@ -12,9 +12,9 @@ if [[ -z "$netwatch_host" || -z "$netwatch_port" ]]; then
exit 0 exit 0
fi fi
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
watch() { watch() {

View File

@ -5,7 +5,7 @@ BOOT_CONF="/boot/firewall.sh"
CONF="/data/etc/firewall.sh" CONF="/data/etc/firewall.sh"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
test -f $CONF || exit 0 test -f $CONF || exit 0

View File

@ -8,7 +8,7 @@ LOG="/var/log/dnsmasq.log"
PROG="/usr/sbin/dnsmasq" PROG="/usr/sbin/dnsmasq"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
test -f $CONF || exit 0 test -f $CONF || exit 0

View File

@ -12,14 +12,14 @@ BOOT_NTP_CONF="/boot/ntp.conf"
NTP_CONF="/data/etc/ntp.conf" NTP_CONF="/data/etc/ntp.conf"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
prepare_conf $CONF $SYS_CONF $BOOT_CONF prepare_conf $CONF $SYS_CONF $BOOT_CONF
prepare_conf $NTP_CONF $SYS_NTP_CONF $BOOT_NTP_CONF prepare_conf $NTP_CONF $SYS_NTP_CONF $BOOT_NTP_CONF
test -f $CONF || exit 0 test -f $CONF || exit 0
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
date_timeout=10 date_timeout=10
date_method=http date_method=http

View File

@ -3,7 +3,7 @@
SYS_CONF="/etc/crontabs" SYS_CONF="/etc/crontabs"
CONF="/data/etc/crontabs" CONF="/data/etc/crontabs"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
start() { start() {
msg_begin "Starting crond" msg_begin "Starting crond"

View File

@ -4,9 +4,9 @@ CONF="/etc/sshd_config"
test -f $CONF || exit 0 test -f $CONF || exit 0
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
start() { start() {
msg_begin "Starting sshd" msg_begin "Starting sshd"

View File

@ -5,7 +5,7 @@ USERINIT="/data/etc/userinit.sh"
test -f $USERINIT || exit 0 test -f $USERINIT || exit 0
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
msg_info() { msg_info() {
echo " # $1" echo " # $1"
@ -24,9 +24,9 @@ show_dns() {
case "$1" in case "$1" in
start) start)
show_iface_ip_addr $os_eth show_iface_ip_addr $OS_ETH
show_iface_ip_addr $os_wlan show_iface_ip_addr $OS_WLAN
show_iface_ip_addr $os_ppp show_iface_ip_addr $OS_PPP
show_gateway show_gateway
show_dns show_dns
;; ;;

View File

@ -1,9 +1,9 @@
source /etc/version source /etc/version
board_sn=$(/etc/init.d/boardsn) BOARD_SN=$(/etc/init.d/boardsn)
board_name=$(cat /etc/board) BOARD_NAME=$(cat /etc/board)
test -n "$os_debug" || source /etc/init.d/os_conf test -n "$OS_DEBUG" || source /etc/init.d/os_conf
source /etc/init.d/panic source /etc/init.d/panic

View File

@ -5,7 +5,7 @@ pid_file=/tmp/rc.pid
source /etc/init.d/base source /etc/init.d/base
echo "---- shutting down $os_name $os_version ----" >> $boot_log echo "---- shutting down $OS_NAME $OS_VERSION ----" >> $boot_log
# stop all init scripts in /etc/init.d, # stop all init scripts in /etc/init.d,
# executing them in reverse numerical order. # executing them in reverse numerical order.

View File

@ -6,7 +6,7 @@ pid_file=/tmp/rc.pid
source /etc/init.d/base source /etc/init.d/base
echo "---- booting $os_name $os_version ----" >> $tmp_boot_log echo "---- booting $OS_NAME $OS_VERSION ----" >> $tmp_boot_log
# start all init scripts in /etc/init.d, # start all init scripts in /etc/init.d,
# executing them in numerical order. # executing them in numerical order.

View File

@ -1,12 +1,13 @@
os_debug="false" OS_DEBUG="false"
os_prereleases="false" OS_PRERELEASES="false"
os_tty_login="tty1" OS_TTY_LOGIN="tty1"
os_eth="eth0" OS_ETH="eth0"
os_wlan="wlan0" OS_WLAN="wlan0"
os_ppp="ppp0" OS_PPP="ppp0"
os_networkless="false" OS_NETWORKLESS="false"
os_country="GB" OS_COUNTRY="GB"
os_firmware_method="github" OS_FIRMWARE_METHOD="github"
os_firmware_repo="ccrisan/thingos" OS_FIRMWARE_REPO="ccrisan/thingos"
os_firmware_username="" OS_FIRMWARE_USERNAME=""
os_firmware_password="" OS_FIRMWARE_PASSWORD=""

View File

@ -1,4 +1,4 @@
os_name="thingOS" OS_NAME="thingOS"
os_short_name="thingos" OS_SHORT_NAME="thingos"
os_prefix="thing" OS_PREFIX="thing"
os_version="unknown" OS_VERSION="unknown"

View File

@ -77,22 +77,22 @@ fi
#### versions #### #### versions ####
function show_versions() { function show_versions() {
source /etc/init.d/os_conf # we need this for the os_ vars source /etc/init.d/os_conf # we need this for the OS_ vars
board=$(cat $SYS_BOARD_FILE) board=$(cat $SYS_BOARD_FILE)
show_json=$1 show_json=$1
# the /usr/libexec/list-versions-* helpers return a table with the following format: # the /usr/libexec/list-versions-* helpers return a table with the following format:
# <version>|<prerelease>|<board>|<url>|<date> # <version>|<prerelease>|<board>|<url>|<date>
versions=$(FW_USERNAME=$os_firmware_username FW_PASSWORD=$os_firmware_password \ versions=$(FW_USERNAME=$OS_FIRMWARE_USERNAME FW_PASSWORD=$OS_FIRMWARE_PASSWORD \
/usr/libexec/list-versions-$os_firmware_method $os_firmware_repo) /usr/libexec/list-versions-$OS_FIRMWARE_METHOD $OS_FIRMWARE_REPO)
for version in ${versions[@]}; do for version in ${versions[@]}; do
OIFS=$IFS OIFS=$IFS
IFS="|" IFS="|"
varr=($version) varr=($version)
IFS=$OIFS IFS=$OIFS
if [ "$os_prereleases" == "false" ] && [ "${varr[1]}" == "true" ]; then if [ "$OS_PRERELEASES" == "false" ] && [ "${varr[1]}" == "true" ]; then
continue # skip prereleases continue # skip prereleases
fi fi
if [ "$board" != "${varr[2]}" ]; then if [ "$board" != "${varr[2]}" ]; then
@ -114,7 +114,7 @@ function show_versions() {
function show_current() { function show_current() {
source $SYS_VERSION_FILE source $SYS_VERSION_FILE
echo $os_version echo $OS_VERSION
} }
@ -144,7 +144,7 @@ function do_download() {
fi fi
fi fi
source /etc/init.d/os_conf # we need this for the os_ vars source /etc/init.d/os_conf # we need this for the OS_ vars
board=$(cat $SYS_BOARD_FILE) board=$(cat $SYS_BOARD_FILE)
url=$1 url=$1
@ -176,8 +176,8 @@ function do_download() {
echo $version > $FW_DIR/$VER_FILE echo $version > $FW_DIR/$VER_FILE
curl_opts="-S -f -L" curl_opts="-S -f -L"
if [ -n "$os_firmware_username" ]; then if [ -n "$OS_FIRMWARE_USERNAME" ]; then
curl_opts+=" --user $os_firmware_username:$os_firmware_password" curl_opts+=" --user $OS_FIRMWARE_USERNAME:$OS_FIRMWARE_PASSWORD"
fi fi
curl $curl_opts -o $outfile "$url" &> $FW_DIR/$CURL_LOG_FILE & curl $curl_opts -o $outfile "$url" &> $FW_DIR/$CURL_LOG_FILE &

View File

@ -1,2 +1,2 @@
os_tty_login="ttyS0" OS_TTY_LOGIN="ttyS0"

View File

@ -1,2 +1,2 @@
os_tty_login="ttyS0" OS_TTY_LOGIN="ttyS0"

View File

@ -1,2 +1,2 @@
os_tty_login="ttyS0" OS_TTY_LOGIN="ttyS0"

View File

@ -1,2 +1,2 @@
os_tty_login="ttyS0" OS_TTY_LOGIN="ttyS0"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
case "$1" in case "$1" in
start) start)

View File

@ -5,7 +5,7 @@ CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV" GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
configure() { configure() {
echo $GOV > $CPUFREQDIR/scaling_governor echo $GOV > $CPUFREQDIR/scaling_governor

View File

@ -3,7 +3,7 @@
CHECK_INTERVAL=30 CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
get_throttled_now() { get_throttled_now() {
t=$(vcgencmd get_throttled | cut -d '=' -f 2) t=$(vcgencmd get_throttled | cut -d '=' -f 2)

View File

@ -9,7 +9,7 @@ test -f $CONF || test -f $BOOT_CONF || test -f $SYS_CONF || exit 0
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
function start() { function start() {
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then

View File

@ -5,7 +5,7 @@ CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV" GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
configure() { configure() {
echo $GOV > $CPUFREQDIR/scaling_governor echo $GOV > $CPUFREQDIR/scaling_governor

View File

@ -3,7 +3,7 @@
CHECK_INTERVAL=30 CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
get_throttled_now() { get_throttled_now() {
t=$(vcgencmd get_throttled | cut -d '=' -f 2) t=$(vcgencmd get_throttled | cut -d '=' -f 2)

View File

@ -5,7 +5,7 @@ CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV" GOVDIR="/sys/devices/system/cpu/cpufreq/$GOV"
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
configure() { configure() {
echo $GOV > $CPUFREQDIR/scaling_governor echo $GOV > $CPUFREQDIR/scaling_governor

View File

@ -3,7 +3,7 @@
CHECK_INTERVAL=30 CHECK_INTERVAL=30
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
get_throttled_now() { get_throttled_now() {
t=$(vcgencmd get_throttled | cut -d '=' -f 2) t=$(vcgencmd get_throttled | cut -d '=' -f 2)

View File

@ -9,7 +9,7 @@ test -f $CONF || test -f $BOOT_CONF || test -f $SYS_CONF || exit 0
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
test -n "$os_version" || source /etc/init.d/base test -n "$OS_VERSION" || source /etc/init.d/base
function start() { function start() {
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then