You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
4.2 KiB

# wrapper script to set up environment for butch-core
# and redirects to several extension scripts
# + aliases to some commands
tryconfig() {
test -z "$CONFIG" && { test -e "$1" && CONFIG="$1" ; }
tryconfig "/src/config"
if [ -z "$CONFIG" ] ; then
echo "error: CONFIG not set, and/or no config found in default path"
echo "default path is /src/config"
exit 1
export CONFIG
BINDIR=$(dirname "$(readlink -f "$0")")
# butch-core requires these paths
[ ! -d $C ] && mkdir -p $C
[ ! -d $LOGPATH ] && mkdir -p $LOGPATH
usage() {
cat <<- EOF >&2
butch v$($BINDIR/butch-core 2>&1 | head -n1 | sed -e 's@butch-core v@@')
usage: $0 command package ...
------- available commands -----
install [<package> ... ] # build and install <packages>
download [<package> ... ] # download tarballs required by <packages>
rebuild [<package> ... ] # rebuild already installed <packages>
install-service <args> # install runit system service
relink <package> # create symlinks for an unlinked <package>
relink-one <pkg> <file> # create symlink for <file> of <pkg> into rootfs
unlink <package> # remove symlinks to a specific <package>
rm [<package> ... ] # completely remove installed <packages>
genfilelist <package> # create filelist for <package>
pack [--method] <package> # create a binary archive of <package>
unpack <filename> # install binary archive <filename> created with pack
builddeps <package> # build and install dependencies of package
packapp <package> # packs rarely used app for smaller storage
list # list installed packages
unused # list installed pkgs not required by other installed pkgs
files <package> # show files installed by <package>
mirrors <package> # print mirrors for <package>
owner <file> # print which package owns a <file>
users <package> # print packages with <package> for dependency
deps [<package> ... ] # print deps of <packages>
checksum <package> # print checksums of files for a <package>
reproduce <package> # builds a package twice and compares the differences
checkdownloads # verify all package download links
checktarballs # verify the downloaded package tarballs
printsec <pkg> <section> # print the specified <section> of <package>
search <term> # search for <term> in package names (grep syntax)
descsearch [<term> ... ] # search for <term> in package descriptions (grep)
ucheck [<package> ... ] # check for upstream updates in <packages>
dlinfo <url> [filename] # download url, print initial butch recipe
update # interactively rebuild inst. packages /w new recipes
outdated # print list of inst. pkgs that have an updated recipe
download related actions are performed on-demand, i.e. the tarball is missing
case $1 in
build) shift ; set -- install "$@";;
download) shift ; set -- prefetch "$@";;
pack) shift; prog=butch-pack;;
unpack) shift; prog=butch-unpack;;
packapp) shift; prog=butch-packapp;;
genfilelist) shift; prog=butch-genfilelist;;
builddeps) shift; prog=butch-builddeps;;
list) shift; prog=butch-list;;
unused) shift; prog=butch-unused;;
owner) shift; prog=butch-owner;;
files) shift; prog=butch-files;;
search) shift; prog=butch-search;;
descsearch) shift; prog=butch-descsearch;;
ucheck) shift; prog="butch-ucheck --check";;
printsec) shift; prog=butch-printsec;;
mirrors) shift; prog=butch-mirrors;;
users) shift; prog=butch-users;;
deps) shift; prog=butch-deps;;
checksum) shift; prog=butch-checksum;;
reproduce) shift; prog=butch-reproduce;;
checkdownloads) shift; prog=butch-checkdownloads;;
checktarballs) shift; prog=butch-checktarballs;;
dlinfo) shift; prog=butch-dlinfo;;
install-service) shift; prog=butch-install-service;;
unlink) shift ; prog=butch-unlink;; #remove links of pkg
rm) shift; prog=butch-rm;;
relink|relocate) shift; prog=butch-relocate;; #relinks the pkg into /
relink-one|relocate-one) shift; prog=butch-relocate-one;;
install|prefetch|rebuild|update|outdated) : ;;
*) usage && exit 1;;
exec "$BINDIR"/$prog "$@"