diff --git a/README.md b/README.md index a64c5b7..4916481 100644 --- a/README.md +++ b/README.md @@ -73,19 +73,24 @@ a typical handler will accept a newline-separated list of packages to install, enabling batching and the consolidation of interdependent packages into one unit. -## What instalee is not +When installing a package and there is no handler available, +but a package with the name of a handler of the package has an installable candidate, +the handler will be installed, made available and used. + +## Features + +### What instalee is not - a (central) package repository containing package sources - a package manager that can inspect or remove packages -## Planned +### Planned - detection mechanism for handlers and features (e.g. whether they support batching) - helper/hook for adding packages to groups upon install (at least for `pacman`) -## TODOs +### TODOs - Debug corner cases -- Implement Collections - Handler preparation - update repos and cache last update time in /tmp ### Windows diff --git a/handlers.available b/handlers.available index dd62a53..2e5b579 100644 --- a/handlers.available +++ b/handlers.available @@ -1,8 +1,6 @@ arch aur -snap -flatpak script -make zsh linux +cargo diff --git a/handlers/cargo/install b/handlers/cargo/install new file mode 100755 index 0000000..85a75b9 --- /dev/null +++ b/handlers/cargo/install @@ -0,0 +1,2 @@ +#!/bin/sh +cargo install "$@" diff --git a/instalee b/instalee index 66bc17c..b93a70e 100755 --- a/instalee +++ b/instalee @@ -11,7 +11,7 @@ destress() { echo "$1"; } getcontent() { test -x "$1" && "$1" || cat "$1"; } # Get available package entries for given package -get() { +getentries() { cat "$home/handlers.available" | while read handler do find "$home/packages/$1" -name "$handler*" 2>/dev/null done @@ -19,23 +19,31 @@ get() { # Install a package by name installpkg() { - pkgs=$(get "$1") - if test -z "$pkgs" - then - printf "No handler available for package '%s'\n" "$1" >&2 + test "$1" = "--quiet" && local quiet=true && shift + local pkgs=$(getentries "$1") + if test -z "$pkgs"; then + local handlers=$(find "$home/packages/$1" -type f -printf "%f\n" 2>/dev/null) + for handler in $handlers + do installpkg --quiet "$handler" && + echo "$handler" >> "$home/handlers.available" && + installpkg "$1" && + return $? + done + test "$quiet" || + echo "No handler available for package '$1'" >&2 return 2 fi - for pkg in $pkgs; do - highlight "$pkg" - name="$(basename $pkg)" - base="${name%_*}" + for pkg in $pkgs + do highlight "$pkg" + local name="$(basename $pkg)" + local base="${name%_*}" - ext="${name#$base}" - handler="$home/handlers/$base" + local ext="${name#$base}" + local handler="$home/handlers/$base" if test -d "$handler" then - args="$(getcontent "$pkg")" - install="$(find "$handler" -name "install$ext" | head -1)" && + local args="$(getcontent "$pkg" | grep . || echo "$1")" + local install="$(find "$handler" -name "install$ext" | head -1)" && destress " $install $args" && $install $args else @@ -72,6 +80,7 @@ case "$1" in ;; esac +exitcode=0 while test $# -gt 0; do groupfile="$home/groups/$1" if test -f "$groupfile" @@ -80,6 +89,8 @@ while test $# -gt 0; do "$home/handlers/$(head -1 handlers.available)/install" "$pkg" done else installpkg "$1" + exitcode=$(expr $exitcode \| $?) fi shift done +exit $exitcode diff --git a/packages/cargo/apt b/packages/cargo/apt new file mode 100644 index 0000000..e69de29 diff --git a/packages/cargo/arch b/packages/cargo/arch new file mode 100644 index 0000000..871732e --- /dev/null +++ b/packages/cargo/arch @@ -0,0 +1 @@ +rust diff --git a/packages/diffr/aur b/packages/diffr/aur new file mode 100644 index 0000000..e69de29 diff --git a/packages/diffr/cargo b/packages/diffr/cargo new file mode 100644 index 0000000..e69de29