###################################################################################
# File.......: /usr/lib/setup/armedslack-run-postinstall-scripts
# Sourced from: /usr/lib/setup/SeTconfig
#              Immediately prior to running the regular non-ARM scripts
# Purpose....: Run Slackware ARM post installation scripts
# Version....: 1.00
# Date.......: 20-Jul-2022
# Author.....: Stuart Winter <mozes@slackware.com>
###################################################################################
#
# Copyright 2022  Stuart Winter, Donostia, Spain.
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Pause if there's a flag set:
[ -f /.post-install-pause ] && {
   dialog \
      --title "Installation paused" \
      --clear \
      --ok-label "RESUME" \
      --msgbox "\nThe Slackware installation process has been paused.\n\n
Press ENTER to begin the post installation phase, which begins with
the execution of the post installation scripts.\n\n" 0 0 ;}

# Here, we call each Slackware ARM post installation script that's included
# within the Slackware Installer's /usr/lib/setup/armedslack-postinstall-scripts/
# Two arguments are provided:
# 1 -- the target prefix (normally /, but ${T_PX} from the bootdisk)
# 2 -- the name of the root device.
[ -d /usr/lib/setup/armedslack-postinstall-scripts ] && {
   ( cd $T_PX
     for armedslack_script in /usr/lib/setup/armedslack-postinstall-scripts/* ; do
        $armedslack_script $T_PX $ROOT_DEVICE
     done ) ;}

# If there are any ARMedslack development scripts to configure the OS
# as a build machine, run them now:
[ -d /armedslack-dev-installer-post.src ] && {
   ( cd $T_PX
     for armedslack_dev_script in /armedslack-dev-installer-post.src/* ; do
        $armedslack_dev_script $T_PX $ROOT_DEVICE
     done ) ;}

# Legacy hack method.
# If there are any ARMedslack development scripts to configure the OS
# as a build machine, add them so that they're run upon completion of the
# installation.
#[ -d /armedslack-dev-installer-post.src ] && \
#   cp -fa /armedslack-dev-installer-post.src/setup.armedslack-tmp* \
#   ${T_PX}/var/lib/pkgtools/setup/

