Hash :
11d69506
Author :
Thomas de Grivel
Date :
2023-02-14T12:59:21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
#!/bin/sh
# Copyright 2023 Thomas de Grivel
set -e
# Config
: ${SHPKG_DIR:=~/shpkg}
SHPKG_SHARE_DIR="${SHPKG_DIR}/share/shpkg"
# shpkg
. ${SHPKG_SHARE_DIR}/shpkg.subr
shpkg_lock shpkg.lock
# Usage
usage () {
echo "Usage: shpkg OPERATION PKG ...
Source directory operations :
checkout TREE shortcut for git checkout
clone shortcut for git clone
fetch shortcut for git fetch
pull shortcut for git pull
clean-sources remove source directory
Compilation operations :
autogen shortcut for ./autogen
configure shortcut for ./configure
build shortcut for make
clean-configure remove configured and object files
clean-build remove object files
Package operations :
clean-fake remove fake installation directory
clean-package remove built packages
fake install compiled sources into fake directory
package build package from sources
install install package
installed list installed packages
upgrade pull sources, build package and install
upgrade --all upgrade all packages
uninstall uninstall package
Miscellaneous operations :
list list local packages
" >&2
exit "$1"
}
# CLI
main () {
verbose 2 shpkg_config
if [ "x$1" = "xbuild" ]; then
shift
verbose 2 shpkg_build "$@"
elif [ "x$1" = "xcheckout" ] ||
[ "x$1" = "xco" ]; then
shift
verbose 2 shpkg_checkout "$@"
elif [ "x$1" = "xclean-all" ]; then
shift
verbose 2 shpkg_clean_all "$@"
elif [ "x$1" = "xclean-sources" ]; then
shift
verbose 2 shpkg_clean_sources "$@"
elif [ "x$1" = "xclean-build" ]; then
shift
verbose 2 shpkg_clean_build "$@"
elif [ "x$1" = "xclean-configure" ]; then
shift
verbose 2 shpkg_clean_configure "$@"
elif [ "x$1" = "xclean-fake" ]; then
shift
verbose 2 shpkg_clean_fake "$@"
elif [ "x$1" = "xclean-package" ]; then
shift
verbose 2 shpkg_clean_package "$@"
elif [ "x$1" = "xclean-sources" ]; then
shift
verbose 2 shpkg_clean_sources "$@"
elif [ "x$1" = "xclone" ]; then
shift
verbose 2 shpkg_clone "$@"
elif [ "x$1" = "xconfigure" ]; then
shift
verbose 2 shpkg_configure "$@"
elif [ "x$1" = "xfake" ]; then
shift
verbose 2 shpkg_fake "$@"
elif [ "x$1" = "xfetch" ] ||
[ "x$1" = "xf" ]; then
shift
verbose 2 shpkg_fetch "$@"
elif [ "x$1" = "xhelp" ] ||
[ "x$1" = "xh" ] ||
[ "x$1" = "x--help" ] ||
[ "x$1" = "x-h" ]; then
usage 1
elif [ "x$1" = "xinstall" ] ||
[ "x$1" = "xi" ]; then
shift
verbose 2 shpkg_install "$@"
elif [ "x$1" = "xinstalled" ]; then
shift
verbose 2 shpkg_installed
elif [ "x$1" = "xlist" ] ||
[ "x$1" = "xl" ]; then
shift
verbose 2 shpkg_list
elif [ "x$1" = "xpackage" ] ||
[ "x$1" = "xpkg" ]; then
shift
verbose 2 shpkg_package "$@"
elif [ "x$1" = "xpull" ] ||
[ "x$1" = "xp" ]; then
shift
verbose 2 shpkg_pull "$@"
elif [ "x$1" = "xuninstall" ]; then
shift
verbose 2 shpkg_uninstall "$@"
elif [ "x$1" = "xupdate" ]; then
verbose 2 shpkg_update
elif [ "x$1" = "xupgrade" ]; then
shift
verbose 2 shpkg_upgrade "$@"
else
usage 1
fi
}
shpkg_log shpkg main "$@"