Skip to content

Commit

Permalink
Merge pull request #271 from austin987/sc2
Browse files Browse the repository at this point in the history
misc shellcheck fixes
  • Loading branch information
SolidHal committed Jul 26, 2022
2 parents b53b22c + d6d142c commit a7c345d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion filesystem/resources/pbuilder/hooks/D60no-man-db-rebuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Don't rebuild man-db

echo "I: Preseed man-db/auto-update to false"
Expand Down
2 changes: 1 addition & 1 deletion filesystem/resources/pbuilder/hooks/D70update
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
#!/bin/bash
/usr/bin/apt-get update
26 changes: 16 additions & 10 deletions initramfs/resources/initramfs-init
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/busybox sh
# shellcheck shell=sh
# shellcheck disable=SC2039
#
# Really, this should be ash, not sh, but shellcheck doesn't support ash, see
# https://github.com/koalaman/shellcheck/issues/853
# SC2039 is there because of that (local/== unsupported in sh, work in ash)

# This is the init script built into the PrawnOS initramfs

Expand All @@ -21,8 +27,8 @@ echo In PrawnOS Init

#add this to start shell at desired point
rescue_shell() {
[ "{$1}" != "debug" ] && echo "Something went wrong. Dropping to a shell." > /dev/tty1
[ "{$1}" == "debug" ] && echo "Debug flag detected, entering debug shell" > /dev/tty1
[ "${1}" != "debug" ] && echo "Something went wrong. Dropping to a shell." > /dev/tty1
[ "${1}" == "debug" ] && echo "Debug flag detected, entering debug shell" > /dev/tty1
echo "Something went wrong. Dropping to a shell." > /dev/tty1
exec setsid /bin/sh -c 'exec /bin/sh </dev/tty1 >/dev/tty1 2>&1'
}
Expand Down Expand Up @@ -53,10 +59,12 @@ rootpartuuid() {
# if optional count is provided:
# returns 1 if substring occurs in string < optional count
# returns 0 otherwise
occur() while case "$1" in (*"$2"*) set -- \
occur() {
while case "$1" in (*"$2"*) set -- \
"${1#*"$2"}" "$2" "${3:-0}" "$((${4:-0}+1))";;
(*) return "$((${4:-0}<${3:-1}))";;esac
do : "${_occur:+$((_occur=$4))}";done
}

# mount the bare necesities
mount -n -t proc proc /proc
Expand Down Expand Up @@ -93,22 +101,20 @@ fi

echo BLKID: ${BLKID} > /dev/tty1

#If its an mmcblk device, the kernel partiton will p1. If it is a usb device, the partiton will just be 1
#Just want everything before the 1
# If it's an mmcblk device, the kernel partiton will be p1. If it is a usb device, the partiton will just be 1.
# Just want everything before the 1
ROOT_DEV="${BLKID%1:*}"
echo ROOT_DEV: ${ROOT_DEV} > /dev/tty1

# label any partition on the system with RESCUESHELL to enter the initramfs rescue shell before mount and root_switch.
# you can do this with "cgpt add -i 1 -l RESCUESHELL /dev/sda" for example to label the first partiton of a usb drive.
if [ -n "$(blkid | grep RESCUESHELL)" ]
then
if blkid | grep -q RESCUESHELL; then
rescue_shell debug
fi


if [ -n "$(blkid ${ROOT_DEV}2 | grep crypto_LUKS)" ]
then
#decrypt and mount the root filesystem, disable kernel log messages to avoid clashing with the prompt
if blkid ${ROOT_DEV}2 | grep -q crypto_LUKS; then
# decrypt and mount the root filesystem, disable kernel log messages to avoid clashing with the prompt
dmesg -n 2
echo "Opening encrypted root partition, this will take 30s..."
cryptsetup --tries 5 luksOpen ${ROOT_DEV}2 luksroot || rescue_shell
Expand Down
3 changes: 2 additions & 1 deletion scripts/InstallScripts/InstallPackages.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash -e
#!/bin/bash

set -e

# This file is part of PrawnOS (https://www.prawnos.com)
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
Expand Down
4 changes: 3 additions & 1 deletion scripts/InstallScripts/InstallPrawnOS.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/bin/bash

set -e

#See the block of "echos" in main() for description of this script

Expand Down

0 comments on commit a7c345d

Please sign in to comment.