From 02d34478d8fe9beac0f9aabe3576209fda2c7e51 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Sat, 3 Aug 2024 16:00:08 -0400 Subject: [PATCH] Enabled code to actually run and be testable --- cpstage4.sh | 12 ++++++------ exstage4.sh | 12 ++++++------ mkstage4.sh | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cpstage4.sh b/cpstage4.sh index 784f145..a7490c6 100755 --- a/cpstage4.sh +++ b/cpstage4.sh @@ -82,10 +82,10 @@ done # checks if run as root: -#if [[ "$(id -u)" -ne 0 ]]; then -# echo "$(basename "$0"): must run as root" -# exit 250 -#fi +if [[ "$(id -u)" -ne 0 ]]; then + echo "$(basename "$0"): must run as root" + exit 250 +fi if [[ -z "$sourcePath" ]]; then echo "$(basename "$0"): no source path specified" @@ -213,6 +213,6 @@ fi # start stage4 creation: if $optQuiet; then - echo "Would've worked" - #rsync "${rsyncOptions[@]}" "${syncExcludes[@]/#/--exclude=}" "$sourcePath" "$targetPath" + #echo "Would've worked" + rsync "${rsyncOptions[@]}" "${syncExcludes[@]/#/--exclude=}" "$sourcePath" "$targetPath" fi diff --git a/exstage4.sh b/exstage4.sh index 1f8fe14..b2d7aaa 100755 --- a/exstage4.sh +++ b/exstage4.sh @@ -85,10 +85,10 @@ while [[ $# -gt 0 ]]; do done # checks if run as root: -#if [[ "$(id -u)" -ne 0 ]]; then -# echo "$(basename "$0"): must run as root" -# exit 250 -#fi +if [[ "$(id -u)" -ne 0 ]]; then + echo "$(basename "$0"): must run as root" + exit 250 +fi if [[ ! -r "$archiveFile" ]]; then echo "ERROR: archive file (\`$archiveFile\`) does not exist" @@ -158,6 +158,6 @@ fi # start stage4 creation: if $optQuiet; then - echo "Would've worked" - #tar "${tarOptions[@]}" -f "$archiveFile" -C "$targetPath" + #echo "Would've worked" + tar "${tarOptions[@]}" -f "$archiveFile" -C "$targetPath" fi diff --git a/mkstage4.sh b/mkstage4.sh index d6f05d7..8da34aa 100755 --- a/mkstage4.sh +++ b/mkstage4.sh @@ -112,10 +112,10 @@ done # checks if run as root: -#if [[ "$(id -u)" -ne 0 ]]; then -# echo "$(basename "$0"): must run as root" -# exit 250 -#fi +if [[ "$(id -u)" -ne 0 ]]; then + echo "$(basename "$0"): must run as root" + exit 250 +fi if [[ -z "$targetPath" ]]; then echo "$(basename "$0"): no system path specified" @@ -287,11 +287,11 @@ fi # start stage4 creation: if $optQuiet; then - echo "Would've worked" - #tar "${tarOptions[@]}" "${tarIncludes[@]/#/--include=}" "${tarExcludes[@]/#/--exclude=}" -f "${stage4Filename}.${stage4Ext}" "${targetPath}" - #if [[ "$optSeperateKernel" ]] - #then - # tar "${tarOptions[@]}" -f "${stage4Filename}.ksrc.${stage4Ext}" "${targetPath}usr/src/linux-$(uname -r)" - # tar "${tarOptions[@]}" -f "${stage4Filename}.kmod.${stage4Ext}" "${targetPath}lib"*"/modules/$(uname -r)" - #fi + #echo "Would've worked" + tar "${tarOptions[@]}" "${tarIncludes[@]/#/--include=}" "${tarExcludes[@]/#/--exclude=}" -f "${stage4Filename}.${stage4Ext}" "${targetPath}" + if [[ "$optSeperateKernel" ]] + then + tar "${tarOptions[@]}" -f "${stage4Filename}.ksrc.${stage4Ext}" "${targetPath}usr/src/linux-$(uname -r)" + tar "${tarOptions[@]}" -f "${stage4Filename}.kmod.${stage4Ext}" "${targetPath}lib"*"/modules/$(uname -r)" + fi fi