Add dual support for real bash and busybox's bash(ash)

- modify bash to have it configured with -Os
This commit is contained in:
Thierry Laurion 2023-02-08 16:01:48 -05:00 committed by Jonathon Hall
parent 6923fb5e20
commit 8da5d5d723
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114
49 changed files with 62 additions and 60 deletions

View File

@ -1,4 +1,4 @@
#!/bin/ash #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions
. /tmp/config . /tmp/config

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# based off of flashrom-x230 # based off of flashrom-x230
# #

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /etc/functions . /etc/functions
TRACE "Under /bin/flashrom-kgpe-d16-openbmc.sh" TRACE "Under /bin/flashrom-kgpe-d16-openbmc.sh"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Boot from a local disk installation # Boot from a local disk installation
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# if we are using the full GPG we need a wrapper for the gpgv executable # if we are using the full GPG we need a wrapper for the gpgv executable
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Boot from a local disk installation # Boot from a local disk installation
BOARD_NAME=${CONFIG_BOARD_NAME:-${CONFIG_BOARD}} BOARD_NAME=${CONFIG_BOARD_NAME:-${CONFIG_BOARD}}

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Launches kexec from saved configuration entries # Launches kexec from saved configuration entries
set -e -o pipefail set -e -o pipefail
. /tmp/config . /tmp/config

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Unseal a disk key from TPM and add to a new initramfs # Unseal a disk key from TPM and add to a new initramfs
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Boot from signed ISO # Boot from signed ISO
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions
TRACE "Under /bin/kexec-parse-bls" TRACE "Under /bin/kexec-parse-bls"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Save these options to be the persistent default # Save these options to be the persistent default
set -e -o pipefail set -e -o pipefail
. /tmp/config . /tmp/config

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Generate a TPM key used to unlock LUKS disks # Generate a TPM key used to unlock LUKS disks
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# This will generate a disk encryption key and seal / ecncrypt # This will generate a disk encryption key and seal / ecncrypt
# with the current PCRs and then store it in the TPM NVRAM. # with the current PCRs and then store it in the TPM NVRAM.
# It will then need to be bundled into initrd that is booted. # It will then need to be bundled into initrd that is booted.

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Generic configurable boot script via kexec # Generic configurable boot script via kexec
set -e -o pipefail set -e -o pipefail
. /tmp/config . /tmp/config

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Sign a valid directory of kexec params # Sign a valid directory of kexec params
set -e -o pipefail set -e -o pipefail
. /tmp/config . /tmp/config

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# This will unseal and unecncrypt the drive encryption key from the TPM # This will unseal and unecncrypt the drive encryption key from the TPM
# The TOTP secret will be shown to the user on each encryption attempt. # The TOTP secret will be shown to the user on each encryption attempt.
# It will then need to be bundled into initrd that is booted with Qubes. # It will then need to be bundled into initrd that is booted with Qubes.

View File

@ -1,4 +1,4 @@
#!/bin/ash #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Scan for USB installation options # Scan for USB installation options
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Mount a USB device # Mount a USB device
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/ash #!/bin/bash
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Automated setup of TPM, GPG keys, and disk # Automated setup of TPM, GPG keys, and disk
TRACE "Under /bin/oem-factory-reset" TRACE "Under /bin/oem-factory-reset"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# System Info # System Info
BOARD_NAME=${CONFIG_BOARD_NAME:-${CONFIG_BOARD}} BOARD_NAME=${CONFIG_BOARD_NAME:-${CONFIG_BOARD}}

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /etc/functions . /etc/functions
TRACE "Under /bin/poweroff" TRACE "Under /bin/poweroff"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Measure all of the luks disk encryption headers into # Measure all of the luks disk encryption headers into
# a PCR so that we can detect disk swap attacks. # a PCR so that we can detect disk swap attacks.
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /etc/functions . /etc/functions
TRACE "Under /bin/reboot" TRACE "Under /bin/reboot"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Retrieve the sealed TOTP secret and initialize a USB Security dongle with it # Retrieve the sealed TOTP secret and initialize a USB Security dongle with it
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Generate a random secret, seal it with the PCRs # Generate a random secret, seal it with the PCRs
# and write it to the TPM NVRAM. # and write it to the TPM NVRAM.
# #

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Initialize the USB and network device drivers, # Initialize the USB and network device drivers,
# invoke a recovery shell and prompt the user for how to proceed # invoke a recovery shell and prompt the user for how to proceed
@ -23,4 +23,4 @@ echo ' mount -o ro /dev/sdb1 /media'
echo ' flash.sh /media/t430.rom' echo ' flash.sh /media/t430.rom'
echo '' echo ''
exec /bin/ash exec /bin/bash

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /etc/functions . /etc/functions
if [ "$CONFIG_TPM" = "y" ]; then if [ "$CONFIG_TPM" = "y" ]; then

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# TPM Wrapper - to unify tpm and tpm2 subcommands # TPM Wrapper - to unify tpm and tpm2 subcommands
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/ash #!/bin/bash
set -e -o pipefail set -e -o pipefail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Retrieve the sealed file and counter from the NVRAM, unseal it and compute the hotp # Retrieve the sealed file and counter from the NVRAM, unseal it and compute the hotp
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Retrieve the sealed file from the NVRAM, unseal it and compute the totp # Retrieve the sealed file from the NVRAM, unseal it and compute the totp
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Boot a USB installation # Boot a USB installation
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# get a file and extend a TPM PCR # get a file and extend a TPM PCR
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Initialize the USB and network device drivers, # Initialize the USB and network device drivers,
# invoke a recovery shell and prompt the user for how to proceed # invoke a recovery shell and prompt the user for how to proceed
@ -25,4 +25,4 @@ echo ' mount -o ro /dev/sdb1 /media'
echo ' flash.sh /media/x230.rom' echo ' flash.sh /media/x230.rom'
echo '' echo ''
exec /bin/ash exec /bin/bash

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Shell functions for most initialization scripts # Shell functions for most initialization scripts
die() { die() {
@ -51,9 +51,9 @@ recovery() {
sleep 1 sleep 1
if [ -x /bin/setsid ]; then if [ -x /bin/setsid ]; then
/bin/setsid -c /bin/ash /bin/setsid -c /bin/bash
else else
/bin/ash /bin/bash
fi fi
done done
} }

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Shell functions for common operations using fbwhiptail # Shell functions for common operations using fbwhiptail
. /etc/functions . /etc/functions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Reencrypt LUKS container and change Disk Recovery Key associated passphrase (Slot 0: main slot) # Reencrypt LUKS container and change Disk Recovery Key associated passphrase (Slot 0: main slot)
. /etc/functions . /etc/functions

View File

@ -1 +1 @@
root:x:0:0:root:/:/bin/ash root:x:0:0:root:/:/bin/bash

View File

@ -1,4 +1,4 @@
#!/bin/ash #!/bin/bash
mknod /dev/ttyprintk c 5 3 mknod /dev/ttyprintk c 5 3
echo "hello world" > /dev/ttyprintk echo "hello world" > /dev/ttyprintk
@ -30,12 +30,14 @@ if [ ! -r /dev/ptmx ]; then
ln -s /dev/pts/ptmx /dev/ptmx ln -s /dev/pts/ptmx /dev/ptmx
fi fi
[ -a /dev/stdin ] || ln -s /proc/self/fd/0 /dev/stdin
[ -a /dev/stdout ] || ln -s /proc/self/fd/1 /dev/stdout
[ -a /dev/stderr ] || ln -s /proc/self/fd/2 /dev/stderr
# Needed by bash # Needed by bash
[ -a /dev/fd ] || ln -s /proc/self/fd /dev/fd if ! [ -L /bin/bash ]; then
# /bin/bash is not a symbolink link (not busybox)
[ -a /dev/stdin ] || ln -s /proc/self/fd/0 /dev/stdin
[ -a /dev/stdout ] || ln -s /proc/self/fd/1 /dev/stdout
[ -a /dev/stderr ] || ln -s /proc/self/fd/2 /dev/stderr
[ -a /dev/fd ] || ln -s /proc/self/fd /dev/fd
fi
# Recovery shells will erase anything from here # Recovery shells will erase anything from here
mkdir -p /tmp/secret mkdir -p /tmp/secret
@ -116,7 +118,7 @@ if [ "$boot_option" = "r" ]; then
if [ "$CONFIG_TPM" = "y" -o "$CONFIG_TPM2_TOOLS" = "y" ]; then if [ "$CONFIG_TPM" = "y" -o "$CONFIG_TPM2_TOOLS" = "y" ]; then
tpmr extend -ix 4 -ic recovery tpmr extend -ix 4 -ic recovery
fi fi
exec /bin/ash exec /bin/bash
exit exit
fi fi
@ -173,4 +175,4 @@ fi
if [ "$CONFIG_TPM" = "y" -o "$CONFIG_TPM2_TOOLS" = y ]; then if [ "$CONFIG_TPM" = "y" -o "$CONFIG_TPM2_TOOLS" = y ]; then
tpmr extend -ix 4 -ic recovery tpmr extend -ix 4 -ic recovery
fi fi
exec /bin/ash exec /bin/bash

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Extract the GPG signed dmsetup configuration from # Extract the GPG signed dmsetup configuration from
# the header of the file system, validate it against # the header of the file system, validate it against
# the trusted key database, and execute it to mount # the trusted key database, and execute it to mount

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# udhcpc script # udhcpc script

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# extend a TPM PCR with a module and then load it # extend a TPM PCR with a module and then load it
# any arguments will also be measured. # any arguments will also be measured.
# The default PCR to be extended is 5, but can be # The default PCR to be extended is 5, but can be