aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmkrootfs.sh23
1 files changed, 14 insertions, 9 deletions
diff --git a/mkrootfs.sh b/mkrootfs.sh
index 134b46a..ad06a41 100755
--- 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"