Skip to content

Commit

Permalink
refactor: moves firstboot fix to seperate module
Browse files Browse the repository at this point in the history
To avoid conflicts with non rpi images, moved to seperate modules

Can be removed if solved due merge of RPi-Distro/raspberrypi-sys-mods#71

Signed-off-by: Stephan Wendel <me@stephanwe.de>
  • Loading branch information
KwadFan committed Mar 25, 2023
1 parent a493fa4 commit 25cb405
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/raspberry/default
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BASE_IMAGE_RESIZEROOT=600
# Compress not needed due compression done in workflow
BASE_RELEASE_COMPRESS=no
# Modules are valid for 32bit and 64bit images
MODULES="base,pkgupgrade,mainsailos(net,piconfig,klipper,is_req_preinstall,moonraker,timelapse,mainsail,crowsnest,sonar,password-for-sudo),postrename"
MODULES="base,pkgupgrade,rpi_firstb_fix,mainsailos(net,piconfig,klipper,is_req_preinstall,moonraker,timelapse,mainsail,crowsnest,sonar,password-for-sudo),postrename"

# export Variables
export BASE_IMAGE_ENLARGEROOT
Expand Down
10 changes: 4 additions & 6 deletions src/modules/mainsailos/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi
source /common.sh
install_cleanup_trap

# Create mainsailos release file
## Step 1: Create mainsailos release file
if [ -f "/etc/mainsailos_version" ]; then
sudo rm -f /etc/mainsailos_version
fi
Expand All @@ -31,12 +31,10 @@ function get_parent {
}

echo "${DIST_NAME} release ${DIST_VERSION} ($(get_parent))" > /etc/"${DIST_NAME,,}"-release
## END Step 1

### Install CANBoot Dependency
## Step 2: Install CANBoot Dependency
apt-get update --allow-releaseinfo-change
# shellcheck disable=SC2086
check_install_pkgs ${MAINSAILOS_DEPS}

## Patch firstboot issue (https://github.com/mainsail-crew/MainsailOS/issues/213)
echo_green "Patch firstboot issue..."
unpack filesystem/root /
## END Step 2
13 changes: 13 additions & 0 deletions src/modules/rpi_firstb_fix/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Shebang for better file detection
#### rpi_firstb_fix module
####
#### Written by Stephan Wendel aka KwadFan <me@stephanwe.de>
#### Copyright 2023 - till today
#### https://github.com/mainsail-crew/MainsailOS
####
#### This File is distributed under GPLv3
####

# Intentionally left blank
# See start_chroot_script for information
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
# shellcheck disable=all


reboot_pi () {
umount /boot
Expand Down
32 changes: 32 additions & 0 deletions src/modules/rpi_firstb_fix/start_chroot_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#### rpi_firstb_fix module
####
#### Written by Stephan Wendel aka KwadFan <me@stephanwe.de>
#### Copyright 2023 - till today
#### https://github.com/mainsail-crew/MainsailOS
####
#### This File is distributed under GPLv3
####

#### Description:
#### This is intended to patch behaviour of raspberry's firstboot script.
#### Related to https://github.com/mainsail-crew/MainsailOS/issues/213

# shellcheck enable=require-variable-braces
## Source error handling, leave this in place
set -Ee

# Set DEBIAN_FRONTEND to noninteractive
if [[ "${DEBIAN_FRONTEND}" != "noninteractive" ]]; then
export DEBIAN_FRONTEND=noninteractive
fi

## Source CustomPIOS common.sh
# shellcheck disable=SC1091
source /common.sh
install_cleanup_trap

## Step 1: Patch firstboot issue
echo_green "Patch firstboot issue..."
unpack filesystem/root /
## END Step 1

0 comments on commit 25cb405

Please sign in to comment.