commit:     437d6b001718409eecec905b5885b9ac1b8cf354
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 03:52:56 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 07:47:45 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=437d6b00

targets: Simplify delete_from_chroot()

And for consistency always pass it a leading / to indicate that the
argument is a filepath within the chroot.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 targets/embedded/controller.sh      | 2 +-
 targets/livecd-stage2/controller.sh | 2 +-
 targets/netboot2/controller.sh      | 4 ++--
 targets/stage4/controller.sh        | 2 +-
 targets/support/functions.sh        | 7 ++-----
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/targets/embedded/controller.sh b/targets/embedded/controller.sh
index 7501d694..7a2b59ab 100755
--- a/targets/embedded/controller.sh
+++ b/targets/embedded/controller.sh
@@ -48,7 +48,7 @@ case ${1} in
                        cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
                fi
                exec_in_chroot ${clst_shdir}/support/kmerge.sh
-               delete_from_chroot tmp/linuxrc
+               delete_from_chroot /tmp/linuxrc
        ;;
 
        target_image_setup)

diff --git a/targets/livecd-stage2/controller.sh 
b/targets/livecd-stage2/controller.sh
index 463c37e7..5ae268f8 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -24,7 +24,7 @@ case $1 in
                        cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
                fi
                exec_in_chroot ${clst_shdir}/support/kmerge.sh
-               delete_from_chroot tmp/linuxrc
+               delete_from_chroot /tmp/linuxrc
 
                extract_modules ${clst_chroot_path} ${clst_kname}
                #16:12 <@solar> kernel_name=foo

diff --git a/targets/netboot2/controller.sh b/targets/netboot2/controller.sh
index 6f012403..a5bb498c 100755
--- a/targets/netboot2/controller.sh
+++ b/targets/netboot2/controller.sh
@@ -39,8 +39,8 @@ case ${1} in
 
                exec_in_chroot ${clst_shdir}/support/kmerge.sh
 
-               delete_from_chroot tmp/linuxrc
-               delete_from_chroot tmp/busy-config
+               delete_from_chroot /tmp/linuxrc
+               delete_from_chroot /tmp/busy-config
 
                extract_modules ${clst_chroot_path} ${clst_kname}
                #16:12 <@solar> kernel_name=foo

diff --git a/targets/stage4/controller.sh b/targets/stage4/controller.sh
index a92d858a..cac1212d 100755
--- a/targets/stage4/controller.sh
+++ b/targets/stage4/controller.sh
@@ -28,7 +28,7 @@ case $1 in
                        cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
                fi
                exec_in_chroot ${clst_shdir}/support/kmerge.sh
-               delete_from_chroot tmp/linuxrc
+               delete_from_chroot /tmp/linuxrc
                extract_modules ${clst_chroot_path} ${clst_kname}
                # Do we need this one?
 #              extract_kernel ${clst_chroot_path}/boot ${clst_kname}

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index fd446b4b..5ab64726 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -7,11 +7,8 @@ copy_to_chroot() {
        cp -pPR "${src_file}" "${dest_dir}"/
 }
 
-delete_from_chroot(){
-       if [ -e ${clst_chroot_path}${1} ]
-       then
-               rm -f ${clst_chroot_path}${1}
-       fi
+delete_from_chroot() {
+       rm -f "${clst_chroot_path}/${1}"
 }
 
 # Takes the full path to the source file as its argument

Reply via email to