#!/bin/sh -e # shellcheck disable=1090 # Bootstrapper for Carbs Linux # See LICENSE file for copyright and license details # Functions msg() { printf '\033[1;35m-> \033[m%s\n' "$@" ;} error() { printf '\033[1;31mERROR: \033[m%s\n' "$@" ;} >&2 die() { error "$1"; exit 1 ;} ask() { printf '\033[1;33m== %s ==\n(y/N) ' "$1" ; read ans; case "$ans" in [Yy]*) return 0 ;; *) return 1 ;; esac ;} # Exit if the user is not root ! [ "$(id -u)" -eq 0 ] && die "Please run as root" # Let's get current working directory BASEDIR="$PWD" # If there is no config file, we copy config.def # to config. After we make sure config file is # in place, we source the contents ! [ -e config ] && cp config.def config . "$PWD/config" # Check whether absolutely required variables are set. [ -n "$PKGS" ] || die "You must set PKGS variable to continue the bootstrapper" [ -n "$MNTDIR" ] || die "You must specify fakeroot location \"MNTDIR\" in order to continue the bootstrapper" # Print variables from the configuration file cat <