mkrootfs

Carbs rootfs generator
git clone git://git.carbslinux.org/mkrootfs
Log | Files | Refs | README | LICENSE

commit a1acebc4ca699da837c1f063983e9aa046ed75af
parent e4a2415c13b9fa34a9c7b80d19120bfb1caa3319
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 18 May 2020 12:23:02 +0300

remove library after sourcing it

Diffstat:
Mmkrootfs.sh | 23++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/mkrootfs.sh b/mkrootfs.sh @@ -4,21 +4,26 @@ # Bootstrapper for Carbs Linux # See LICENSE file for copyright and license details -# Source kiss as a library -kissloc=$(command -v kiss) -kissln=$(wc -l < "$kissloc") -sed "${kissln}d" "$kissloc" > .kisslib -. ./.kisslib - +{ + # Source kiss as a library so that we can use pkg_order + # + # Get the line number so we can remove the last line + # that is calling the main function. + kissloc=$(command -v kiss) + kissln=$(wc -l < "$kissloc") + + # Save the file on a temporary .kisslib file where we + # will be reading the library functions. + sed "${kissln}d" "$kissloc" > .kisslib + . ./.kisslib + rm -f .kisslib +} # Functions msg() { printf '\033[1;35m-> \033[m%s\n' "$@" ;} die() { printf '\033[1;31m!> ERROR: \033[m%s\n' "$@" >&2; exit 1 ;} -# Exit if the user is not root -[ "$(id -u)" -eq 0 ] || die "Please run as root" - # Let's get current working directory BASEDIR="$PWD"