#!/bin/bash ############################################################### # Script : /etc/rc.d/rc.platform # Purpose: Post OS boot setup for Hardware Models # Author : Stuart Winter # Date...: 20-Jan-2022 ############################################################### # Collapse all 32bit ARM & x86 variants of 'i?86' into a single # platform: 'x86' and 'arm' respectively. ARCH=$( uname -m | sed -e 's%i[0-9]86%x86%g' -e 's?arm.*?arm?g' ) # Determine the Hardware Model name: # 'slk-hwm-discover' is contained within the 'a/kernel' base # package. If you've rolled your own Kernels without following # the proper method described here: # https://docs.slackware.com/slackwarearm:cstmz_kernel # you'll need to manually copy 'slk-hwm-discover' into /sbin # 'slk-hwm-discover' is stored within the source tree here: # slackwareaarch64-/source/k/SlkOS-initrd-overlay/sbin/slk-hwm-discover # # If slk-hwm-discover unavailable, we'll fall back to checking # Device Tree only. However, 'slk-hwm-discover' supports additional # discovery methods for Hardware Models that don't support DT. # If no HWM is discovered, the helper scripts will not run. if [ -x /sbin/slk-hwm-discover ]; then export HWM=$( slk-hwm-discover ) elif [ -f /proc/device-tree/model ] ; then echo "WARNING: slk-hwm-discover is missing from your system." echo " Falling back to Device Tree detection." export HWM=$( strings /proc/device-tree/model 2>/dev/null ) fi # Load in the Hardware Model helpers/plugin shell scripts: [ -d /etc/rc.d/rc.platform.d/$ARCH ] && { # If there are any user-specified settings in this file, load it in. # This file is not touched by the Slackware packaging tools. [ -f /etc/rc.d/rc.platform.conf ] && . /etc/rc.d/rc.platform.conf for platformscr in /etc/rc.d/rc.platform.d/$ARCH/* ; do . $platformscr done ;}