cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit ea555f1e8d8b8242b8f35a51f35450e7297dec21
parent cc31977ecb2dce4d5f36c35a883ffdfabccf2c00
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Wed, 21 Aug 2019 02:24:31 +0000

docs: update

Diffstat:
MREADME.md | 2+-
Mkiss | 76++++++++++++++++++++++++++++++++++++++++------------------------------------
2 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/README.md b/README.md @@ -1,6 +1,6 @@ # kiss -Tiny package manager for KISS Linux. +Tiny package manager for KISS. ## Package format diff --git a/kiss b/kiss @@ -28,18 +28,22 @@ die() { # Print a message and exit with '1' (error). - printf '\033[1;31m!>\033[m %s.\n' "$@" >&2 + printf '\033[1;31m!!\033[m %s.\n' "$@" >&2 exit 1 } log() { # Print a message prettily. - printf '\033[1;32m=>\033[m %s.\n' "$@" + if [ "$2" ]; then + printf '\033[1;32m-- \033[1;33m%s\033[m (%s)\n' "$1" "$2" + else + printf '\033[1;34m->\033[m %s.\n' "$1" + fi } pkg_lint() { # Check that each mandatory file in the package entry exists. - log "[$1] Checking repository files" + log "$1" "Checking repository files" # Figure out *where* the repository entry for the package is located. repo_dir=$(pkg_search "$1") @@ -105,7 +109,7 @@ pkg_list() { } [ -f "$pkg/version" ] || { - log "[$pkg] Warning, package has no version file" + log "$pkg" "Warning, package has no version file" continue } @@ -117,7 +121,7 @@ pkg_list() { pkg_sources() { # Download any remote package sources. The existence of local # files is also checked. - log "[$1] Downloading sources" + log "$1" "Downloading sources" # Store each downloaded source in named after the package it # belongs to. This avoid conflicts between two packages having a @@ -139,7 +143,7 @@ pkg_sources() { # Remote source. *://*) [ -f "${src##*/}" ] && { - log "[$1] Found cached source '${src##*/}'" + log "$1" "Found cached source '${src##*/}'" continue } @@ -153,7 +157,7 @@ pkg_sources() { *) [ -f "$repo_dir/$src" ] || die "[$1] No local file '$src'" - log "[$1] Found local file '$src'" + log "$1" "Found local file '$src'" ;; esac done < "$repo_dir/sources" @@ -162,7 +166,7 @@ pkg_sources() { pkg_extract() { # Extract all source archives to the build directory and copy over # any local repository files. - log "[$1] Extracting sources" + log "$1" "Extracting sources" # Store each downloaded source in named after the package it # belongs to. This avoid conflicts between two packages having a @@ -253,7 +257,7 @@ pkg_verify() { # Compare the checksums using 'cmp'. cmp -s "$cac_dir/c-$1" "$repo_dir/checksums" || { - log "[$1] Checksum mismatch" + log "$1" "Checksum mismatch" # Instead of dying above, log it to the terminal. Also define a # variable so we *can* die after all checksum files have been @@ -274,7 +278,7 @@ pkg_strip() { # Package has stripping disabled, stop here. [ -f "$repo_dir/nostrip" ] && return - log "[$1] Stripping binaries and libraries" + log "$1" "Stripping binaries and libraries" # Strip only files matching the below mime-types from the package # directory. No alternative to 'file' here sadly. @@ -315,7 +319,7 @@ pkg_fixdeps() { # redefines the argument list. pkg_name=$1 - log "[$1] Checking 'ldd' for missing dependencies" + log "$1" "Checking 'ldd' for missing dependencies" # Go to the directory containing the built package to # simplify path building. @@ -380,7 +384,7 @@ pkg_manifest() ( # Generate the package's manifest file. This is a list of each file # and directory inside the package. The file is used when uninstalling # packages, checking for package conflicts and for general debugging. - log "[$1] Generating manifest" + log "$1" "Generating manifest" # This funcion runs as a sub-shell to avoid having to 'cd' back to the # prior directory before being able to continue. @@ -396,7 +400,7 @@ pkg_manifest() ( pkg_tar() { # Create a tar-ball from the built package's files. # This tar-ball also contains the package's database entry. - log "[$1] Creating tar-ball" + log "$1" "Creating tar-ball" # Find the package's repository files. This needs to keep # happening as we can't store this data in any kind of data @@ -412,7 +416,7 @@ pkg_tar() { tar zpcf "$bin_dir/$1#$version-$release.tar.gz" -C "$pkg_dir/$1" . || die "[$1] Failed to create tar-ball" - log "[$1] Successfully created tar-ball" + log "$1" "Successfully created tar-ball" } pkg_build() { @@ -492,7 +496,7 @@ pkg_build() { # This calls 'args' to inherit a root check and call # to 'sudo' to elevate permissions. [ -f "$bin_dir/$pkg#$version-$release.tar.gz" ] && { - log "[$pkg] Found pre-built binary, installing" + log "$pkg" "Found pre-built binary, installing" args i "$bin_dir/$pkg#$version-$release.tar.gz" continue } @@ -511,7 +515,7 @@ pkg_build() { # Ensure that checksums exist prior to building the package. [ -f "$repo_dir/checksums" ] || { - log "[$pkg] Checksums are missing" + log "$pkg" "Checksums are missing" # Instead of dying above, log it to the terminal. Also define a # variable so we *can* die after all checksum files have been @@ -554,7 +558,7 @@ pkg_build() { # This acts as the database entry. cp -Rf "$repo_dir" "$pkg_dir/$pkg/$pkg_db/" - log "[$pkg] Successfully built package" + log "$pkg" "Successfully built package" # Create the manifest file early and make it empty. # This ensure that the manifest is added to the manifest... @@ -579,8 +583,8 @@ pkg_build() { # Only ask for confirmation if more than one package needs to be installed. [ $# -gt 1 ] && { - log "Install built packages? [$*]" \ - "Press Enter to continue or Ctrl+C to abort here" + log "Install built packages? [$*]" + log "Press Enter to continue or Ctrl+C to abort here" # POSIX 'read' has none of the "nice" options like '-n', '-p' # etc etc. This is the most basic usage of 'read'. @@ -637,7 +641,7 @@ pkg_checksums() { pkg_conflicts() { # Check to see if a package conflicts with another. # This function takes a path to a KISS tar-ball as an argument. - log "[$2] Checking for package conflicts" + log "$2" "Checking for package conflicts" # Save the package name as we modify the argument list below. tar_file=$1 @@ -684,7 +688,7 @@ pkg_remove() { # The package is not installed, don't do anything. pkg_list "$1" >/dev/null || { - log "[$1] Not installed" + log "$1" "Not installed" return } @@ -720,7 +724,7 @@ pkg_remove() { rmdir "$KISS_ROOT/$file" 2>/dev/null || continue else rm -f -- "$KISS_ROOT/$file" || - log "[$1] Failed to remove '$file'" + log "$1" "Failed to remove '$file'" fi done < "$KISS_ROOT/$pkg_db/$1/manifest" @@ -728,7 +732,7 @@ pkg_remove() { # we no longer need to block 'Ctrl+C'. trap pkg_clean EXIT INT - log "[$1] Removed successfully" + log "$1" "Removed successfully" } pkg_install() { @@ -776,7 +780,7 @@ pkg_install() { tar pxf "$tar_file" -C "$tar_dir/$pkg_name" || die "[$pkg_name] Failed to extract tar-ball" - log "[$pkg_name] Checking that all dependencies are installed" + log "$pkg_name" "Checking that all dependencies are installed" # Make sure that all run-time dependencies are installed prior to # installing the package. @@ -791,7 +795,7 @@ pkg_install() { die "[$1] Package requires ${required_install%, }" \ "[$1]: Aborting here" - log "[$pkg_name] Installing package" + log "$pkg_name" "Installing package" # Block being able to abort the script with Ctrl+C during installation. # Removes all risk of the user aborting a package installation leaving @@ -846,11 +850,11 @@ pkg_install() { # Run the post install script and suppress errors. If it exists, # it will run, else nothing will happen. [ -x "$KISS_ROOT/$pkg_db/$pkg_name/post-install" ] && { - log "[$pkg_name] Running post-install script" + log "$pkg_name" "Running post-install script" "$KISS_ROOT/$pkg_db/$pkg_name/post-install" ||: } - log "[$pkg_name] Installed successfully" + log "$pkg_name" "Installed successfully" done } @@ -1004,7 +1008,7 @@ args() { for pkg; do pkg_checksums "$pkg" > "$(pkg_search "$pkg")/checksums" - log "[$pkg] Generated checksums" + log "$pkg" "Generated checksums" done ;; @@ -1070,14 +1074,14 @@ args() { ;; h|help|-h|--help|'') - log "kiss [b|c|i|l|r|s|u] [pkg] [pkg] [pkg]" \ - "build: Build a package" \ - "checksum: Generate checksums" \ - "install: Install a package" \ - "list: List installed packages" \ - "remove: Remove a package" \ - "search: Search for a package" \ - "update: Check for updates" + log "kiss [b|c|i|l|r|s|u] [pkg] [pkg] [pkg]" + log "build: Build a package" + log "checksum: Generate checksums" + log "install: Install a package" + log "list: List installed packages" + log "remove: Remove a package" + log "search: Search for a package" + log "update: Check for updates" ;; *) die "'kiss $action' is not a valid command" ;;