From 0bb22f28fc1d40bce13a1fe0cf9a8957e6391280 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Sun, 26 Jul 2020 22:14:42 +0300 Subject: mkrootfs: switch to cpt kiss version of the tool can still be found on the branch named 'kiss' --- README | 17 ++++++++--------- mkrootfs.sh | 49 ++++++++++++++++++------------------------------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/README b/README index a3b3e51..e1b9a0a 100644 --- a/README +++ b/README @@ -1,10 +1,9 @@ carbs rootfs script ------------------- -Tool for generating rootfs tarballs for Carbs Linux. But it can be configured to -create tarballs for KISS, create a personalized pre-configured tarball with an -Xorg server to ease installation process. Tarballs on https://dl.carbslinux.org -are generated from this script. +Tool for generating rootfs tarballs for Carbs Linux. This tool now uses cpt for +building the tarball. The old version of the tool which used kiss can be found +on the seperate branch 'kiss'. configuration @@ -12,7 +11,7 @@ configuration Configuration can be done by copying config.def file to config. There you can configure where the rootfs will be created, packages to be installed, CFLAGS, -MAKEFLAGS, repository to be added, and the `KISS_PATH` to be used. +MAKEFLAGS, repository to be added, and the `CPT_PATH` to be used. extra repositories @@ -31,16 +30,16 @@ purposes, don't actually use local repositories. +--------------------------------------------------------------------------+ - | https://git.u.com/repo1 /var/db/kiss/personalrepo --depth 1 | - | /home/user/kiss-repo2 /var/db/kiss/kiss-repo2 --no-local --depth 2 | + | https://git.u.com/repo1 /var/db/cpt/personalrepo --depth 1 | + | /home/user/cpt-repo2 /var/db/cpt/cpt-repo2 --no-local --depth 2 | +--------------------------------------------------------------------------+ -You can then add these to your KISS_PATH by editing the config file and adding +You can then add these to your CPT_PATH by editing the config file and adding the following to your `HOST_REPO_PATH`. - HOST_REPO_PATH="/tmp/repo/core:$MNTDIR/var/db/kiss/personalrepo:$MNTDIR/var/db/kiss/kiss-repo2" + HOST_REPO_PATH="/tmp/repo/core:$MNTDIR/var/db/cpt/personalrepo:$MNTDIR/var/db/cpt/cpt-repo2" postinstall diff --git a/mkrootfs.sh b/mkrootfs.sh index 2260d0b..bed842d 100755 --- a/mkrootfs.sh +++ b/mkrootfs.sh @@ -4,20 +4,8 @@ # Bootstrapper for Carbs Linux # See LICENSE file for copyright and license details -{ - # 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 -} +# Source the package manager library. +. cpt-lib # Functions msg() { printf '\033[1;35m-> \033[m%s\n' "$@" ;} @@ -72,8 +60,8 @@ EOF # Script starts here msg "Starting Script..." -msg "Setting KISS_ROOT to $MNTDIR" -export KISS_ROOT="$MNTDIR" +msg "Setting CPT_ROOT to $MNTDIR" +export CPT_ROOT="$MNTDIR" # Check whether REPO and REPO_PATH variables exist [ "$REPO" ] || die "REPO variable is not set" @@ -81,20 +69,20 @@ export KISS_ROOT="$MNTDIR" # Create parent directories for the repositories, and # remove pre-existing repositories. We then shallow # clone the repositories to both locations. -case $REPO in +case $REPO in rsync://*) msg "Acquiring repository" - mkdir -p "$MNTDIR/var/db/kiss" /tmp - rm -rf /tmp/repo "$MNTDIR/var/db/kiss/repo" + mkdir -p "$MNTDIR/var/db/cpt" /tmp + rm -rf /tmp/repo "$MNTDIR/var/db/cpt/repo" rsync -avCz --include=core --delete "$REPO/" /tmp/repo - cp -r /tmp/repo "$MNTDIR/var/db/kiss/repo" + cp -r /tmp/repo "$MNTDIR/var/db/cpt/repo" ;; *) msg "Cloning repository" - mkdir -p "$MNTDIR/var/db/kiss" /tmp - rm -rf /tmp/repo "$MNTDIR/var/db/kiss/repo" + mkdir -p "$MNTDIR/var/db/cpt" /tmp + rm -rf /tmp/repo "$MNTDIR/var/db/cpt/repo" git clone --depth 1 "$REPO" /tmp/repo - cp -r /tmp/repo "$MNTDIR/var/db/kiss/repo" + cp -r /tmp/repo "$MNTDIR/var/db/cpt/repo" esac # Install extra repositories defined in a 'repositories' @@ -118,8 +106,8 @@ while read -r repourl repodir gitopts; do done < repositories -# We export the new KISS_PATH -export KISS_PATH="${HOST_REPO_PATH:-/tmp/repo/core}" +# We export the new CPT_PATH +export CPT_PATH="${HOST_REPO_PATH:-/tmp/repo/core}" msg "Starting build from the PKGS variable" @@ -128,11 +116,11 @@ msg "Starting build from the PKGS variable" for pkg in $order; do # Get the package directory so we can get version # and release numbers. - pkgdir=$(kiss s "$pkg" | sed 1q) + pkgdir=$(cpt s --single "$pkg") read -r ver rel < "$pkgdir/version" # Check if the package is already installed and skip. - [ "$(kiss l "$pkg")" = "$pkg $ver $rel" ] && continue + [ "$(cpt l "$pkg")" = "$pkg $ver $rel" ] && continue # Check if a prebuild tarball exists, build the package # if it doesn't exist. @@ -140,12 +128,11 @@ for pkg in $order; do # pkg_order should be dealing with packages in a way that # no prompts are asked, but let's not take any chances # either. - [ -f "${XDG_CONFIG_HOME:-$HOME/.cache}/kiss/bin/$pkg#$ver-$rel.tar.${KISS_COMPRESS:-gz}" ] || - KISS_NOPROMPT=1 kiss b "$pkg" - KISS_NOPROMPT=1 kiss i "$pkg" + pkg_isbuilt "$pkg" || CPT_NOPROMPT=1 cpt b "$pkg" + CPT_NOPROMPT=1 cpt i "$pkg" done -# You can check out about post-installation +# You can check out about post-installation # from the configuration file msg "Installation Complete, starting custombuild procedure if there is one" postinstall -- cgit v1.2.3