#!/bin/bash
###############################################################
# Script : /etc/rc.d/rc.platform
# Purpose: Post OS boot setup for Hardware Models
# Author : Stuart Winter <mozes@slackware.com>
# 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' )

# Load in the Hardware Model helpers/plugin shell scripts:
[ -f /proc/device-tree/model ] && {
   export HWM=$( strings /proc/device-tree/model 2>/dev/null )
   [ -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 ;} ;}
